Documentation
¶
Index ¶
- Constants
- func CheckMagic(conn net.Conn) (out net.Conn, isV2 bool, err error)
- func HashCryptoTranscript(clientHelloPayload, serverHelloPayload []byte) []byte
- func IsSupportedAEADAlgorithm(algorithm string) bool
- func PreferredAEADAlgorithms() []string
- func SelectAEADAlgorithm(clientAlgorithms []string) (string, bool)
- func Supports(list []string, value string) bool
- func ValidateClientHello(h ClientHello) error
- func ValidateCryptoCapabilities(c CryptoCapabilities) error
- func ValidateServerHelloForClient(clientHello ClientHello, serverHello ServerHello) error
- func WriteMagic(w io.Writer) error
- func WriteMagicIfV2(w io.Writer, wireProtocol string) error
- type BootstrapInfo
- type ClientCapabilities
- type ClientHello
- type Conn
- type CryptoCapabilities
- type CryptoContext
- type CryptoSelection
- type Frame
- type MessageCapabilities
- type MessageSelection
- type ServerHello
- type ServerSelection
Constants ¶
View Source
const ( AEADAlgorithmAES256GCM = "aes-256-gcm" AEADAlgorithmXChaCha20Poly1305 = "xchacha20-poly1305" CryptoRandomSize = 32 )
View Source
const ( ProtocolV1 = "v1" ProtocolV2 = "v2" WireVersionV2 = 2 FrameTypeClientHello uint16 = 1 FrameTypeServerHello uint16 = 2 FrameTypeMessage uint16 = 16 MessageCodecJSON = "json" DefaultMaxFramePayloadSize = 64 * 1024 MagicV2 = "FRP\x00\x02\r\n" )
Variables ¶
This section is empty.
Functions ¶
func HashCryptoTranscript ¶
func PreferredAEADAlgorithms ¶
func PreferredAEADAlgorithms() []string
func SelectAEADAlgorithm ¶
func ValidateClientHello ¶
func ValidateClientHello(h ClientHello) error
func ValidateCryptoCapabilities ¶
func ValidateCryptoCapabilities(c CryptoCapabilities) error
func ValidateServerHelloForClient ¶
func ValidateServerHelloForClient(clientHello ClientHello, serverHello ServerHello) error
func WriteMagic ¶
Types ¶
type BootstrapInfo ¶
type ClientCapabilities ¶
type ClientCapabilities struct {
Message MessageCapabilities `json:"message,omitempty"`
Crypto CryptoCapabilities `json:"crypto,omitempty"`
}
type ClientHello ¶
type ClientHello struct {
Bootstrap BootstrapInfo `json:"bootstrap,omitempty"`
Capabilities ClientCapabilities `json:"capabilities,omitempty"`
}
func NewClientHello ¶
func NewClientHello(bootstrap BootstrapInfo) (ClientHello, error)
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func NewConn ¶
func NewConn(rw io.ReadWriter) *Conn
func (*Conn) WriteFrame ¶
type CryptoCapabilities ¶
type CryptoContext ¶
func NewClientCryptoContext ¶
func NewClientCryptoContext(clientHelloPayload, serverHelloPayload []byte) (*CryptoContext, error)
func NewCryptoContext ¶
func NewCryptoContext(algorithm string, clientHelloPayload, serverHelloPayload []byte) *CryptoContext
type CryptoSelection ¶
type MessageCapabilities ¶
type MessageCapabilities struct {
Codecs []string `json:"codecs,omitempty"`
}
type MessageSelection ¶
type MessageSelection struct {
Codec string `json:"codec,omitempty"`
}
type ServerHello ¶
type ServerHello struct {
Selected ServerSelection `json:"selected,omitempty"`
Error string `json:"error,omitempty"`
}
func DefaultServerHello ¶
func DefaultServerHello() ServerHello
func NewServerHello ¶
func NewServerHello(clientHello ClientHello) (ServerHello, error)
type ServerSelection ¶
type ServerSelection struct {
Message MessageSelection `json:"message,omitempty"`
Crypto CryptoSelection `json:"crypto,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.