Skip to main content

addr_encoding_len

Function addr_encoding_len 

Source
pub fn addr_encoding_len(addr: &TargetAddr) -> usize
Expand description

The RFC 1928 address encoding’s length for addr (ATYP + addr + port — exactly TargetAddr::to_be_bytes()’s size): 7 bytes for IPv4, 19 for IPv6, 4 + domain.len() for domain form (259 max). Callers compute the joint bound with it: a payload is framable for addr iff addr_encoding_len(addr) + payload.len() <= MAX_INNER_LEN.