cosmetic: more linting

This commit is contained in:
Matthias Radestock committed 2015-03-27 01:21:36 +00:00
1 parent 1ad950f177
commit 2500bc210a
5 files changed
+25 -25

No files matched your search

+1 -1
View File
@@ -69,7 +69,7 @@ func (s *MDNSServer) Start(ifi *net.Interface, localDomain string) error {
mux := dns.NewServeMux()
mux.HandleFunc(localDomain, handleLocal)
mux.HandleFunc(RDNS_DOMAIN, handleReverse)
mux.HandleFunc(RDNSDomain, handleReverse)
s.srv = &dns.Server{
Listener: nil,
+1 -1
View File
@@ -44,7 +44,7 @@ func TestServerSimpleQuery(t *testing.T) {
mdnsServer, err := NewMDNSServer(zone)
wt.AssertNoErr(t, err)
err = mdnsServer.Start(nil, DEFAULT_LOCAL_DOMAIN)
err = mdnsServer.Start(nil, DefaultLocalDomain)
wt.AssertNoErr(t, err)
var receivedAddr net.IP
+16 -16
View File
@@ -11,15 +11,15 @@ import (
)
const (
DEFAULT_LOCAL_DOMAIN = "weave.local." // The default name used for the local domain
DEFAULT_SERVER_PORT = 53 // The default server port
DEFAULT_CLI_CFG_FILE = "/etc/resolv.conf" // default "resolv.conf" file to try to load
DEFAULT_UDP_BUFLEN = 4096 // bigger than the default 512
DEFAULT_CACHE_LEN = 8192 // default cache capacity
DEFAULT_RESOLV_WORKERS = 8 // default number of resolution workers
DEFAULT_TIMEOUT = 5 // default timeout for DNS resolutions
DEFAULT_IFACE_NAME = "default interface"
DEFAULT_RESOLV_TRIES = 3 // max # of times a worker tries to resolve a query
DefaultLocalDomain = "weave.local." // The default name used for the local domain
DefaultServerPort = 53 // The default server port
DefaultCLICfgFile = "/etc/resolv.conf" // default "resolv.conf" file to try to load
DefaultUDPBuflen = 4096 // bigger than the default 512
DefaultCacheLen = 8192 // default cache capacity
DefaultResolvWorkers = 8 // default number of resolution workers
DefaultTimeout = 5 // default timeout for DNS resolutions
DefaultIfaceName = "default interface"
DefaultResolvTries = 3 // max # of times a worker tries to resolve a query
)
type DNSServerConfig struct {
@@ -92,9 +92,9 @@ func NewDNSServer(config DNSServerConfig, zone Zone, iface *net.Interface) (s *D
iface: iface,
listenersWg: new(sync.WaitGroup),
Domain: DEFAULT_LOCAL_DOMAIN,
IfaceName: DEFAULT_IFACE_NAME,
ListenAddr: fmt.Sprintf(":%d", DEFAULT_SERVER_PORT),
Domain: DefaultLocalDomain,
IfaceName: DefaultIfaceName,
ListenAddr: fmt.Sprintf(":%d", DefaultServerPort),
}
// fill empty parameters with defaults...
@@ -107,7 +107,7 @@ func NewDNSServer(config DNSServerConfig, zone Zone, iface *net.Interface) (s *D
if config.UpstreamCfg != nil {
s.upstream = config.UpstreamCfg
} else {
cfgFile := DEFAULT_CLI_CFG_FILE
cfgFile := DefaultCLICfgFile
if len(config.UpstreamCfgFile) > 0 {
cfgFile = config.UpstreamCfgFile
}
@@ -132,7 +132,7 @@ func NewDNSServer(config DNSServerConfig, zone Zone, iface *net.Interface) (s *D
if iface != nil {
s.IfaceName = iface.Name
}
cacheLen := DEFAULT_CACHE_LEN
cacheLen := DefaultCacheLen
if config.CacheLen > 0 {
cacheLen = config.CacheLen
}
@@ -147,7 +147,7 @@ func NewDNSServer(config DNSServerConfig, zone Zone, iface *net.Interface) (s *D
mux := func(proto dnsProtocol) *dns.ServeMux {
m := dns.NewServeMux()
m.HandleFunc(s.Domain, s.queryHandler([]Lookup{s.zone, s.mdnsCli}, proto))
m.HandleFunc(RDNS_DOMAIN, s.rdnsHandler([]Lookup{s.zone, s.mdnsCli}, proto))
m.HandleFunc(RDNSDomain, s.rdnsHandler([]Lookup{s.zone, s.mdnsCli}, proto))
m.HandleFunc(".", s.notUsHandler(proto))
return m
}
@@ -323,7 +323,7 @@ func (s *DNSServer) rdnsHandler(lookups []Lookup, proto dnsProtocol) dns.Handler
// When we receive a request for a name outside of our '.weave.local.'
// domain, ask the configured DNS server as a fallback.
func (s *DNSServer) notUsHandler(proto dnsProtocol) dns.HandlerFunc {
dnsClient := proto.GetNewClient(DEFAULT_UDP_BUFLEN)
dnsClient := proto.GetNewClient(DefaultUDPBuflen)
return func(w dns.ResponseWriter, r *dns.Msg) {
maxLen := getMaxReplyLen(r, proto)
+2 -2
View File
@@ -10,11 +10,11 @@ import (
)
const (
RDNS_DOMAIN = "in-addr.arpa."
RDNSDomain = "in-addr.arpa."
)
// +1 to also exclude a dot
var rdnsDomainLen = len(RDNS_DOMAIN) + 1
var rdnsDomainLen = len(RDNSDomain) + 1
type Lookup interface {
LookupName(name string) (net.IP, error)
+5 -5
View File
@@ -38,14 +38,14 @@ func main() {
flag.BoolVar(&justVersion, "version", false, "print version and exit")
flag.StringVar(&ifaceName, "iface", "", "name of interface to use for multicast")
flag.StringVar(&apiPath, "api", "unix:///var/run/docker.sock", "path to Docker API socket")
flag.StringVar(&localDomain, "localDomain", weavedns.DEFAULT_LOCAL_DOMAIN, "local domain (ie, 'weave.local.')")
flag.StringVar(&localDomain, "localDomain", weavedns.DefaultLocalDomain, "local domain (ie, 'weave.local.')")
flag.IntVar(&wait, "wait", 0, "number of seconds to wait for interface to be created and come up")
flag.IntVar(&dnsPort, "dnsport", weavedns.DEFAULT_SERVER_PORT, "port to listen to DNS requests")
flag.IntVar(&dnsPort, "dnsport", weavedns.DefaultServerPort, "port to listen to DNS requests")
flag.IntVar(&httpPort, "httpport", 6785, "port to listen to HTTP requests")
flag.StringVar(&fallback, "fallback", "", "force a fallback (ie, '8.8.8.8:53') instead of /etc/resolv.conf values")
flag.IntVar(&timeout, "timeout", weavedns.DEFAULT_TIMEOUT, "timeout for resolutions")
flag.IntVar(&udpbuf, "udpbuf", weavedns.DEFAULT_UDP_BUFLEN, "UDP buffer length")
flag.IntVar(&cacheLen, "cache", weavedns.DEFAULT_CACHE_LEN, "cache length")
flag.IntVar(&timeout, "timeout", weavedns.DefaultTimeout, "timeout for resolutions")
flag.IntVar(&udpbuf, "udpbuf", weavedns.DefaultUDPBuflen, "UDP buffer length")
flag.IntVar(&cacheLen, "cache", weavedns.DefaultCacheLen, "cache length")
flag.BoolVar(&watch, "watch", true, "watch the docker socket for container events")
flag.BoolVar(&debug, "debug", false, "output debugging info to stderr")
flag.Parse()