package extension
import "github.com/pion/dtls/v3/pkg/protocol/extension"
Package extension implements the extension values in the ClientHello/ServerHello
Index ¶
- Variables
- func ALPNProtocolSelection(supportedProtocols, peerSupportedProtocols []string) (string, error)
- func Marshal(e []Extension) ([]byte, error)
- type ALPN
- func (a *ALPN) Marshal() ([]byte, error)
- func (a ALPN) TypeValue() TypeValue
- func (a *ALPN) Unmarshal(data []byte) error
- type ConnectionID
- func (c *ConnectionID) Marshal() ([]byte, error)
- func (c ConnectionID) TypeValue() TypeValue
- func (c *ConnectionID) Unmarshal(data []byte) error
- type Extension
- type RenegotiationInfo
- func (r *RenegotiationInfo) Marshal() ([]byte, error)
- func (r RenegotiationInfo) TypeValue() TypeValue
- func (r *RenegotiationInfo) Unmarshal(data []byte) error
- type SRTPProtectionProfile
- type ServerName
- func (s *ServerName) Marshal() ([]byte, error)
- func (s ServerName) TypeValue() TypeValue
- func (s *ServerName) Unmarshal(data []byte) error
- type SupportedEllipticCurves
- func (s *SupportedEllipticCurves) Marshal() ([]byte, error)
- func (s SupportedEllipticCurves) TypeValue() TypeValue
- func (s *SupportedEllipticCurves) Unmarshal(data []byte) error
- type SupportedPointFormats
- func (s *SupportedPointFormats) Marshal() ([]byte, error)
- func (s SupportedPointFormats) TypeValue() TypeValue
- func (s *SupportedPointFormats) Unmarshal(data []byte) error
- type SupportedSignatureAlgorithms
- func (s *SupportedSignatureAlgorithms) Marshal() ([]byte, error)
- func (s SupportedSignatureAlgorithms) TypeValue() TypeValue
- func (s *SupportedSignatureAlgorithms) Unmarshal(data []byte) error
- type TypeValue
- type UseExtendedMasterSecret
- func (u *UseExtendedMasterSecret) Marshal() ([]byte, error)
- func (u UseExtendedMasterSecret) TypeValue() TypeValue
- func (u *UseExtendedMasterSecret) Unmarshal(data []byte) error
- type UseSRTP
Variables ¶
var ( // ErrALPNInvalidFormat is raised when the ALPN format is invalid ErrALPNInvalidFormat = &protocol.FatalError{Err: errors.New("invalid alpn format")} //nolint:goerr113 )
Functions ¶
func ALPNProtocolSelection ¶
ALPNProtocolSelection negotiates a shared protocol according to #3.2 of rfc7301
func Marshal ¶
Marshal many extensions at once
Types ¶
type ALPN ¶
type ALPN struct { ProtocolNameList []string }
ALPN is a TLS extension for application-layer protocol negotiation within the TLS handshake.
https://tools.ietf.org/html/rfc7301
func (*ALPN) Marshal ¶
Marshal encodes the extension
func (ALPN) TypeValue ¶
TypeValue returns the extension TypeValue
func (*ALPN) Unmarshal ¶
Unmarshal populates the extension from encoded data
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) Marshal ¶
func (c *ConnectionID) Marshal() ([]byte, error)
Marshal encodes the extension
func (ConnectionID) TypeValue ¶
func (c ConnectionID) TypeValue() TypeValue
TypeValue returns the extension TypeValue
func (*ConnectionID) Unmarshal ¶
func (c *ConnectionID) Unmarshal(data []byte) error
Unmarshal populates the extension from encoded data
type Extension ¶
type Extension interface { Marshal() ([]byte, error) Unmarshal(data []byte) error TypeValue() TypeValue }
Extension represents a single TLS extension
func Unmarshal ¶
Unmarshal many extensions at once
type RenegotiationInfo ¶
type RenegotiationInfo struct { RenegotiatedConnection uint8 }
RenegotiationInfo allows a Client/Server to communicate their renegotation support
https://tools.ietf.org/html/rfc5746
func (*RenegotiationInfo) Marshal ¶
func (r *RenegotiationInfo) Marshal() ([]byte, error)
Marshal encodes the extension
func (RenegotiationInfo) TypeValue ¶
func (r RenegotiationInfo) TypeValue() TypeValue
TypeValue returns the extension TypeValue
func (*RenegotiationInfo) Unmarshal ¶
func (r *RenegotiationInfo) Unmarshal(data []byte) error
Unmarshal populates the extension from encoded data
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 ServerName ¶
type ServerName struct { ServerName string }
ServerName allows the client to inform the server the specific name it wishes to contact. Useful if multiple DNS names resolve to one IP
https://tools.ietf.org/html/rfc6066#section-3
func (*ServerName) Marshal ¶
func (s *ServerName) Marshal() ([]byte, error)
Marshal encodes the extension
func (ServerName) TypeValue ¶
func (s ServerName) TypeValue() TypeValue
TypeValue returns the extension TypeValue
func (*ServerName) Unmarshal ¶
func (s *ServerName) Unmarshal(data []byte) error
Unmarshal populates the extension from encoded data
type SupportedEllipticCurves ¶
SupportedEllipticCurves allows a Client/Server to communicate what curves they both support
https://tools.ietf.org/html/rfc8422#section-5.1.1
func (*SupportedEllipticCurves) Marshal ¶
func (s *SupportedEllipticCurves) Marshal() ([]byte, error)
Marshal encodes the extension
func (SupportedEllipticCurves) TypeValue ¶
func (s SupportedEllipticCurves) TypeValue() TypeValue
TypeValue returns the extension TypeValue
func (*SupportedEllipticCurves) Unmarshal ¶
func (s *SupportedEllipticCurves) Unmarshal(data []byte) error
Unmarshal populates the extension from encoded data
type SupportedPointFormats ¶
type SupportedPointFormats struct { PointFormats []elliptic.CurvePointFormat }
SupportedPointFormats allows a Client/Server to negotiate the EllipticCurvePointFormats
https://tools.ietf.org/html/rfc4492#section-5.1.2
func (*SupportedPointFormats) Marshal ¶
func (s *SupportedPointFormats) Marshal() ([]byte, error)
Marshal encodes the extension
func (SupportedPointFormats) TypeValue ¶
func (s SupportedPointFormats) TypeValue() TypeValue
TypeValue returns the extension TypeValue
func (*SupportedPointFormats) Unmarshal ¶
func (s *SupportedPointFormats) Unmarshal(data []byte) error
Unmarshal populates the extension from encoded data
type SupportedSignatureAlgorithms ¶
type SupportedSignatureAlgorithms struct { SignatureHashAlgorithms []signaturehash.Algorithm }
SupportedSignatureAlgorithms allows a Client/Server to negotiate what SignatureHash Algorithms they both support
https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1
func (*SupportedSignatureAlgorithms) Marshal ¶
func (s *SupportedSignatureAlgorithms) Marshal() ([]byte, error)
Marshal encodes the extension
func (SupportedSignatureAlgorithms) TypeValue ¶
func (s SupportedSignatureAlgorithms) TypeValue() TypeValue
TypeValue returns the extension TypeValue
func (*SupportedSignatureAlgorithms) Unmarshal ¶
func (s *SupportedSignatureAlgorithms) Unmarshal(data []byte) error
Unmarshal populates the extension from encoded data
type TypeValue ¶
type TypeValue uint16
TypeValue is the 2 byte value for a TLS Extension as registered in the IANA
https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml
const ( ServerNameTypeValue TypeValue = 0 SupportedEllipticCurvesTypeValue TypeValue = 10 SupportedPointFormatsTypeValue TypeValue = 11 SupportedSignatureAlgorithmsTypeValue TypeValue = 13 UseSRTPTypeValue TypeValue = 14 ALPNTypeValue TypeValue = 16 UseExtendedMasterSecretTypeValue TypeValue = 23 ConnectionIDTypeValue TypeValue = 54 RenegotiationInfoTypeValue TypeValue = 65281 )
TypeValue constants
type UseExtendedMasterSecret ¶
type UseExtendedMasterSecret struct { Supported bool }
UseExtendedMasterSecret defines a TLS extension that contextually binds the master secret to a log of the full handshake that computes it, thus preventing MITM attacks.
func (*UseExtendedMasterSecret) Marshal ¶
func (u *UseExtendedMasterSecret) Marshal() ([]byte, error)
Marshal encodes the extension
func (UseExtendedMasterSecret) TypeValue ¶
func (u UseExtendedMasterSecret) TypeValue() TypeValue
TypeValue returns the extension TypeValue
func (*UseExtendedMasterSecret) Unmarshal ¶
func (u *UseExtendedMasterSecret) Unmarshal(data []byte) error
Unmarshal populates the extension from encoded data
type UseSRTP ¶
type UseSRTP struct { ProtectionProfiles []SRTPProtectionProfile MasterKeyIdentifier []byte }
UseSRTP allows a Client/Server to negotiate what SRTPProtectionProfiles they both support
https://tools.ietf.org/html/rfc8422
func (*UseSRTP) Marshal ¶
Marshal encodes the extension
func (UseSRTP) TypeValue ¶
TypeValue returns the extension TypeValue
func (*UseSRTP) Unmarshal ¶
Unmarshal populates the extension from encoded data
Source Files ¶
alpn.go connection_id.go errors.go extension.go renegotiation_info.go server_name.go srtp_protection_profile.go supported_elliptic_curves.go supported_point_formats.go supported_signature_algorithms.go use_master_secret.go use_srtp.go
- Version
- v3.0.4 (latest)
- Published
- Nov 4, 2024
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 1 week ago –
Tools for package owners.