usage
This commit is contained in:
parent
9912f1dfc0
commit
8eb6f8ab58
24
README.md
24
README.md
|
@ -13,6 +13,30 @@ The DNS update requests are retried in the background (XXX: currently blocks for
|
||||||
|
|
||||||
## Usage
|
## 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:
|
# Using a generated TSIG key:
|
||||||
# TSIG_SECRET=$(python -c 'import os; print os.urandom(32).encode("base64")')
|
# TSIG_SECRET=$(python -c 'import os; print os.urandom(32).encode("base64")')
|
||||||
|
|
12
main.go
12
main.go
|
@ -12,17 +12,17 @@ type Options struct {
|
||||||
Watch bool `long:"watch" description:"Watch for interface changes"`
|
Watch bool `long:"watch" description:"Watch for interface changes"`
|
||||||
|
|
||||||
Interface string `long:"interface" short:"i" value-name:"IFACE" description:"Use address from interface"`
|
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]"`
|
Server string `long:"server" value-name:"HOST[:PORT]"`
|
||||||
Timeout time.Duration `long:"timeout" value-name:"DURATION" default:"10s"`
|
Timeout time.Duration `long:"timeout" value-name:"DURATION" default:"10s"`
|
||||||
Retry time.Duration `long:"retry" value-name:"DURATION" default:"30s"`
|
Retry time.Duration `long:"retry" value-name:"DURATION" default:"30s"`
|
||||||
TSIGName string `long:"tsig-name"`
|
TSIGName string `long:"tsig-name" value-name:"FQDN"`
|
||||||
TSIGSecret string `long:"tsig-secret" env:"TSIG_SECRET"`
|
TSIGSecret string `long:"tsig-secret" value-name:"BASE-64" env:"TSIG_SECRET"`
|
||||||
TSIGAlgorithm TSIGAlgorithm `long:"tsig-algorithm" default:"hmac-sha1."`
|
TSIGAlgorithm TSIGAlgorithm `long:"tsig-algorithm" value-name:"hmac-{md5,sha1,sha256,sha512}" default:"hmac-sha1."`
|
||||||
|
|
||||||
Zone string `long:"zone" description:"Zone to update"`
|
Zone string `long:"zone" value-name:"FQDN" description:"Zone to update"`
|
||||||
TTL time.Duration `long:"ttl" default:"60s"`
|
TTL time.Duration `long:"ttl" value-name:"DURATION" default:"60s"`
|
||||||
|
|
||||||
Args struct {
|
Args struct {
|
||||||
Name string `description:"DNS Name to update"`
|
Name string `description:"DNS Name to update"`
|
||||||
|
|
|
@ -10,6 +10,8 @@ type Family int
|
||||||
|
|
||||||
func (f *Family) UnmarshalFlag(value string) error {
|
func (f *Family) UnmarshalFlag(value string) error {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
case "unspec", "all":
|
||||||
|
*f = netlink.FAMILY_ALL
|
||||||
case "inet", "ipv4":
|
case "inet", "ipv4":
|
||||||
*f = netlink.FAMILY_V4
|
*f = netlink.FAMILY_V4
|
||||||
case "inet6", "ipv6":
|
case "inet6", "ipv6":
|
||||||
|
|
Loading…
Reference in New Issue