Source File
muxfunc.go
Belonging Package
github.com/pion/webrtc/v4/internal/mux
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage mux// MatchFunc allows custom logic for mapping packets to an Endpoint.type MatchFunc func([]byte) bool// MatchAll always returns true.func ([]byte) bool {return true}// MatchRange returns true if the first byte of buf is in [lower..upper].func (, byte, []byte) bool {if len() < 1 {return false}:= [0]return >= && <=}// 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// +----------------+// MatchDTLS is a MatchFunc that accepts packets with the first byte in [20..63]// as defied in RFC7983.func ( []byte) bool {return MatchRange(20, 63, )}// MatchSRTPOrSRTCP is a MatchFunc that accepts packets with the first byte in [128..191]// as defied in RFC7983.func ( []byte) bool {return MatchRange(128, 191, )}func isRTCP( []byte) bool {// Not long enough to determine RTP/RTCPif len() < 4 {return false}return [1] >= 192 && [1] <= 223}// MatchSRTP is a MatchFunc that only matches SRTP and not SRTCP.func ( []byte) bool {return MatchSRTPOrSRTCP() && !isRTCP()}// MatchSRTCP is a MatchFunc that only matches SRTCP and not SRTP.func ( []byte) bool {return MatchSRTPOrSRTCP() && isRTCP()}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |