Documentation ¶
Overview ¶
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
- type Extension
- type RenegotiationInfo
- type SRTPProtectionProfile
- type ServerName
- type SupportedEllipticCurves
- type SupportedPointFormats
- type SupportedSignatureAlgorithms
- type TypeValue
- type UseExtendedMasterSecret
- type UseSRTP
Constants ¶
This section is empty.
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 ¶ added in v2.1.1
ALPNProtocolSelection negotiates a shared protocol according to #3.2 of rfc7301
Types ¶
type ALPN ¶ added in v2.1.1
type ALPN struct {
ProtocolNameList []string
}
ALPN is a TLS extension for application-layer protocol negotiation within the TLS handshake.
type Extension ¶
type Extension interface { Marshal() ([]byte, error) Unmarshal(data []byte) error TypeValue() TypeValue }
Extension represents a single TLS extension
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_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 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
}
UseSRTP allows a Client/Server to negotiate what SRTPProtectionProfiles they both support