mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 01:15:41 +08:00
dns: SetDeadline for all remote connection
This commit is contained in:
parent
515a5dffa5
commit
14b072832d
2
.gitignore
vendored
2
.gitignore
vendored
@ -15,6 +15,8 @@
|
||||
.glide/
|
||||
|
||||
# custom
|
||||
.idea
|
||||
.vscode
|
||||
*.zip
|
||||
/*.conf
|
||||
/*.rule
|
||||
|
@ -309,6 +309,5 @@ Examples:
|
||||
|
||||
## Links
|
||||
|
||||
- [go-ss2](https://github.com/shadowsocks/go-shadowsocks2): ss protocol support
|
||||
- [conflag](https://github.com/nadoo/conflag): command line and config file parse support
|
||||
- [ArchLinux](https://www.archlinux.org/packages/community/x86_64/glider): a great linux distribution with glider pre-built package
|
||||
|
@ -149,9 +149,7 @@ func (c *Client) exchange(qname string, reqBytes []byte, preferTCP bool) (server
|
||||
defer rc.Close()
|
||||
|
||||
// TODO: support timeout setting for different upstream server
|
||||
if len(servers) > 1 {
|
||||
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 network {
|
||||
case "tcp":
|
||||
|
@ -208,7 +208,9 @@ func (c *Conn) DecodeRespHeader() error {
|
||||
|
||||
stream := cipher.NewCFBDecrypter(block, c.respBodyIV[:])
|
||||
buf := make([]byte, 4)
|
||||
io.ReadFull(c.Conn, buf)
|
||||
if _, err := io.ReadFull(c.Conn, buf); err != nil {
|
||||
return err
|
||||
}
|
||||
stream.XORKeyStream(buf, buf)
|
||||
|
||||
if buf[0] != c.reqRespV {
|
||||
|
Loading…
Reference in New Issue
Block a user