mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
dns: add dnsalwaystcp config. #49
This commit is contained in:
1 parent
2f239d60f1
commit
529786acf6
4 files changed
+12
-12
No files matched your search
+7
-6
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user