-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
Description
Currently the proxy uses connected sockets. This is a good idea performance-wise, but comes with the obvious limitation on the number of proxied connections.
We should have an API that allows an application more fine-grained control. One option would be a callback on the Server:
type Server struct {
// ... existing stuff
// PacketConnForRemote is called when establishing a new proxied connection.
// It is possible to return the same net.PacketConn (an unconnected UDP socket) for multiple distinct remote address.
// However, the same net.PacketConn cannot be used for the same remote address.
PacketConnForRemote(*net.UDPAddr) net.PacketConn
}The problem here is that the same net.PacketConn can't be used for the same remote address: We need to know which QUIC connection to put a packet on. It's also not clear how timeouts should work: If one proxied connection is closed, it should be possible to reuse the same net.PacketConn at some point, but probably not immediately, since UDP packets might still be in flight between the remote and the proxy.