obfs4

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxHandshakeLength = 8192

	ClientMinPadLength = (ServerMinHandshakeLength + InlineSeedFrameLength) -
		ClientMinHandshakeLength
	ClientMaxPadLength       = MaxHandshakeLength - ClientMinHandshakeLength
	ClientMinHandshakeLength = ntor.RepresentativeLength + MarkLength + MacLength

	ServerMinPadLength = 0
	ServerMaxPadLength = MaxHandshakeLength - (ServerMinHandshakeLength +
		InlineSeedFrameLength)
	ServerMinHandshakeLength = ntor.RepresentativeLength + ntor.AuthLength +
		MarkLength + MacLength

	MarkLength = sha256.Size / 2
	MacLength  = sha256.Size / 2

	PacketOverhead          = 2 + 1
	SeedPacketPayloadLength = drbg.SeedLength

	InlineSeedFrameLength = framing.FrameOverhead + PacketOverhead + SeedPacketPayloadLength
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientTransport

type ClientTransport struct {
	// Parameters are fields that will be shared with the station in the registration. This object
	// should be considered immutable after initialization otherwise changes will persist across
	// subsequent dials.
	Parameters *pb.GenericTransportParams
	// contains filtered or unexported fields
}

ClientTransport implements the client side transport interface for the Min transport. The significant difference is that there is an instance of this structure per client session, where the station side Transport struct has one instance to be re-used for all sessions.

func (*ClientTransport) GetDstPort

func (t *ClientTransport) GetDstPort(seed []byte) (uint16, error)

GetDstPort returns the destination port that the client should open the phantom connection to

func (*ClientTransport) GetParams

func (t *ClientTransport) GetParams() (proto.Message, error)

GetParams returns a generic protobuf with any parameters from both the registration and the transport.

func (*ClientTransport) ID

ID provides an identifier that will be sent to the conjure station during the registration so that the station knows what transport to expect connecting to the chosen phantom.

func (*ClientTransport) Name

func (*ClientTransport) Name() string

Name returns a string identifier for the Transport for logging

func (ClientTransport) ParseParams

func (t ClientTransport) ParseParams(data *anypb.Any) (any, error)

ParseParams gives the specific transport an option to parse a generic object into parameters provided by the station in the registration response during registration.

func (*ClientTransport) Prepare added in v0.6.0

func (t *ClientTransport) Prepare(ctx context.Context, dialer func(ctx context.Context, network, laddr, raddr string) (net.Conn, error)) error

func (*ClientTransport) PrepareKeys

func (t *ClientTransport) PrepareKeys(pubkey [32]byte, sharedSecret []byte, dRand io.Reader) error

func (*ClientTransport) SetParams

func (t *ClientTransport) SetParams(p any) error

SetParams allows the caller to set parameters associated with the transport, returning an error if the provided generic message is not compatible.

func (*ClientTransport) SetSessionParams added in v0.7.5

func (t *ClientTransport) SetSessionParams(incoming *anypb.Any, unchecked ...bool) error

SetSessionParams allows the session to apply updated params that are only used within an individual dial, returning an error if the provided generic message is not compatible. the variadic bool parameter is used to indicate whether the client should sanity check the params or just apply them. This is useful in cases where the registrar may provide options to the client that it is able to handle, but are outside of the clients sanity checks. (see prefix transport for an example)

func (*ClientTransport) String

func (*ClientTransport) String() string

String returns a string identifier for the Transport for logging (including string formatters)

func (ClientTransport) WrapConn

func (t ClientTransport) WrapConn(conn net.Conn) (net.Conn, error)

WrapConn creates the connection to the phantom address negotiated in the registration phase of Conjure connection establishment.

type Obfs4Keys

type Obfs4Keys struct {
	PrivateKey *ntor.PrivateKey
	PublicKey  *ntor.PublicKey
	NodeID     *ntor.NodeID
}

type Transport

type Transport struct{}

Transport implements the station Transport interface for the obfs4 transport

func (Transport) GetDstPort

func (Transport) GetDstPort(libVersion uint, seed []byte, params any) (uint16, error)

GetDstPort Given the library version, a seed, and a generic object containing parameters the transport should be able to return the destination port that a clients phantom connection will attempt to reach

func (Transport) GetIdentifier

func (Transport) GetIdentifier(r transports.Registration) string

GetIdentifier implements the station Transport interface

func (Transport) GetProto

func (Transport) GetProto() pb.IPProto

GetProto returns the next layer protocol that the transport uses. Implements the Transport interface.

func (Transport) LogPrefix

func (Transport) LogPrefix() string

LogPrefix implements the station Transport interface

func (Transport) Name

func (Transport) Name() string

Name implements the station Transport interface

func (Transport) ParamStrings

func (t Transport) ParamStrings(p any) []string

ParamStrings returns an array of tag string that will be added to tunStats when a proxy session is closed. For now, no params of interest.

func (Transport) ParseParams

func (Transport) ParseParams(libVersion uint, data *anypb.Any) (any, error)

ParseParams gives the specific transport an option to parse a generic object into parameters provided by the client during registration.

func (Transport) WrapConnection

func (Transport) WrapConnection(data *bytes.Buffer, c net.Conn, phantom net.IP, regManager transports.RegManager) (transports.Registration, net.Conn, error)

WrapConnection implements the station Transport interface

Jump to

Keyboard shortcuts

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