diff options
author | 2016-09-24 06:00:50 +0800 | |
---|---|---|
committer | 2016-09-23 23:00:50 +0100 | |
commit | b9cf32f7a9e02492927263f3f7f1281ffc112255 (patch) | |
tree | 64708b1f5dc619a903f8450f4892daef1f6c8f17 | |
parent | 0959b52e799eed3152b3695885887e22557edb3a (diff) | |
download | coredns-b9cf32f7a9e02492927263f3f7f1281ffc112255.tar.gz coredns-b9cf32f7a9e02492927263f3f7f1281ffc112255.tar.zst coredns-b9cf32f7a9e02492927263f3f7f1281ffc112255.zip |
Golint middleware/proxy (#290)
While looking into the proxy middleware it appears that there are
several golint messages:
```
ubuntu@ubuntu:~/coredns$ golint middleware/proxy/
middleware/proxy/lookup.go:66:1: exported method Proxy.Forward should have comment or be unexported
middleware/proxy/proxy.go:24:6: exported type Client should have comment or be unexported
middleware/proxy/proxy.go:107:1: exported function Clients should have comment or be unexported
middleware/proxy/reverseproxy.go:10:6: exported type ReverseProxy should have comment or be unexported
middleware/proxy/reverseproxy.go:16:1: exported method ReverseProxy.ServeDNS should have comment or be unexported
middleware/proxy/upstream.go:42:6: exported type Options should have comment or be unexported
```
This fix addressed the above golint messages.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
-rw-r--r-- | middleware/proxy/lookup.go | 1 | ||||
-rw-r--r-- | middleware/proxy/proxy.go | 2 | ||||
-rw-r--r-- | middleware/proxy/reverseproxy.go | 2 | ||||
-rw-r--r-- | middleware/proxy/upstream.go | 1 |
4 files changed, 6 insertions, 0 deletions
diff --git a/middleware/proxy/lookup.go b/middleware/proxy/lookup.go index e2a3a0c77..087792dc3 100644 --- a/middleware/proxy/lookup.go +++ b/middleware/proxy/lookup.go @@ -63,6 +63,7 @@ func (p Proxy) Lookup(state request.Request, name string, tpe uint16) (*dns.Msg, return p.lookup(state, req) } +// Forward will forward the request to upstream func (p Proxy) Forward(state request.Request) (*dns.Msg, error) { return p.lookup(state, state.Req) } diff --git a/middleware/proxy/proxy.go b/middleware/proxy/proxy.go index 7057a96e0..08dec7579 100644 --- a/middleware/proxy/proxy.go +++ b/middleware/proxy/proxy.go @@ -21,6 +21,7 @@ type Proxy struct { Upstreams []Upstream } +// Client represents client information that the proxy uses. type Client struct { UDP *dns.Client TCP *dns.Client @@ -104,6 +105,7 @@ func (p Proxy) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ( return p.Next.ServeDNS(ctx, w, r) } +// Clients returns the new client for proxy requests. func Clients() Client { udp := newClient("udp", defaultTimeout) tcp := newClient("tcp", defaultTimeout) diff --git a/middleware/proxy/reverseproxy.go b/middleware/proxy/reverseproxy.go index c452e296c..2155dcadc 100644 --- a/middleware/proxy/reverseproxy.go +++ b/middleware/proxy/reverseproxy.go @@ -7,12 +7,14 @@ import ( "github.com/miekg/dns" ) +// ReverseProxy is a basic reverse proxy type ReverseProxy struct { Host string Client Client Options Options } +// ServeDNS implements the middleware.Handler interface. func (p ReverseProxy) ServeDNS(w dns.ResponseWriter, r *dns.Msg, extra []dns.RR) error { var ( reply *dns.Msg diff --git a/middleware/proxy/upstream.go b/middleware/proxy/upstream.go index dc08a48e0..dccc02b9f 100644 --- a/middleware/proxy/upstream.go +++ b/middleware/proxy/upstream.go @@ -39,6 +39,7 @@ type staticUpstream struct { options Options } +// Options ... type Options struct { Ecs []*net.IPNet // EDNS0 CLIENT SUBNET address (v4/v6) to add in CIDR notaton. } |