Documentation
¶
Overview ¶
Package extension provides TLS extension framing and payload codecs.
Index ¶
- Variables
- func ALPNProtocolSelection(supportedProtocols, peerSupportedProtocols []string) (string, error)
- func MarshalList(values []Value) ([]byte, error)
- func MarshalListSize(values []Value) int
- func MarshalListTo(out []byte, values []Value) (int, error)
- func MarshalRawList(values []Raw) ([]byte, error)
- type ALPNOffer
- type ALPNSelection
- type CertificateSignatureAlgorithms
- type ConnectionID
- type PayloadUnmarshaller
- type PreparedList
- type Raw
- type ReturnRoutabilityCheck
- type SRTPOffer
- type SRTPProtectionProfile
- type SRTPSelection
- type ServerNameAck
- type ServerNameOffer
- type SignatureAlgorithms
- type SupportedGroups
- type Type
- type Value
Constants ¶
This section is empty.
Variables ¶
var ErrALPNInvalidFormat = dtlserrors.ErrALPNInvalidFormat
ErrALPNInvalidFormat is raised when the ALPN format is invalid.
Functions ¶
func ALPNProtocolSelection ¶
ALPNProtocolSelection negotiates a shared protocol according to #3.2 of rfc7301.
func MarshalList ¶
MarshalList frames extension payloads as a uint16-length-prefixed list.
func MarshalListSize ¶
MarshalListSize returns the size of a framed extension list without serializing extension payloads.
func MarshalListTo ¶
MarshalListTo frames extension payloads into out without retaining another encoded copy of the list.
func MarshalRawList ¶
MarshalRawList frames raw extensions without decoding their payloads.
Types ¶
type ALPNOffer ¶
type ALPNOffer struct {
Protocols []string
}
ALPNOffer is the ClientHello application_layer_protocol_negotiation payload.
func (ALPNOffer) ExtensionType ¶
func (ALPNOffer) MarshalData ¶
func (ALPNOffer) MarshalSize ¶
func (*ALPNOffer) UnmarshalData ¶
type ALPNSelection ¶
type ALPNSelection struct {
Protocol string
}
ALPNSelection is the server's single selected ALPN protocol.
func (ALPNSelection) ExtensionType ¶
func (ALPNSelection) ExtensionType() Type
func (ALPNSelection) MarshalData ¶
func (a ALPNSelection) MarshalData() ([]byte, error)
func (ALPNSelection) MarshalSize ¶
func (a ALPNSelection) MarshalSize() int
func (*ALPNSelection) UnmarshalData ¶
func (a *ALPNSelection) UnmarshalData(data []byte) error
type CertificateSignatureAlgorithms ¶
type CertificateSignatureAlgorithms struct {
Schemes []uint16
}
CertificateSignatureAlgorithms is the signature_algorithms_cert payload.
func (CertificateSignatureAlgorithms) ExtensionType ¶
func (CertificateSignatureAlgorithms) ExtensionType() Type
func (CertificateSignatureAlgorithms) MarshalData ¶
func (s CertificateSignatureAlgorithms) MarshalData() ([]byte, error)
func (CertificateSignatureAlgorithms) MarshalSize ¶
func (s CertificateSignatureAlgorithms) MarshalSize() int
func (*CertificateSignatureAlgorithms) UnmarshalData ¶
func (s *CertificateSignatureAlgorithms) UnmarshalData(data []byte) error
type ConnectionID ¶
type ConnectionID struct {
// A zero-length connection ID indicates for a client or server that
// negotiated connection IDs from the peer will be sent but there is no need
// to respond with one
CID []byte // variable length
}
ConnectionID is a DTLS extension that provides an alternative to IP address and port for session association.
https://tools.ietf.org/html/rfc9146
func (ConnectionID) ExtensionType ¶
func (c ConnectionID) ExtensionType() Type
ExtensionType returns the IANA extension type for the payload-oriented API.
func (ConnectionID) MarshalData ¶
func (c ConnectionID) MarshalData() ([]byte, error)
MarshalData encodes extension_data without the extension header.
func (ConnectionID) MarshalSize ¶
func (c ConnectionID) MarshalSize() int
MarshalSize returns the encoded payload size without serializing it.
func (*ConnectionID) UnmarshalData ¶
func (c *ConnectionID) UnmarshalData(data []byte) error
UnmarshalData decodes extension_data without the extension header.
type PayloadUnmarshaller ¶
PayloadUnmarshaller decodes extension_data without the extension header.
type PreparedList ¶
type PreparedList struct {
// contains filtered or unexported fields
}
PreparedList contains validated extension payloads ready to be framed.
func PrepareList ¶
func PrepareList(values []Value) (PreparedList, error)
PrepareList serializes and validates extension payloads without allocating the final list.
func (PreparedList) MarshalSize ¶
func (p PreparedList) MarshalSize() int
MarshalSize returns the exact size of the prepared framed extension list.
type Raw ¶
Raw is a lossless representation of an extension whose payload has not been decoded. Data does not include the type or length fields.
func ParseList ¶
ParseList parses a complete uint16-length-prefixed extension list. It validates framing only and preserves unknown extensions, order, and duplicates for contextual processing by the caller.
func (Raw) ExtensionType ¶
ExtensionType returns the extension type.
func (Raw) MarshalData ¶
MarshalData returns a copy of the undecoded payload.
func (Raw) MarshalSize ¶
MarshalSize returns the encoded payload size without serializing it.
func (*Raw) UnmarshalData ¶
UnmarshalData replaces the undecoded payload with a copy of data.
type ReturnRoutabilityCheck ¶
type ReturnRoutabilityCheck struct{}
ReturnRoutabilityCheck negotiates the RFC 9853 RRC subprotocol.
func (ReturnRoutabilityCheck) ExtensionType ¶
func (ReturnRoutabilityCheck) ExtensionType() Type
ExtensionType returns the IANA extension type for RRC.
func (ReturnRoutabilityCheck) MarshalData ¶
func (ReturnRoutabilityCheck) MarshalData() ([]byte, error)
MarshalData returns the empty RRC extension_data.
func (ReturnRoutabilityCheck) MarshalSize ¶
func (ReturnRoutabilityCheck) MarshalSize() int
MarshalSize returns the encoded payload size.
func (*ReturnRoutabilityCheck) UnmarshalData ¶
func (*ReturnRoutabilityCheck) UnmarshalData(data []byte) error
UnmarshalData validates the empty RRC extension_data.
type SRTPOffer ¶
type SRTPOffer struct {
ProtectionProfiles []SRTPProtectionProfile
MasterKeyIdentifier []byte
}
SRTPOffer is the ClientHello use_srtp payload.
func (SRTPOffer) ExtensionType ¶
func (SRTPOffer) MarshalData ¶
func (SRTPOffer) MarshalSize ¶
func (*SRTPOffer) UnmarshalData ¶
type SRTPProtectionProfile ¶
type SRTPProtectionProfile uint16
SRTPProtectionProfile defines the parameters and options that are in effect for the SRTP processing https://tools.ietf.org/html/rfc5764#section-4.1.2
const ( SRTP_AES128_CM_HMAC_SHA1_80 SRTPProtectionProfile = 0x0001 // nolint SRTP_AES128_CM_HMAC_SHA1_32 SRTPProtectionProfile = 0x0002 // nolint SRTP_AES256_CM_SHA1_80 SRTPProtectionProfile = 0x0003 // nolint SRTP_AES256_CM_SHA1_32 SRTPProtectionProfile = 0x0004 // nolint SRTP_NULL_HMAC_SHA1_80 SRTPProtectionProfile = 0x0005 // nolint SRTP_NULL_HMAC_SHA1_32 SRTPProtectionProfile = 0x0006 // nolint SRTP_AEAD_AES_128_GCM SRTPProtectionProfile = 0x0007 // nolint SRTP_AEAD_AES_256_GCM SRTPProtectionProfile = 0x0008 // nolint )
type SRTPSelection ¶
type SRTPSelection struct {
ProtectionProfile SRTPProtectionProfile
MasterKeyIdentifier []byte
}
SRTPSelection is the server's single selected SRTP profile.
func (SRTPSelection) ExtensionType ¶
func (SRTPSelection) ExtensionType() Type
func (SRTPSelection) MarshalData ¶
func (s SRTPSelection) MarshalData() ([]byte, error)
func (SRTPSelection) MarshalSize ¶
func (s SRTPSelection) MarshalSize() int
func (*SRTPSelection) UnmarshalData ¶
func (s *SRTPSelection) UnmarshalData(data []byte) error
type ServerNameAck ¶
type ServerNameAck struct{}
ServerNameAck is the empty server acknowledgement payload.
func (ServerNameAck) ExtensionType ¶
func (ServerNameAck) ExtensionType() Type
func (ServerNameAck) MarshalData ¶
func (ServerNameAck) MarshalData() ([]byte, error)
func (ServerNameAck) MarshalSize ¶
func (ServerNameAck) MarshalSize() int
func (*ServerNameAck) UnmarshalData ¶
func (*ServerNameAck) UnmarshalData(data []byte) error
type ServerNameOffer ¶
type ServerNameOffer struct {
ServerName string
}
ServerNameOffer is the ClientHello server_name payload.
func (ServerNameOffer) ExtensionType ¶
func (ServerNameOffer) ExtensionType() Type
func (ServerNameOffer) MarshalData ¶
func (s ServerNameOffer) MarshalData() ([]byte, error)
func (ServerNameOffer) MarshalSize ¶
func (s ServerNameOffer) MarshalSize() int
func (*ServerNameOffer) UnmarshalData ¶
func (s *ServerNameOffer) UnmarshalData(data []byte) error
type SignatureAlgorithms ¶
type SignatureAlgorithms struct {
Schemes []uint16
}
SignatureAlgorithms is the signature_algorithms payload. Scheme values are kept as wire identifiers so unknown values are not discarded by framing.
func (SignatureAlgorithms) ExtensionType ¶
func (SignatureAlgorithms) ExtensionType() Type
func (SignatureAlgorithms) MarshalData ¶
func (s SignatureAlgorithms) MarshalData() ([]byte, error)
func (SignatureAlgorithms) MarshalSize ¶
func (s SignatureAlgorithms) MarshalSize() int
func (*SignatureAlgorithms) UnmarshalData ¶
func (s *SignatureAlgorithms) UnmarshalData(data []byte) error
type SupportedGroups ¶
SupportedGroups is the supported_groups payload.
func (SupportedGroups) ExtensionType ¶
func (SupportedGroups) ExtensionType() Type
func (SupportedGroups) MarshalData ¶
func (s SupportedGroups) MarshalData() ([]byte, error)
func (SupportedGroups) MarshalSize ¶
func (s SupportedGroups) MarshalSize() int
func (*SupportedGroups) UnmarshalData ¶
func (s *SupportedGroups) UnmarshalData(data []byte) error
type Type ¶
type Type uint16
Type is the two-byte value assigned to a TLS extension by IANA.
const ( TypeServerName Type = 0 TypeSupportedGroups Type = 10 TypeSupportedPointFormats Type = 11 TypeSignatureAlgorithms Type = 13 TypeUseSRTP Type = 14 TypeALPN Type = 16 TypePadding Type = 21 TypeExtendedMasterSecret Type = 23 TypeEarlyData Type = 42 TypeSupportedVersions Type = 43 TypeCookie Type = 44 TypePSKKeyExchangeModes Type = 45 TypeCertificateAuthorities Type = 47 TypeOIDFilters Type = 48 TypePostHandshakeAuth Type = 49 TypeSignatureAlgorithmsCert Type = 50 TypeConnectionID Type = 54 TypeReturnRoutabilityCheck Type = 61 TypeECHOuterExtensions Type = 64768 TypeEncryptedClientHello Type = 65037 TypeRenegotiationInfo Type = 65281 )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dtls12 implements extension payloads specific to DTLS 1.2.
|
Package dtls12 implements extension payloads specific to DTLS 1.2. |
|
Package dtls13 implements extension payloads specific to DTLS 1.3.
|
Package dtls13 implements extension payloads specific to DTLS 1.3. |