crew

package
v1.6.10 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectOpType string = "connect"

ConnectOpType is the type ID for the connection operation.

View Source
const (
	// PingOpType is the type ID of the latency test operation.
	PingOpType = "ping"
)

Variables

This section is empty.

Functions

func ConnectErrors

func ConnectErrors() <-chan *terminal.Error

ConnectErrors returns errors of connect operations. It only has a small and shared buffer and may only be used for indications, not for full monitoring.

func EnableConnecting

func EnableConnecting(my *hub.Hub)

EnableConnecting enables connecting from this Hub.

func HandleSluiceRequest

func HandleSluiceRequest(connInfo *network.Connection, conn net.Conn)

HandleSluiceRequest handles a sluice request to build a tunnel.

Types

type ConnectOp

type ConnectOp struct {
	terminal.OperationBase
	// contains filtered or unexported fields
}

ConnectOp is used to connect data tunnels to servers on the Internet.

func NewConnectOp

func NewConnectOp(tunnel *Tunnel) (*ConnectOp, *terminal.Error)

NewConnectOp starts a new connect operation.

func (*ConnectOp) Ctx

func (op *ConnectOp) Ctx() context.Context

Ctx returns the operation context.

func (*ConnectOp) Deliver

func (op *ConnectOp) Deliver(msg *terminal.Msg) *terminal.Error

Deliver delivers a messages to the operation.

func (*ConnectOp) HandleStop

func (op *ConnectOp) HandleStop(err *terminal.Error) (errorToSend *terminal.Error)

HandleStop gives the operation the ability to cleanly shut down. The returned error is the error to send to the other side. Should never be called directly. Call Stop() instead.

func (*ConnectOp) Type

func (op *ConnectOp) Type() string

Type returns the type ID.

type ConnectRequest

type ConnectRequest struct {
	Domain              string            `json:"d,omitempty"`
	IP                  net.IP            `json:"ip,omitempty"`
	UsePriorityDataMsgs bool              `json:"pr,omitempty"`
	Protocol            packet.IPProtocol `json:"p,omitempty"`
	Port                uint16            `json:"po,omitempty"`
	QueueSize           uint32            `json:"qs,omitempty"`
}

ConnectRequest holds all the information necessary for a connect operation.

func (*ConnectRequest) Address

func (r *ConnectRequest) Address() string

Address returns the address of the connext request.

func (*ConnectRequest) DialNetwork

func (r *ConnectRequest) DialNetwork() string

DialNetwork returns the address of the connect request.

func (*ConnectRequest) String

func (r *ConnectRequest) String() string

type PingOp

type PingOp struct {
	terminal.OneOffOperationBase
	// contains filtered or unexported fields
}

PingOp is used to measure latency.

func NewPingOp

func NewPingOp(t terminal.Terminal) (*PingOp, *terminal.Error)

NewPingOp runs a latency test.

func (*PingOp) Deliver

func (op *PingOp) Deliver(msg *terminal.Msg) *terminal.Error

Deliver delivers a message to the operation.

func (*PingOp) HandleStop

func (op *PingOp) HandleStop(err *terminal.Error) (errorToSend *terminal.Error)

HandleStop gives the operation the ability to cleanly shut down. The returned error is the error to send to the other side. Should never be called directly. Call Stop() instead.

func (*PingOp) Type

func (op *PingOp) Type() string

Type returns the type ID.

type PingOpRequest

type PingOpRequest struct {
	Nonce []byte `json:"n,omitempty"`
}

PingOpRequest is a ping request.

type PingOpResponse

type PingOpResponse struct {
	Nonce []byte    `json:"n,omitempty"`
	Time  time.Time `json:"t,omitempty"`
}

PingOpResponse is a ping response.

type Tunnel

type Tunnel struct {
	// contains filtered or unexported fields
}

Tunnel represents the local information and endpoint of a data tunnel.

type TunnelContext

type TunnelContext struct {
	Path       []*TunnelContextHop
	PathCost   float32
	RoutingAlg string
	// contains filtered or unexported fields
}

TunnelContext holds additional information about the tunnel to be added to a connection.

func (*TunnelContext) GetExitNodeID

func (tc *TunnelContext) GetExitNodeID() string

GetExitNodeID returns the ID of the exit node. It returns an empty string in case no path exists.

func (*TunnelContext) StopTunnel

func (tc *TunnelContext) StopTunnel() error

StopTunnel stops the tunnel.

type TunnelContextHop

type TunnelContextHop struct {
	ID   string
	Name string
	IPv4 *TunnelContextHopIPInfo `json:",omitempty"`
	IPv6 *TunnelContextHopIPInfo `json:",omitempty"`
}

TunnelContextHop holds hop data for TunnelContext.

type TunnelContextHopIPInfo

type TunnelContextHopIPInfo struct {
	IP      net.IP
	Country string
	ASN     uint
	ASOwner string
}

TunnelContextHopIPInfo holds hop IP data for TunnelContextHop.

Jump to

Keyboard shortcuts

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