Hello all: How would I configure http.transport to handle using different ipv6 addresses to issue http requests (makeshift proxies). What I've tried:
localAddr, err := net.ResolveIPAddr("ip6", "{ipv6 address}")
if err != nil {
panic(err)
}
localTCPAddr := net.TCPAddr{
IP: localAddr.IP,
}
webclient := &http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
LocalAddr: &localTCPAddr,
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialContext,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
}
This fails with with ipv6 addresses:
panic: Get https://myip.addr.space/: dial tcp [{localAddr}]:0->[{hostip?}]:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
I have two main questions. How can I:
- Find the range of available ipv6 addresses I can use
- Use them programmatically in golang to make http requests (again, mimicking a proxy)
I guess what i'm asking is: how can I replicate this: https://github.com/blechschmidt/freebind/blob/master/freebind.c in go.