Reputation: 1
I am a new golang learner, I have created a simple program that sends many requests per second, in fact it works very well until I decide to use proxies, I get many errors but one of them confuses me
proxyconnect tcp: dial tcp 103.126.217.129:8080: connectex: No connection could be made because the target machine actively refused it.
I read that something might be blocking the proxy connection, so I turned off my firewall and unfortunately that didn't make a difference.
I didn't know what I should do to fix this and I hope to get some help from here
MyTransport
MyClient = &http.Transport{
MaxIdleConnsPerHost: 9216,
MaxIdleConns: 0,
MaxConnsPerHost: 0,
DisableKeepAlives: true,
IdleConnTimeout: 20 * time.Second,
TLSHandshakeTimeout: 20 * time.Second,
DialContext: (&net.Dialer{
Timeout: 20 * time.Second,
KeepAlive: 20 * time.Second,
DualStack: true,
}).DialContext,
}
MyClient.Proxy = http.ProxyURL(&url.URL{
Host: hostport,
Scheme: "http",
})
MyClient.Dial = func(network, addr string) (net.Conn, error) {
TCPConnection, err := net.Dial(network, addr)
if err != nil {
return nil, err
}
TCPConnection.(*net.TCPConn).SetKeepAlive(false)
return TCPConnection, err
}
Upvotes: 0
Views: 5062
Reputation: 94
So your issue is going to be on the side you are subscribing to, most likely server side. The script is clearly working otherwise it wouldn't be coming back with an error that it is being refused from the server.
When I shut off my websocket server, I get the same error on my client side.
Consider connecting to the server via a different script to validate or use a programming language your more familiar with until you know your server is working as intended. Also make sure your server is not HTTPS or wanting encryption headers or something.
Upvotes: 0