dtls

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: 18 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

	// ListenTimeout is the duration to listen for the DTLS handshake sent by station. After this duration, the
	// client will initiate the handshake instead in case there are NAT issues preventing the station from reaching
	// the client.
	ListenTimeout *time.Duration
}

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.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(ctx context.Context, 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) 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) 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, logOtherFail, logDialSuccess, 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) 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