internal

package
v3.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package internal contains the implementation of tlstool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SNISplitter

func SNISplitter(input []byte, sni []byte) (output [][]byte)

SNISplitter splits input such that SNI is splitted across a bunch of different output buffers.

func Splitter3264rand

func Splitter3264rand(input []byte) (output [][]byte)

Splitter3264rand splits the specified buffer at a random offset between 32 and 64 bytes. This is the methodology used by github.com/Jigsaw-Code/outline-go-tun2socks.

func Splitter84rest

func Splitter84rest(input []byte) (output [][]byte)

Splitter84rest segments the specified buffer into three sub-buffers containing respectively 8 bytes, 4 bytes, and the rest of the buffer. This segment technique has been described by Kevin Bock during the Internet Measurements Village 2020: https://youtu.be/ksojSRFLbBM?t=1140.

func Writev

func Writev(conn net.Conn, datalist [][]byte) (int, error)

Writev writes all the vectors inside datalist using the specified conn. Returns either an error or the number of bytes sent. Note that this function skips any empty entry in datalist.

Types

type Dialer

type Dialer struct {
	model.Dialer
	Delay    time.Duration
	Splitter func([]byte) [][]byte
}

Dialer creates net.Conn instances where (1) we delay writes if a delay is configured and (2) we split outgoing buffers if there is a configured splitter function.

func NewRandomSplitterDialer

func NewRandomSplitterDialer(config DialerConfig) Dialer

NewRandomSplitterDialer creates a new dialer that splits the SNI like the fixed splitting schema used by outline. See github.com/Jigsaw-Code/outline-go-tun2socks.

func NewSNISplitterDialer

func NewSNISplitterDialer(config DialerConfig) Dialer

NewSNISplitterDialer creates a new dialer that splits outgoing messages such that the SNI should end up being splitted into different TCP segments.

func NewThriceSplitterDialer

func NewThriceSplitterDialer(config DialerConfig) Dialer

NewThriceSplitterDialer creates a new dialer that splits outgoing messages in three parts according to the circumvention technique described by Kevin Boch in the Internet Measurement Village 2020 <https://youtu.be/ksojSRFLbBM?t=1140>.

func NewVanillaDialer

func NewVanillaDialer(config DialerConfig) Dialer

NewVanillaDialer creates a new vanilla dialer that does nothing and is used to establish a baseline.

func (Dialer) DialContext

func (d Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

DialContext implements netx.Dialer.DialContext.

type DialerConfig

type DialerConfig struct {
	Dialer model.Dialer
	Delay  time.Duration
	SNI    string
}

DialerConfig contains the config for creating a dialer

type SleeperWriter

type SleeperWriter struct {
	net.Conn
	Delay time.Duration
}

SleeperWriter is a net.Conn that optionally sleeps for the specified delay before posting each write.

func (SleeperWriter) Write

func (c SleeperWriter) Write(b []byte) (int, error)

type SplitterWriter

type SplitterWriter struct {
	net.Conn
	Splitter func([]byte) [][]byte
}

SplitterWriter is a writer that splits every outgoing buffer according to the rules specified by the Splitter.

Caveat

The TLS ClientHello may be retransmitted if the server is requesting us to restart the negotiation. Therefore, it is not safe to just run the splitting once. Since this code is meant to investigate TLS blocking, that's fine.

func (SplitterWriter) Write

func (c SplitterWriter) Write(b []byte) (int, error)

Write implements net.Conn.Write

Jump to

Keyboard shortcuts

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