pub struct Transmit {
pub proto: Protocol,
pub source: SocketAddr,
pub destination: SocketAddr,
pub contents: DatagramSend,
}
Expand description
An instruction to send an outgoing packet.
Fields§
§proto: Protocol
Protocol the transmission should use.
Provided to each of the Candidate
constructors.
source: SocketAddr
The source IP this packet should be sent from.
For ICE it’s important to send outgoing packets from the correct IP address. The IP could come from a local socket or relayed over a TURN server. Features like hole-punching will only work if the packets are routed through the correct interfaces.
This address will either be:
- The address of a socket you have bound locally, such as with
UdpSocket::bind
. - The address of a relay socket that you have allocated using TURN.
To correctly handle an instance of Transmit
, you should:
- Check if
Transmit::source
corresponds to one of your local sockets, if yes, send it through that. - Check if
Transmit::source
corresponds to one of your relay sockets (i.e. allocations), if yes, send it via one of:
str0m
learns about the source address using Candidate
that are added using
Rtc::add_local_candidate
.
The different candidate types are:
Candidate::host()
: Used for locally bound UDP sockets.Candidate::relayed()
: Used for sockets relayed via some other server (normally TURN).Candidate::server_reflexive()
: Used when a local (host) socket appears as some another IP address to the remote peer (usually due to a NAT firewall on the local side). STUN servers can be used to discover the external address. In this case thebase
parameter toserver_reflexive()
is the local address and used forTransmit::source
.Peer reflexive
is another, internal, type of candidate that str0m infers by using the other types of candidates.
destination: SocketAddr
The destination address this datagram should be sent to.
This will be one of the Candidate
provided explicitly using
Rtc::add_remote_candidate
or via SDP negotiation.
contents: DatagramSend
Contents of the datagram.