summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/miekg/dns/edns.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/miekg/dns/edns.go')
-rw-r--r--vendor/github.com/miekg/dns/edns.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/vendor/github.com/miekg/dns/edns.go b/vendor/github.com/miekg/dns/edns.go
index 7a58aa9b1..0550aaa39 100644
--- a/vendor/github.com/miekg/dns/edns.go
+++ b/vendor/github.com/miekg/dns/edns.go
@@ -128,8 +128,18 @@ func (rr *OPT) Do() bool {
}
// SetDo sets the DO (DNSSEC OK) bit.
-func (rr *OPT) SetDo() {
- rr.Hdr.Ttl |= _DO
+// If we pass an argument, set the DO bit to that value.
+// It is possible to pass 2 or more arguments. Any arguments after the 1st is silently ignored.
+func (rr *OPT) SetDo(do ...bool) {
+ if len(do) == 1 {
+ if do[0] {
+ rr.Hdr.Ttl |= _DO
+ } else {
+ rr.Hdr.Ttl &^= _DO
+ }
+ } else {
+ rr.Hdr.Ttl |= _DO
+ }
}
// EDNS0 defines an EDNS0 Option. An OPT RR can have multiple options appended to it.