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

@@ -190,7 +190,16 @@ func parseBlock(c *caddyfile.Dispenser, u *staticUpstream) error {
}
switch encArgs[0] {
case "dns":
u.ex = newDNSEx()
if len(encArgs) > 1 {
if encArgs[1] == "force_tcp" {
opts := Options{ForceTCP: true}
u.ex = newDNSExWithOption(opts)
} else {
return fmt.Errorf("only force_tcp allowed as parameter to dns")
}
} else {
u.ex = newDNSEx()
}
case "https_google":
boot := []string{"8.8.8.8:53", "8.8.4.4:53"}
if len(encArgs) > 2 && encArgs[1] == "bootstrap" {