dtls

package
v0.6.7-dev Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfig added in v0.6.6

type ClientConfig struct {
	// STUNServer is the address of the stun server to use
	STUNServer string

	// DisableIRWorkaround disables sending an empty packet to workaround DTLS blocking in IR
	//
	// In Iran, blocking seems to happen by matching the first packet in a "flow" against DTLS packet format and blocking if it matches.
	// If the first packet is anything else packets are permitted. UDP dst port does not seem to change this.
	DisableIRWorkaround bool
}

type ClientTransport

type ClientTransport struct {
	// Parameters are fields that will be shared with the station in the registration
	Parameters *pb.DTLSTransportParams
	// contains filtered or unexported fields
}

ClientTransport implements the client side transport interface for the DTLS 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) DisableRegDelay

func (*ClientTransport) DisableRegDelay() bool

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 (ClientTransport) ParseParams(*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

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

Prepare lets the transport use the dialer to prepare. This is called before GetParams to let the transport prepare stuff such as nat traversal.

func (*ClientTransport) PrepareKeys

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

PrepareKeys provides an opportunity for the transport to integrate the station public key as well as bytes from the deterministic random generator associated with the registration that this ClientTransport is attached t

func (*ClientTransport) SetParams

func (t *ClientTransport) SetParams(p any, unchecked ...bool) 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) String

func (*ClientTransport) String() string

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

func (*ClientTransport) WrapDial

func (t *ClientTransport) WrapDial(dialer dialFunc) (dialFunc, error)

type Transport

type Transport struct {
	DNAT interfaces.DNAT
	// contains filtered or unexported fields
}

func NewTransport

func NewTransport(logAuthFail func(*net.IP), logOtherFail func(*net.IP), logDialSuccess func(*net.IP), logListenSuccess func(*net.IP), buildDnat interfaces.DnatBuilder) (*Transport, error)

NewTransport creates a new dtls transport

func (*Transport) Connect

func (t *Transport) Connect(ctx context.Context, reg transports.Registration) (net.Conn, error)

Connect takes a registraion and returns a dtls Conn connected to the client

func (Transport) GetDstPort

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

func (Transport) GetIdentifier

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

GetIdentifier returns an identifier unique a registration

func (Transport) GetProto

func (Transport) GetProto() pb.IPProto

func (Transport) GetSrcPort

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

func (Transport) LogPrefix

func (Transport) LogPrefix() string

LogPrefix returns log prefix of the transport

func (Transport) Name

func (Transport) Name() string

Name returns name of the transport

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)

Jump to

Keyboard shortcuts

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