pub struct AssociateUdpSocket { /* private fields */ }
Expand description

This is a helper for managing the associated UDP socket.

It will add the socks5 UDP header to every UDP packet it sends, also try to parse the socks5 UDP header from any UDP packet received.

The receiving buffer size for each UDP packet can be set with set_recv_buffer_size(), and be read with get_max_packet_size().

You can create this struct by using AssociateUdpSocket::from::<(UdpSocket, usize)>(), the first element of the tuple is the UDP socket, the second element is the receiving buffer size.

This struct can also be revert into a raw tokio UDP socket with UdpSocket::from::<AssociateUdpSocket>().

Implementations

Connects the UDP socket setting the default destination for send() and limiting packets that are read via recv from the address specified in addr.

Returns the local address that this socket is bound to.

Returns the socket address of the remote peer this socket was connected to.

Get the maximum UDP packet size, with socks5 UDP header included.

Set the maximum UDP packet size, with socks5 UDP header included, for adjusting the receiving buffer size.

Receives a socks5 UDP relay packet on the socket from the remote address to which it is connected. On success, returns the packet itself, the fragment number and the remote target address.

The connect method will connect this socket to a remote address. This method will fail if the socket is not connected.

Receives a socks5 UDP relay packet on the socket from the any remote address. On success, returns the packet itself, the fragment number, the remote target address and the source address.

Sends a UDP relay packet to the remote address to which it is connected. The socks5 UDP header will be added to the packet.

Sends a UDP relay packet to a specified remote address to which it is connected. The socks5 UDP header will be added to the packet.

Trait Implementations

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.