Commit graph

7 commits

Author SHA1 Message Date
Miek Gieben
aa7744dc86 cleanups: go vet/golint (#331)
Go vet and golint the new code once again.

Drop Name from NameTemplate - it's cleaner: nametemplate.Template.
2016-10-12 12:46:35 +01:00
Miek Gieben
a05901f62a middleware/proxy: make it scale (#287)
* middleware/proxy

Use connection pooling for communicating with an upstream, instead of
opening a new socket every time.

This makes the proxy more efficient and allowed for some cleanups.

* Some cleanups

* Some fixes

* more

* Kill pool

* Add nil check

* remove pool
2016-10-08 14:46:22 +01:00
Yong Tang
b9cf32f7a9 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>
2016-09-23 23:00:50 +01:00
Miek Gieben
34ffb2b314 Fix TestStubLookup and TestLookup (#213)
Changes large parts of proxy lookup mechanism.

The duplicate zone checking erroneous added a nameserver for each
zone we are auth. for, creating to many backend hosts. So even when a
host was determined do be Down() we still got an (identical) new one
from the list.

The Down() and failure checking for upstream hosts had data race in the
uh.Fails check - we now use atomic.LoadInt32 for that.

Use and debug the test/server.go test servers implementation in the
TestStubLookup test to prevent going out to the internet.

Also delete the stub cycle test. That test was wrong and did not test
what it needed to be testing.  Deleted for now.
2016-08-14 12:57:49 -06:00
Miek Gieben
e635b4e773 middleware/proxy: multiple enhancements (#145)
Add port 53 in the proxy host if not specified.
Check if the host is actually an IP address (v4 or v6)
Remove the http headers and other TODOs
2016-04-30 15:54:41 +01:00
Miek Gieben
f907311cdf Use context.Context
Rename the old Context to State and use context.Context in the
middleware for intra-middleware communication and more.
2016-03-19 07:32:50 +00:00
Miek Gieben
3ec0d9fe6b First commit 2016-03-18 20:57:35 +00:00