Source File
inner_plaintext.go
Belonging Package
github.com/pion/dtls/v3/pkg/protocol/recordlayer
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage recordlayerimport ()// InnerPlaintext implements DTLSInnerPlaintext//// https://datatracker.ietf.org/doc/html/rfc9146#name-record-layer-extensionstype InnerPlaintext struct {Content []byteRealType protocol.ContentTypeZeros uint}// Marshal encodes a DTLS InnerPlaintext to binary.func ( *InnerPlaintext) () ([]byte, error) {var cryptobyte.Builder.AddBytes(.Content).AddUint8(uint8(.RealType)).AddBytes(make([]byte, .Zeros))return .Bytes()}// Unmarshal populates a DTLS InnerPlaintext from binary.func ( *InnerPlaintext) ( []byte) error {// Process in reverse:= len() - 1for >= 0 {if [] != 0 {.Zeros = uint(len() - 1 - ) //nolint:gosec // G115break}--}if == 0 {return errBufferTooSmall}.RealType = protocol.ContentType([]).Content = append([]byte{}, [:]...)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. |