summaryrefslogtreecommitdiff
path: root/dns.go
diff options
context:
space:
mode:
Diffstat (limited to 'dns.go')
-rw-r--r--dns.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/dns.go b/dns.go
new file mode 100644
index 0000000..4822012
--- /dev/null
+++ b/dns.go
@@ -0,0 +1,26 @@
+package main
+
+import (
+ "github.com/miekg/dns"
+ "fmt"
+)
+
+const TSIG_FUDGE_SECONDS = 300
+type TSIGAlgorithm string
+
+func (t *TSIGAlgorithm) UnmarshalFlag(value string) error {
+ switch (value) {
+ case "hmac-md5", "md5":
+ *t = dns.HmacMD5
+ case "hmac-sha1", "sha1":
+ *t = dns.HmacSHA1
+ case "hmac-sha256", "sha256":
+ *t = dns.HmacSHA256
+ case "hmac-sha512", "sha512":
+ *t = dns.HmacSHA512
+ default:
+ return fmt.Errorf("Invalid --tsig-algorithm=%v", value)
+ }
+
+ return nil
+}