This commit is contained in:
Tero Marttila 2016-06-19 22:50:21 +03:00
parent 89f642d6ff
commit 6acc13e010
5 changed files with 48 additions and 48 deletions

View File

@ -1,11 +1,11 @@
package main
import (
"net"
"github.com/vishvananda/netlink"
"fmt"
"log"
"github.com/vishvananda/netlink"
"io"
"log"
"net"
)
type AddrSet struct {

7
dns.go
View File

@ -1,18 +1,19 @@
package main
import (
"github.com/miekg/dns"
"fmt"
"time"
"github.com/miekg/dns"
"log"
"net"
"time"
)
const TSIG_FUDGE_SECONDS = 300
type TSIGAlgorithm string
func (t *TSIGAlgorithm) UnmarshalFlag(value string) error {
switch (value) {
switch value {
case "hmac-md5", "md5":
*t = dns.HmacMD5
case "hmac-sha1", "sha1":

View File

@ -11,16 +11,17 @@ type Options struct {
Verbose bool `long:"verbose" short:"v"`
Watch bool `long:"watch" description:"Watch for interface changes"`
// Netlink Interface
Interface string `long:"interface" short:"i" value-name:"IFACE" description:"Use address from interface"`
InterfaceFamily Family `long:"interface-family" value-name:"ipv4|ipv6|all" description:"Limit to interface addreses of given family"`
// DNS Update
Server string `long:"server" value-name:"HOST[:PORT]" description:"Server for UPDATE query, default is discovered from zone SOA"`
Timeout time.Duration `long:"timeout" value-name:"DURATION" default:"10s" description:"Timeout for sever queries"`
Retry time.Duration `long:"retry" value-name:"DURATION" default:"30s" description:"Retry interval, increased for each retry attempt"`
TSIGName string `long:"tsig-name" value-name:"FQDN"`
TSIGSecret string `long:"tsig-secret" value-name:"BASE-64" env:"TSIG_SECRET" description:"base64-encoded shared TSIG secret key"`
TSIGAlgorithm TSIGAlgorithm `long:"tsig-algorithm" value-name:"hmac-{md5,sha1,sha256,sha512}" default:"hmac-sha1."`
Zone string `long:"zone" value-name:"FQDN" description:"Zone to update, default is derived from name"`
TTL time.Duration `long:"ttl" value-name:"DURATION" default:"60s" description:"TTL for updated records"`

View File

@ -1,15 +1,15 @@
package main
import (
"github.com/vishvananda/netlink"
"fmt"
"github.com/vishvananda/netlink"
)
// zero value is unspec=all
type Family int
func (f *Family) UnmarshalFlag(value string) error {
switch (value) {
switch value {
case "unspec", "all":
*f = netlink.FAMILY_ALL
case "inet", "ipv4":
@ -22,5 +22,3 @@ func (f *Family) UnmarshalFlag(value string) error {
return nil
}

View File

@ -1,11 +1,11 @@
package main
import (
"github.com/miekg/dns"
"time"
"fmt"
"net"
"github.com/miekg/dns"
"log"
"net"
"time"
)
type updateState struct {