protocol

package
v2.2.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: MIT Imports: 3 Imported by: 15

Documentation

Overview

Package protocol provides the DTLS wire format

Index

Constants

This section is empty.

Variables

View Source
var (
	Version1_0 = Version{Major: 0xfe, Minor: 0xff} //nolint:gochecknoglobals
	Version1_2 = Version{Major: 0xfe, Minor: 0xfd} //nolint:gochecknoglobals
)

Version enums

Functions

func CompressionMethods

func CompressionMethods() map[CompressionMethodID]*CompressionMethod

CompressionMethods returns all supported CompressionMethods

func EncodeCompressionMethods

func EncodeCompressionMethods(c []*CompressionMethod) []byte

EncodeCompressionMethods the given compression methods

Types

type ApplicationData

type ApplicationData struct {
	Data []byte
}

ApplicationData messages are carried by the record layer and are fragmented, compressed, and encrypted based on the current connection state. The messages are treated as transparent data to the record layer. https://tools.ietf.org/html/rfc5246#section-10

func (ApplicationData) ContentType

func (a ApplicationData) ContentType() ContentType

ContentType returns the ContentType of this content

func (*ApplicationData) Marshal

func (a *ApplicationData) Marshal() ([]byte, error)

Marshal encodes the ApplicationData to binary

func (*ApplicationData) Unmarshal

func (a *ApplicationData) Unmarshal(data []byte) error

Unmarshal populates the ApplicationData from binary

type ChangeCipherSpec

type ChangeCipherSpec struct{}

ChangeCipherSpec protocol exists to signal transitions in ciphering strategies. The protocol consists of a single message, which is encrypted and compressed under the current (not the pending) connection state. The message consists of a single byte of value 1. https://tools.ietf.org/html/rfc5246#section-7.1

func (ChangeCipherSpec) ContentType

func (c ChangeCipherSpec) ContentType() ContentType

ContentType returns the ContentType of this content

func (*ChangeCipherSpec) Marshal

func (c *ChangeCipherSpec) Marshal() ([]byte, error)

Marshal encodes the ChangeCipherSpec to binary

func (*ChangeCipherSpec) Unmarshal

func (c *ChangeCipherSpec) Unmarshal(data []byte) error

Unmarshal populates the ChangeCipherSpec from binary

type CompressionMethod

type CompressionMethod struct {
	ID CompressionMethodID
}

CompressionMethod represents a TLS Compression Method

func DecodeCompressionMethods

func DecodeCompressionMethods(buf []byte) ([]*CompressionMethod, error)

DecodeCompressionMethods the given compression methods

type CompressionMethodID

type CompressionMethodID byte

CompressionMethodID is the ID for a CompressionMethod

type Content

type Content interface {
	ContentType() ContentType
	Marshal() ([]byte, error)
	Unmarshal(data []byte) error
}

Content is the top level distinguisher for a DTLS Datagram

type ContentType

type ContentType uint8

ContentType represents the IANA Registered ContentTypes

https://tools.ietf.org/html/rfc4346#section-6.2.1

const (
	ContentTypeChangeCipherSpec ContentType = 20
	ContentTypeAlert            ContentType = 21
	ContentTypeHandshake        ContentType = 22
	ContentTypeApplicationData  ContentType = 23
)

ContentType enums

type FatalError

type FatalError struct {
	Err error
}

FatalError indicates that the DTLS connection is no longer available. It is mainly caused by wrong configuration of server or client.

func (*FatalError) Error

func (e *FatalError) Error() string

func (*FatalError) Temporary

func (*FatalError) Temporary() bool

Temporary implements net.Error.Temporary()

func (*FatalError) Timeout

func (*FatalError) Timeout() bool

Timeout implements net.Error.Timeout()

func (*FatalError) Unwrap

func (e *FatalError) Unwrap() error

Unwrap implements Go1.13 error unwrapper.

type HandshakeError

type HandshakeError struct {
	Err error
}

HandshakeError indicates that the handshake failed.

func (*HandshakeError) Error

func (e *HandshakeError) Error() string

func (*HandshakeError) Temporary

func (e *HandshakeError) Temporary() bool

Temporary implements net.Error.Temporary()

func (*HandshakeError) Timeout

func (e *HandshakeError) Timeout() bool

Timeout implements net.Error.Timeout()

func (*HandshakeError) Unwrap

func (e *HandshakeError) Unwrap() error

Unwrap implements Go1.13 error unwrapper.

type InternalError

type InternalError struct {
	Err error
}

InternalError indicates and internal error caused by the implementation, and the DTLS connection is no longer available. It is mainly caused by bugs or tried to use unimplemented features.

func (*InternalError) Error

func (e *InternalError) Error() string

func (*InternalError) Temporary

func (*InternalError) Temporary() bool

Temporary implements net.Error.Temporary()

func (*InternalError) Timeout

func (*InternalError) Timeout() bool

Timeout implements net.Error.Timeout()

func (*InternalError) Unwrap

func (e *InternalError) Unwrap() error

Unwrap implements Go1.13 error unwrapper.

type TemporaryError

type TemporaryError struct {
	Err error
}

TemporaryError indicates that the DTLS connection is still available, but the request was failed temporary.

func (*TemporaryError) Error

func (e *TemporaryError) Error() string

func (*TemporaryError) Temporary

func (*TemporaryError) Temporary() bool

Temporary implements net.Error.Temporary()

func (*TemporaryError) Timeout

func (*TemporaryError) Timeout() bool

Timeout implements net.Error.Timeout()

func (*TemporaryError) Unwrap

func (e *TemporaryError) Unwrap() error

Unwrap implements Go1.13 error unwrapper.

type TimeoutError

type TimeoutError struct {
	Err error
}

TimeoutError indicates that the request was timed out.

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

func (*TimeoutError) Temporary

func (*TimeoutError) Temporary() bool

Temporary implements net.Error.Temporary()

func (*TimeoutError) Timeout

func (*TimeoutError) Timeout() bool

Timeout implements net.Error.Timeout()

func (*TimeoutError) Unwrap

func (e *TimeoutError) Unwrap() error

Unwrap implements Go1.13 error unwrapper.

type Version

type Version struct {
	Major, Minor uint8
}

Version is the minor/major value in the RecordLayer and ClientHello/ServerHello

https://tools.ietf.org/html/rfc4346#section-6.2.1

func (Version) Equal

func (v Version) Equal(x Version) bool

Equal determines if two protocol versions are equal

Directories

Path Synopsis
Package alert implements TLS alert protocol https://tools.ietf.org/html/rfc5246#section-7.2
Package alert implements TLS alert protocol https://tools.ietf.org/html/rfc5246#section-7.2
Package extension implements the extension values in the ClientHello/ServerHello
Package extension implements the extension values in the ClientHello/ServerHello
Package handshake provides the DTLS wire protocol for handshakes
Package handshake provides the DTLS wire protocol for handshakes
Package recordlayer implements the TLS Record Layer https://tools.ietf.org/html/rfc5246#section-6
Package recordlayer implements the TLS Record Layer https://tools.ietf.org/html/rfc5246#section-6

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL