Skip to content

Commit

Permalink
update timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
atopx committed Dec 15, 2021
1 parent 222f1fd commit a380114
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions whois.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ func ConnectWhoisServer(options *QueryOptions) (document string, err error) {
if options.Server == "whois.arin.net" {
options.Key = "n + " + options.Key // 域名: 加拿大、北美地区
}
connect, err := net.DialTimeout("tcp", net.JoinHostPort(options.Server, DefaultWhoisPort), time.Second*30)
connect, err := net.DialTimeout("tcp", net.JoinHostPort(options.Server, DefaultWhoisPort), time.Second*100)
if err != nil {
return document, fmt.Errorf("core: connect to core server failed: %v", err)
}
_ = connect.SetWriteDeadline(time.Now().Add(time.Second * 30))
_ = connect.SetWriteDeadline(time.Now().Add(time.Second * 100))
if _, err = connect.Write([]byte(options.Key + "\r\n")); err != nil {
return document, fmt.Errorf("core: send to core server failed: %v", err)
}
_ = connect.SetReadDeadline(time.Now().Add(time.Second * 30))
_ = connect.SetReadDeadline(time.Now().Add(time.Second * 100))
buffer, err := ioutil.ReadAll(connect)
if err != nil {
return document, fmt.Errorf("core: read from core server failed: %v", err)
Expand Down

0 comments on commit a380114

Please sign in to comment.