pub struct Peer { /* private fields */ }Expand description
One connection, as the voice plane sees it.
Implementations§
Source§impl Peer
impl Peer
pub fn new( connection: ConnectionId, session: SessionId, host: IpAddr, crypt: CryptState, queue: Arc<OutboundQueue>, plane: ShardPlane, now: Instant, ) -> Peer
Sourcepub fn online_since(&self) -> Instant
pub fn online_since(&self) -> Instant
When this connection was registered.
Sourcepub fn record_report(&self, report: ClientReport)
pub fn record_report(&self, report: ClientReport)
Store what the client reported about its own side of the link.
pub fn reported(&self) -> ClientReport
Sourcepub fn traffic(&self, now: Instant) -> (u32, Duration)
pub fn traffic(&self, now: Instant) -> (u32, Duration)
Voice throughput over the last second, in bytes per second, and how long this connection has been idle.
Sourcepub fn record_activity(&self, now: Instant)
pub fn record_activity(&self, now: Instant)
Note a control message that is not a keepalive.
pub fn connection(&self) -> ConnectionId
pub fn session(&self) -> SessionId
pub fn host(&self) -> IpAddr
pub fn queue(&self) -> Arc<OutboundQueue>
pub fn cursor_cell(&self) -> Arc<AtomicU64>
pub fn cursor(&self) -> u64
pub fn shard(&self) -> ShardId
Sourcepub fn routing(&self) -> Arc<AudioRouting>
pub fn routing(&self) -> Arc<AudioRouting>
The routing table of the shard this connection belongs to.
Sourcepub fn move_to(&self, plane: ShardPlane)
pub fn move_to(&self, plane: ShardPlane)
Point this connection at another shard. Called by a migration, once.
Sourcepub fn decrypt(&self, datagram: &[u8]) -> Option<Vec<u8>>
pub fn decrypt(&self, datagram: &[u8]) -> Option<Vec<u8>>
Try to decrypt a datagram in this peer’s OCB2 domain.
A failure is side-effect free - the IV is restored and nothing is written to the replay history - which is what makes the cold path’s “try every candidate” safe.
REF: references/mumble/src/murmur/Server.cpp : Server::run binds an
unknown peer to the first checkDecrypt that succeeds.
pub fn encrypt(&self, plaintext: &[u8]) -> Option<Vec<u8>>
Sourcepub fn crypt_counters(&self) -> (u32, u32, u32)
pub fn crypt_counters(&self) -> (u32, u32, u32)
The OCB2 counters the TCP Ping reply must report.
Sourcepub fn allow_voice(&self, now: Instant, bytes: usize) -> bool
pub fn allow_voice(&self, now: Instant, bytes: usize) -> bool
Whether this peer may send one more voice packet right now.
Sourcepub fn allow_text(&self, now: Instant) -> bool
pub fn allow_text(&self, now: Instant) -> bool
Whether this peer may send one more text message right now.
Sourcepub fn set_udp_mode(&self, on: bool)
pub fn set_udp_mode(&self, on: bool)
Record that this peer’s audio is arriving over UDP again, or that it has fallen back to the tunnel.
REF: references/mumble/src/murmur/Server.cpp : aiUdpFlag goes to 0 on a
UDPTunnel message and back to 1 when a datagram arrives.
Sourcepub fn destination(&self) -> Option<SocketAddr>
pub fn destination(&self) -> Option<SocketAddr>
Where audio for this peer goes: its proven address, or None meaning the
TCP tunnel.
Both conditions are required, as in the real server: a proven address and a peer whose own audio last came over UDP. A client whose UDP dies mid-call keeps hearing everyone, through the tunnel.
Sourcepub fn proven_address(&self) -> Option<SocketAddr>
pub fn proven_address(&self) -> Option<SocketAddr>
The address this peer has proven, whatever transport it last used.