faketls

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RandomLen defines a size of the random digest in TLS Hellos.
	RandomLen = 32

	// ClientHelloRandomOffset is an offset in ClientHello record where
	// random digest is started.
	ClientHelloRandomOffset = 6

	// ClientHelloSessionIDOffset is an offset in ClientHello record where
	// SessionID is started.
	ClientHelloSessionIDOffset = ClientHelloRandomOffset + RandomLen

	// ClientHelloMinLen is a minimal possible length of
	// ClientHello record.
	ClientHelloMinLen = 4

	// WelcomePacketRandomOffset is an offset of random in ServerHello
	// packet (including record envelope).
	WelcomePacketRandomOffset = 11

	// HandshakeTypeClient is a value representing a client handshake.
	HandshakeTypeClient = 0x01

	// HandshakeTypeServer is a value representing a server handshake.
	HandshakeTypeServer = 0x02

	// ChangeCipherValue is a value representing a change cipher
	// specification record.
	ChangeCipherValue = 0x01

	// ExtensionSNI is a value for TLS extension 'SNI'.
	ExtensionSNI = 0x00
)

Variables

View Source
var (
	// ErrBadDigest is returned if given TLS Client Hello mismatches with a
	// derived one.
	ErrBadDigest = errors.New("bad digest")
)

Functions

func SendWelcomePacket

func SendWelcomePacket(writer io.Writer, secret []byte, clientHello ClientHello) error

Types

type ClientHello

type ClientHello struct {
	Time        time.Time
	Random      [RandomLen]byte
	SessionID   []byte
	Host        string
	CipherSuite uint16
}

func ParseClientHello

func ParseClientHello(secret, handshake []byte) (ClientHello, error)

func (ClientHello) Valid

func (c ClientHello) Valid(hostname string, tolerateTimeSkewness time.Duration) error

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*Conn) Read

func (c *Conn) Read(p []byte) (int, error)

func (*Conn) Write

func (c *Conn) Write(p []byte) (int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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