net: Golang udp listener send reply with unexpected source ip #36421
From the discussions I've read in similar issues (#23367 (comment), #17930), there hasn't been a consensus on a better UDP API. I'm no networking expert, but I believe nginx is copying over the address from the inbound UDP to the outbound UDP message. I believe it's doable in Go, but there's not an obvious way to me in the standard library right now.
I'm not sure how WriteToUDP would know which interface you read from unless you were explicitly telling it, given the way the listener works.