likexian / whois

Whois client for domain and ip whois information query in Go(Golang).
Apache License 2.0
382 stars 70 forks source link

ioutil.ReadAll blocks for ever #5

Closed akissa closed 5 years ago

akissa commented 6 years ago

In some cases ioutil.ReadAll (https://github.com/likexian/whois-go/blob/master/whois.go#L99) blocks for ever. Investigation indicates the remote side does not close the connection.

likexian commented 6 years ago

Hello, thanks for your advice.

Did you catch a whois server like this?

akissa commented 6 years ago

Yes

likexian commented 6 years ago

Will you provide the whois server and query domain for me? I will try to find out how to fix it.

akissa commented 6 years ago

The error appeared when querying the default com.whois-servers.net for a .com domain. I fixed it using SetReadDeadline and a for loop to read from bufio.NewReader.

likexian commented 6 years ago

I have try this, but it return immediately with "No match for nameserver "COM"."

However, thanks to your advice, and I will consider it.

akissa commented 6 years ago

You need to read it in a loop. https://github.com/akissa/whois-go/blob/master/whois.go#L100

likexian commented 5 years ago

Hello, Thanks to @akissa , this issue have fixed, and I have added ip whois query supported. Feel free to use.