Source File
connection_id.go
Belonging Package
github.com/pion/turn/v4/internal/proto
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage protoimport ()// ConnectionID represents CONNECTION-ID attribute.//// The CONNECTION-ID attribute uniquely identifies a peer data// connection. It is a 32-bit unsigned integral value.//// RFC 6062 Section 6.2.1.type ConnectionID uint32const connectionIDSize = 4 // uint32: 4 bytes, 32 bits// AddTo adds CONNECTION-ID to message.func ( ConnectionID) ( *stun.Message) error {:= make([]byte, lifetimeSize)binary.BigEndian.PutUint32(, uint32()).Add(stun.AttrConnectionID, )return nil}// GetFrom decodes CONNECTION-ID from message.func ( *ConnectionID) ( *stun.Message) error {, := .Get(stun.AttrConnectionID)if != nil {return}if = stun.CheckSize(stun.AttrConnectionID, len(), connectionIDSize); != nil {return}_ = [connectionIDSize-1] // Asserting length*(*uint32)() = binary.BigEndian.Uint32()return nil}
![]() |
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. |