diff --git a/README.md b/README.md index 8a2738a..4d3412a 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,30 @@ The DNS update requests are retried in the background (XXX: currently blocks for ## Usage + Usage: + go-nsupdate [OPTIONS] [Name] + + Application Options: + -v, --verbose + --watch Watch for interface changes + -i, --interface=IFACE Use address from interface + --interface-family=ipv4|ipv6|all + --server=HOST[:PORT] + --timeout=DURATION + --retry=DURATION + --tsig-name=FQDN + --tsig-secret=BASE-64 + --tsig-algorithm=hmac-{md5,sha1,sha256,sha512} + --zone=FQDN Zone to update + --ttl=DURATION + + Help Options: + -h, --help Show this help message + + Arguments: + Name: DNS Name to update + +## Example # Using a generated TSIG key: # TSIG_SECRET=$(python -c 'import os; print os.urandom(32).encode("base64")') diff --git a/main.go b/main.go index b8242b7..5b1de11 100644 --- a/main.go +++ b/main.go @@ -12,17 +12,17 @@ type Options struct { Watch bool `long:"watch" description:"Watch for interface changes"` Interface string `long:"interface" short:"i" value-name:"IFACE" description:"Use address from interface"` - InterfaceFamily Family `long:"interface-family"` + InterfaceFamily Family `long:"interface-family" value-name:"ipv4|ipv6|all"` Server string `long:"server" value-name:"HOST[:PORT]"` Timeout time.Duration `long:"timeout" value-name:"DURATION" default:"10s"` Retry time.Duration `long:"retry" value-name:"DURATION" default:"30s"` - TSIGName string `long:"tsig-name"` - TSIGSecret string `long:"tsig-secret" env:"TSIG_SECRET"` - TSIGAlgorithm TSIGAlgorithm `long:"tsig-algorithm" default:"hmac-sha1."` + TSIGName string `long:"tsig-name" value-name:"FQDN"` + TSIGSecret string `long:"tsig-secret" value-name:"BASE-64" env:"TSIG_SECRET"` + TSIGAlgorithm TSIGAlgorithm `long:"tsig-algorithm" value-name:"hmac-{md5,sha1,sha256,sha512}" default:"hmac-sha1."` - Zone string `long:"zone" description:"Zone to update"` - TTL time.Duration `long:"ttl" default:"60s"` + Zone string `long:"zone" value-name:"FQDN" description:"Zone to update"` + TTL time.Duration `long:"ttl" value-name:"DURATION" default:"60s"` Args struct { Name string `description:"DNS Name to update"` diff --git a/netlink.go b/netlink.go index e701dd3..028c9df 100644 --- a/netlink.go +++ b/netlink.go @@ -10,6 +10,8 @@ type Family int func (f *Family) UnmarshalFlag(value string) error { switch (value) { + case "unspec", "all": + *f = netlink.FAMILY_ALL case "inet", "ipv4": *f = netlink.FAMILY_V4 case "inet6", "ipv6":