Source File
supported_point_formats.go
Belonging Package
github.com/pion/dtls/v2/pkg/protocol/extension
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage extensionimport ()const (supportedPointFormatsSize = 5)// SupportedPointFormats allows a Client/Server to negotiate// the EllipticCurvePointFormats//// https://tools.ietf.org/html/rfc4492#section-5.1.2type SupportedPointFormats struct {PointFormats []elliptic.CurvePointFormat}// TypeValue returns the extension TypeValuefunc ( SupportedPointFormats) () TypeValue {return SupportedPointFormatsTypeValue}// Marshal encodes the extensionfunc ( *SupportedPointFormats) () ([]byte, error) {:= make([]byte, supportedPointFormatsSize)binary.BigEndian.PutUint16(, uint16(.TypeValue()))binary.BigEndian.PutUint16([2:], uint16(1+(len(.PointFormats))))[4] = byte(len(.PointFormats))for , := range .PointFormats {= append(, byte())}return , nil}// Unmarshal populates the extension from encoded datafunc ( *SupportedPointFormats) ( []byte) error {if len() <= supportedPointFormatsSize {return errBufferTooSmall} else if TypeValue(binary.BigEndian.Uint16()) != .TypeValue() {return errInvalidExtensionType}:= int(binary.BigEndian.Uint16([4:]))if supportedGroupsHeaderSize+() > len() {return errLengthMismatch}for := 0; < ; ++ {:= elliptic.CurvePointFormat([supportedPointFormatsSize+])switch {case elliptic.CurvePointFormatUncompressed:.PointFormats = append(.PointFormats, )default:}}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. |