mirror of
https://github.com/nadoo/glider.git
synced 2025-04-22 04:02:07 +08:00
Update client.go
This commit is contained in:
parent
8184bd3cd0
commit
9d9f5c3155
@ -52,8 +52,7 @@ func NewClient(proxy proxy.Proxy, config *Config) (*Client, error) {
|
|||||||
config: config,
|
config: config,
|
||||||
upStream: NewUPStream(config.Servers),
|
upStream: NewUPStream(config.Servers),
|
||||||
upStreamMap: make(map[string]*UPStream),
|
upStreamMap: make(map[string]*UPStream),
|
||||||
httpClient: &http.Client{
|
httpClient: &http.Client{},
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// custom records
|
// custom records
|
||||||
@ -193,7 +192,6 @@ func (c *Client) exchange(qname string, reqBytes []byte, preferTCP bool) (
|
|||||||
case "doh":
|
case "doh":
|
||||||
net.DefaultResolver = &net.Resolver{}
|
net.DefaultResolver = &net.Resolver{}
|
||||||
default:
|
default:
|
||||||
scheme=network
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if e != nil {
|
if e != nil {
|
||||||
@ -212,7 +210,6 @@ func (c *Client) exchange(qname string, reqBytes []byte, preferTCP bool) (
|
|||||||
if c.config.Timeout > 0 && scheme != "doh" {
|
if c.config.Timeout > 0 && scheme != "doh" {
|
||||||
rc.SetDeadline(time.Now().Add(time.Duration(c.config.Timeout) * time.Second))
|
rc.SetDeadline(time.Now().Add(time.Duration(c.config.Timeout) * time.Second))
|
||||||
}
|
}
|
||||||
|
|
||||||
switch scheme {
|
switch scheme {
|
||||||
case "tcp", "dot":
|
case "tcp", "dot":
|
||||||
respBytes, err = c.exchangeTCP(rc, reqBytes)
|
respBytes, err = c.exchangeTCP(rc, reqBytes)
|
||||||
|
Loading…
Reference in New Issue
Block a user