summaryrefslogtreecommitdiff
path: root/vendor/github.com/miekg/dns/msg_helpers.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/miekg/dns/msg_helpers.go')
-rw-r--r--vendor/github.com/miekg/dns/msg_helpers.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/miekg/dns/msg_helpers.go b/vendor/github.com/miekg/dns/msg_helpers.go
index ea2035cd2..42d5cd535 100644
--- a/vendor/github.com/miekg/dns/msg_helpers.go
+++ b/vendor/github.com/miekg/dns/msg_helpers.go
@@ -810,3 +810,37 @@ func unpackDataAplPrefix(msg []byte, off int) (APLPrefix, int, error) {
Network: ipnet,
}, off, nil
}
+
+func unpackIPSECGateway(msg []byte, off int, gatewayType uint8) (net.IP, string, int, error) {
+ var retAddr net.IP
+ var retString string
+ var err error
+
+ switch gatewayType {
+ case IPSECGatewayNone: // do nothing
+ case IPSECGatewayIPv4:
+ retAddr, off, err = unpackDataA(msg, off)
+ case IPSECGatewayIPv6:
+ retAddr, off, err = unpackDataAAAA(msg, off)
+ case IPSECGatewayHost:
+ retString, off, err = UnpackDomainName(msg, off)
+ }
+
+ return retAddr, retString, off, err
+}
+
+func packIPSECGateway(gatewayAddr net.IP, gatewayString string, msg []byte, off int, gatewayType uint8, compression compressionMap, compress bool) (int, error) {
+ var err error
+
+ switch gatewayType {
+ case IPSECGatewayNone: // do nothing
+ case IPSECGatewayIPv4:
+ off, err = packDataA(gatewayAddr, msg, off)
+ case IPSECGatewayIPv6:
+ off, err = packDataAAAA(gatewayAddr, msg, off)
+ case IPSECGatewayHost:
+ off, err = packDomainName(gatewayString, msg, off, compression, compress)
+ }
+
+ return off, err
+}