summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTero Marttila <[email protected]>2016-06-19 21:56:06 +0300
committerTero Marttila <[email protected]>2016-06-19 21:56:06 +0300
commit8eb6f8ab58d2f8016319639c40116ea04c85af68 (patch)
tree0d8c1062376c9a57ce799deb039125515fc9f3f2
parent9912f1dfc026fdd1f793670dae08c8afe9981c26 (diff)
usage
-rw-r--r--README.md24
-rw-r--r--main.go12
-rw-r--r--netlink.go2
3 files changed, 32 insertions, 6 deletions
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":