go fmt
This commit is contained in:
parent
89f642d6ff
commit
6acc13e010
6
addr.go
6
addr.go
|
@ -1,11 +1,11 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
|
||||||
"github.com/vishvananda/netlink"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"github.com/vishvananda/netlink"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AddrSet struct {
|
type AddrSet struct {
|
||||||
|
|
7
dns.go
7
dns.go
|
@ -1,18 +1,19 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/miekg/dns"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"github.com/miekg/dns"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const TSIG_FUDGE_SECONDS = 300
|
const TSIG_FUDGE_SECONDS = 300
|
||||||
|
|
||||||
type TSIGAlgorithm string
|
type TSIGAlgorithm string
|
||||||
|
|
||||||
func (t *TSIGAlgorithm) UnmarshalFlag(value string) error {
|
func (t *TSIGAlgorithm) UnmarshalFlag(value string) error {
|
||||||
switch (value) {
|
switch value {
|
||||||
case "hmac-md5", "md5":
|
case "hmac-md5", "md5":
|
||||||
*t = dns.HmacMD5
|
*t = dns.HmacMD5
|
||||||
case "hmac-sha1", "sha1":
|
case "hmac-sha1", "sha1":
|
||||||
|
|
3
main.go
3
main.go
|
@ -11,16 +11,17 @@ type Options struct {
|
||||||
Verbose bool `long:"verbose" short:"v"`
|
Verbose bool `long:"verbose" short:"v"`
|
||||||
Watch bool `long:"watch" description:"Watch for interface changes"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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."`
|
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"`
|
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"`
|
TTL time.Duration `long:"ttl" value-name:"DURATION" default:"60s" description:"TTL for updated records"`
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/vishvananda/netlink"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/vishvananda/netlink"
|
||||||
)
|
)
|
||||||
|
|
||||||
// zero value is unspec=all
|
// zero value is unspec=all
|
||||||
type Family int
|
type Family int
|
||||||
|
|
||||||
func (f *Family) UnmarshalFlag(value string) error {
|
func (f *Family) UnmarshalFlag(value string) error {
|
||||||
switch (value) {
|
switch value {
|
||||||
case "unspec", "all":
|
case "unspec", "all":
|
||||||
*f = netlink.FAMILY_ALL
|
*f = netlink.FAMILY_ALL
|
||||||
case "inet", "ipv4":
|
case "inet", "ipv4":
|
||||||
|
@ -22,5 +22,3 @@ func (f *Family) UnmarshalFlag(value string) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue