Pr 586 tweaks (#594)

* add proxy tcp

* add truncated for tcp to udp response

* move truncation to scrubbing

* add test that executes upstream over tcp

* middleware/proxy: some tweaks

rename force-tcp to force_tcp to be inline with the rest and use
a dnsOptions struct to put the options in to allow it to be extended.
Add some parse tests as well.

* Fix test and rename dnsOptions Options
This commit is contained in:
Miek Gieben
2017-03-14 21:32:21 +00:00
committed by GitHub
parent 5b32a07ae6
commit 5ac6020f45
6 changed files with 94 additions and 7 deletions

View File

@@ -14,6 +14,11 @@ import (
// NewLookup create a new proxy with the hosts in host and a Random policy.
func NewLookup(hosts []string) Proxy {
return NewLookupWithOption(hosts, Options{})
}
// NewLookupWithForcedProto process creates a simple round robin forward with potentially forced proto for upstream.
func NewLookupWithOption(hosts []string, opts Options) Proxy {
p := Proxy{Next: nil}
upstream := &staticUpstream{
@@ -23,7 +28,7 @@ func NewLookup(hosts []string) Proxy {
Spray: nil,
FailTimeout: 10 * time.Second,
MaxFails: 3, // TODO(miek): disable error checking for simple lookups?
ex: newDNSEx(),
ex: newDNSExWithOption(opts),
}
for i, host := range hosts {