Expand description
Small shared helpers: packet demultiplexing predicates and random-string generation. Shared helpers: packet demultiplexing and random strings.
WebRTC multiplexes STUN, DTLS and SRTP onto one port, so the first byte of a datagram decides
which layer receives it (RFC 7983). The match_* predicates implement those ranges, and
is_rtcp separates RTCP from RTP once a packet is known to be one of the two.
Functions§
- generate_
crypto_ random_ string - Generates a random
n-character string drawn fromrunes. - is_rtcp
- Returns
trueifbufis RTCP rather than RTP. - lookup_
host - lookup host to SocketAddr
- match_
dtls - MatchFuncs as described in RFC7983 https://tools.ietf.org/html/rfc7983 +––––––––+ | [0..3] -+–> forward to STUN | | | [16..19] -+–> forward to ZRTP | | packet –> | [20..63] -+–> forward to DTLS | | | [64..79] -+–> forward to TURN Channel | | | [128..191] -+–> forward to RTP/RTCP +––––––––+ match_dtls is a MatchFunc that accepts packets with the first byte in [20..63] as defied in RFC7983
- match_
srtcp - match_srtcp is a MatchFunc that only matches SRTCP and not SRTP
- match_
srtp - match_srtp is a MatchFunc that only matches SRTP and not SRTCP
- match_
srtp_ or_ srtcp - Returns
trueifblooks like SRTP or SRTCP: its first byte is in[128, 191]. - math_
rand_ alpha - math_rand_alpha generates a mathematical random alphabet sequence of the requested length.
- math_
rand_ alpha_ number - math_rand_alpha generates a mathematical random alphabet and number sequence of the requested length.