UdpSocket
A real UDP socket, for UDP trackers, the DHT, and uTP.
When socks5 is set, this socket is proxied: outbound datagrams are SOCKS5-wrapped (RFC 1928 §7) and physically sent to the proxy's UDP relay, and inbound datagrams are unwrapped so the caller sees the true origin (host, port). The destination IP never leaves the host in clear. This is the seam that routes the engine's shared uTP/DHT/UDP-tracker socket through the proxy without touching UtpSocketManager/UtpStream (they keep sending/receiving on a UdpSocket). Mirrors libtorrent's udp_socket, which wraps/unwraps via its embedded socks5 helper on the exact same datagrams when a SOCKS5 proxy with an open UDP association is configured.
When socks5 is null the behaviour is byte-identical to a plain unproxied socket.
Properties
Functions
Close the socket. For a proxied socket this also tears down the SOCKS5 association (its kept- alive control connection, since the proxy drops the relay when it closes anyway), so an ephemeral proxied socket leaks nothing. The association's close() re-closes this same underlying socket, which is harmless. A direct socket just closes the socket.