Source File
message_hello_verify_request.go
Belonging Package
github.com/pion/dtls/v2/pkg/protocol/handshake
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage handshakeimport ()// MessageHelloVerifyRequest is as follows://// struct {// ProtocolVersion server_version;// opaque cookie<0..2^8-1>;// } HelloVerifyRequest;//// The HelloVerifyRequest message type is hello_verify_request(3).//// When the client sends its ClientHello message to the server, the server// MAY respond with a HelloVerifyRequest message. This message contains// a stateless cookie generated using the technique of [PHOTURIS]. The// client MUST retransmit the ClientHello with the cookie added.//// https://tools.ietf.org/html/rfc6347#section-4.2.1type MessageHelloVerifyRequest struct {Version protocol.VersionCookie []byte}// Type returns the Handshake Typefunc ( MessageHelloVerifyRequest) () Type {return TypeHelloVerifyRequest}// Marshal encodes the Handshakefunc ( *MessageHelloVerifyRequest) () ([]byte, error) {if len(.Cookie) > 255 {return nil, errCookieTooLong}:= make([]byte, 3+len(.Cookie))[0] = .Version.Major[1] = .Version.Minor[2] = byte(len(.Cookie))copy([3:], .Cookie)return , nil}// Unmarshal populates the message from encoded datafunc ( *MessageHelloVerifyRequest) ( []byte) error {if len() < 3 {return errBufferTooSmall}.Version.Major = [0].Version.Minor = [1]:= int([2])if len() < +3 {return errBufferTooSmall}.Cookie = make([]byte, )copy(.Cookie, [3:3+])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. |