This commit is contained in:
Tero Marttila 2016-06-19 21:56:06 +03:00
parent 9912f1dfc0
commit 8eb6f8ab58
3 changed files with 32 additions and 6 deletions

View File

@ -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")')

12
main.go
View File

@ -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"`

View File

@ -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":