Conversation
this is required by bindings to languages whose networking libraries main abstraction are berkley sockets, not connections as in Go
061b68a to
2b4324c
Compare
|
The background for this change seems somewhat confused; the distinction between client and server side is a peculiarity of pan, not of go the "Conn" concept. Arguably, a "net.Conn"/ "net.PacketConn" is a socket, it's just a different name. The reason why pan has this separate client/server thing is that we don't want to do a "hidden" path request during a "send" call. Because of this, unconnected sockets are restricted to sending reply packets, as this can be done without an explicit path request. Indeed, the functionality to use a socket for multiple remotes is missing. An alternative approach could be to export a function that allows a user to initialize a path selector analogous to how listenConn, err := pan.ListenUDP(ctx, local, nil)
pather, err := pan.NewPathSubscriber(ctx, local, dstUDPAddr, policy, selector)
listenConn.WriteToVia(msg, dstUDPAddr, pather.Path())
...
pather.Close()
listenConn.Close() |
this is required by bindings to languages whose networking libraries main abstraction are berkley sockets, not connections as in Go.It is a prerequisite for i.e. P2P applications where you want to act as both client and server on the same address/socket utilizing QUIC implementations that support it i.e rust-quinn.
This change is