tlstypes

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version10Bytes = []byte{0x03, 0x01}
	Version11Bytes = []byte{0x03, 0x02}
	Version12Bytes = []byte{0x03, 0x03}
	Version13Bytes = []byte{0x03, 0x04}

	CipherSuiteType_TLS_AES_128_GCM_SHA256_Bytes       = []byte{0x13, 0x01} // nolint: stylecheck,golint
	CipherSuiteType_TLS_AES_256_GCM_SHA384_Bytes       = []byte{0x13, 0x02} // nolint: stylecheck,golint
	CipherSuiteType_TLS_CHACHA20_POLY1305_SHA256_Bytes = []byte{0x13, 0x03} // nolint: stylecheck,golint
)

Functions

This section is empty.

Types

type Byter

type Byter interface {
	WriteBytes(io.Writer)
	Len() int
}

type CipherSuiteType

type CipherSuiteType uint8
const (
	CipherSuiteType_TLS_AES_128_GCM_SHA256       CipherSuiteType = iota // nolint: stylecheck,golint
	CipherSuiteType_TLS_AES_256_GCM_SHA384                              // nolint: stylecheck,golint
	CipherSuiteType_TLS_CHACHA20_POLY1305_SHA256                        // nolint: stylecheck,golint
)

func (CipherSuiteType) Bytes

func (c CipherSuiteType) Bytes() []byte

type ClientHello

type ClientHello struct {
	Handshake
}

func ParseClientHello

func ParseClientHello(raw []byte) (*ClientHello, error)

func (ClientHello) Digest

func (c ClientHello) Digest() []byte

type Handshake

type Handshake struct {
	Type      HandshakeType
	Version   Version
	Random    [32]byte
	SessionID []byte
	Tail      Byter
}

func (*Handshake) Len

func (h *Handshake) Len() int

func (*Handshake) WriteBytes

func (h *Handshake) WriteBytes(writer io.Writer)

type HandshakeType

type HandshakeType uint8
const (
	HandshakeTypeClient HandshakeType = 0x01
	HandshakeTypeServer HandshakeType = 0x02
)

type RawBytes

type RawBytes []byte

func (RawBytes) Len

func (r RawBytes) Len() int

func (RawBytes) WriteBytes

func (r RawBytes) WriteBytes(writer io.Writer)

type Record

type Record struct {
	Type    RecordType
	Version Version
	Data    Byter
}

func MakeRecords

func MakeRecords(raw []byte) (arr []Record)

func ReadRecord

func ReadRecord(reader io.Reader) (Record, error)

func (Record) Len

func (r Record) Len() int

func (Record) WriteBytes

func (r Record) WriteBytes(writer io.Writer)

type RecordType

type RecordType uint8
const (
	RecordTypeHandshake        RecordType = 0x16
	RecordTypeApplicationData  RecordType = 0x17
	RecordTypeChangeCipherSpec RecordType = 0x14
)

type ServerHello

type ServerHello struct {
	Handshake
	// contains filtered or unexported fields
}

func NewServerHello

func NewServerHello(clientHello *ClientHello) *ServerHello

func (ServerHello) WelcomePacket

func (s ServerHello) WelcomePacket() []byte

type Version

type Version uint8
const (
	VersionUnknown Version = iota
	Version10
	Version11
	Version12
	Version13
)

func (Version) Bytes

func (v Version) Bytes() []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL