1
0
mirror of https://github.com/taigrr/godns synced 2025-01-18 04:03:25 -08:00

remove proxy while getting the public ip

remove proxy while getting the public ip,
otherwise ip of socks server would be returned
This commit is contained in:
Jemy Zhang 2020-03-21 18:14:37 +08:00
parent f5a793a907
commit df549ddc33

View File

@ -159,19 +159,6 @@ func GetCurrentIP(configuration *Settings) (string, error) {
func GetIPOnline(configuration *Settings) (string, error) { func GetIPOnline(configuration *Settings) (string, error) {
client := &http.Client{} client := &http.Client{}
if configuration.Socks5Proxy != "" {
log.Println("use socks5 proxy:" + configuration.Socks5Proxy)
dialer, err := proxy.SOCKS5("tcp", configuration.Socks5Proxy, nil, proxy.Direct)
if err != nil {
log.Println("can't connect to the proxy:", err)
return "", err
}
httpTransport := &http.Transport{}
client.Transport = httpTransport
httpTransport.Dial = dialer.Dial
}
var response *http.Response var response *http.Response
var err error var err error