tlstypes

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package tlstypes is copy of tlstypes package in mtg. Added for faketls obfuscator testing purposes. Original code: https://github.com/9seconds/mtg/tree/7a6695f6c4b9026875195f5fc1b8a2e5fe77bb03/tlstypes.

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

func FromUint24

func FromUint24(number Uint24) uint32

func ReverseBytes

func ReverseBytes(data []byte) []byte

ReverseBytes is a common slice reverser.

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(secret []byte) []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(secret []byte) []byte

type Uint24

type Uint24 [3]byte

func ToUint24

func ToUint24(number uint32) Uint24

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