Documentation
¶
Overview ¶
Package protocol provides the DTLS wire format
Index ¶
- Variables
- func CompressionMethods() map[CompressionMethodID]*CompressionMethod
- func EncodeCompressionMethods(c []*CompressionMethod) []byte
- func IsSupportedBytes(major uint8, minor uint8) bool
- func IsSupportedVersion(v Version) bool
- func IsValidBytes(major uint8, minor uint8) bool
- func IsValidVersion(v Version) bool
- type ApplicationData
- type ChangeCipherSpec
- type CompressionMethod
- type CompressionMethodID
- type Content
- type ContentType
- type FatalError
- type HandshakeError
- type InternalError
- type TemporaryError
- type TimeoutError
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( Version1_0 = Version{Major: 0xfe, Minor: 0xff} //nolint:gochecknoglobals Version1_2 = Version{Major: 0xfe, Minor: 0xfd} //nolint:gochecknoglobals Version1_3 = Version{Major: 0xfe, Minor: 0xfc} //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.
func IsSupportedBytes ¶ added in v3.0.8
IsSupportedBytes returns true if it's supported by Pion. Only DTLS 1.2 is currently supported. DTLS 1.3 is a work in progress and is currently being implemented.
func IsSupportedVersion ¶ added in v3.0.8
IsSupportedVersion returns true if it's supported by Pion. Only DTLS 1.2 is currently supported. DTLS 1.3 is a work in progress and is currently being implemented.
func IsValidBytes ¶ added in v3.0.8
IsValidBytes returns true if the bytes represent a valid DTLS version as defined in RFC9147 below. Note that this is not the same as whether it's *supported* by Pion. Please see IsSupportedBytes() for more info.
https://tools.ietf.org/html/rfc9147#section-5.3 (see legacy_version)
func IsValidVersion ¶ added in v3.0.8
IsValidVersion returns true if the bytes represent a valid DTLS version as defined in RFC9147 below. Note that this is not the same as whether it's *supported* by Pion. Please see IsSupportedBytes() for more info. / https://tools.ietf.org/html/rfc9147#section-5.3 (see legacy_version)
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 ContentTypeConnectionID ContentType = 25 )
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.
Source Files
¶
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 |