I want to send http requests from a fixed, outgoing port. How can I do this in Go?
评论:
lstokeworth:
me_again:Create Transport with Dial function that calls net.DialTCP with desired local port. Create Client using the transport. Use that client to make HTTP requests.
drink_with_me_to_day:I’m curious why you want to do that?
xandout:Making a network test where I need to manage outgoing data QOS. Having fixed ports would make the SDN flows easy to configure.
For the most part you don't set the outbound port for any communication. Your OS picks a random, unused high number port and you use that.
If you can tell us the underlying OS it may be possible to find a solution.
