dns: add dnsalwaystcp config. #49

This commit is contained in:
nadoo committed 2018-08-26 22:36:14 +08:00
1 parent 2f239d60f1
commit 529786acf6
4 files changed
+12 -12

No files matched your search

+7 -6
View File
@@ -18,11 +18,12 @@ type HandleFunc func(Domain, ip string) error
// Config for dns
type Config struct {
Servers []string
Timeout int
MaxTTL int
MinTTL int
Records []string
Servers []string
Timeout int
MaxTTL int
MinTTL int
Records []string
AlwaysTCP bool
}
// Client is a dns client struct
@@ -133,7 +134,7 @@ func (c *Client) exchange(qname string, reqBytes []byte, preferTCP bool) (server
}
// If client uses udp and no forwarders specified, use udp
if !preferTCP && dialer.Addr() == "DIRECT" {
if !preferTCP && !c.config.AlwaysTCP && dialer.Addr() == "DIRECT" {
network = "udp"
}