alaingilbert / ogame

Golang ogame wrapper

Home Page:https://godoc.org/github.com/alaingilbert/ogame

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

connectChat reveals your IP Adress if you set a proxy for the bot!

TuxLinus opened this issue · comments

First shot for a Solution:

in the function there are two parts who reveals the IP

http.NewRequest and websocket.Dial

proxyUrl, err := url.Parse("http://proxyIp:proxyPort")
myClient := &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyUrl)}}
/*
You could also modify the default transport used by the "net/http" package. This would affect your entire program (including the default HTTP client).
*/

proxyUrl, err := url.Parse("http://proxyIp:proxyPort")
http.DefaultTransport = &http.Transport{Proxy: http.ProxyURL(proxyUrl)}
 var d = websocket.Dialer{
     Proxy: http.ProxyURL(&url.URL{
          Scheme: "http", // or "https" depending on your proxy
          Host: "ipaddress:port" ,
          Path: "/",
    }
 } 
commented

Okay @TuxLinus I would like to say that the http has already set an Transport Proxy in the api ogame.go any further requests are using the Proxy Server!

about the Websocket.Dialer yes it seems that it uses Direct Connection and dont uses the http Proxy.

Admins don't see the IP of the websocket in their tool.