Hey all
I have several net interfaces with different IP networks on my machine. I am trying to define dynamic LocalAddress for net.Dialer{} (random IP per request to avoid running out of ports), but so far without success.
The only idea for now it is to create pool of handlers, each one with own transport on different IP and draw randomly from them, but maybe there is easier way?
I am thinking about something like:
defaultTransport: &http.Transport{
Dial: (&net.Dialer{
LocalAddr: getDynamicLocalAddress(),
}).Dial,
},
Which obviously will draw only once during setting up listener.