bird-lg-go/frontend/whois.go
2019-01-08 13:57:53 +08:00

23 lines
367 B
Go

package main
import (
"net"
"io/ioutil"
)
// Send a whois request
func whois(s string) string {
conn, err := net.Dial("tcp", settingWhoisServer + ":43")
if err != nil {
return err.Error()
}
defer conn.Close()
conn.Write([]byte(s + "\r\n"))
result, err := ioutil.ReadAll(conn)
if err != nil {
return err.Error()
}
return string(result)
}