tunnel

package module
v0.0.0-...-7447419 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tunnel

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

Tunnel is a Sandwich tunnel.

func NewTunnel

func NewTunnel(ctx *TunnelContext, tunnelIO TunnelIO, configuration *api.TunnelConfiguration) (*Tunnel, error)

NewTunnel creates a Sandwich tunnel from a context, an io and a configuration.

func NewTunnelWithReadWriter

func NewTunnelWithReadWriter(ctx *TunnelContext, readWriter io.ReadWriter, configuration *api.TunnelConfiguration) (*Tunnel, error)

NewTunnelWithReadWriter creates a Sandwich tunnel using a simple `io.ReadWriter` interface.

func (*Tunnel) Handshake

func (tunnel *Tunnel) Handshake() error

Handshakes performs or resumes the handshake stage. If nil is returned, it means the handshake is done.

func (*Tunnel) Read

func (tunnel *Tunnel) Read(b []byte) (int, error)

Read implements the io.Reader interface.

func (*Tunnel) SetTracer

func (tunnel *Tunnel) SetTracer(ctx context.Context, tracer trace.Tracer)

func (*Tunnel) State

func (tunnel *Tunnel) State() pb.State

State returns the state of the tunnel.

func (*Tunnel) Write

func (tunnel *Tunnel) Write(b []byte) (int, error)

Write implements the io.Reader interface.

type TunnelContext

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

TunnelContext is a Sandwich context for tunnels.

func NewTunnelContext

func NewTunnelContext(handle *sw.Sandwich, configuration *api.Configuration) (*TunnelContext, error)

NewTunnelContext fills a Sandwich context from a protobuf configuration.

type TunnelIO

type TunnelIO interface {
	// TunnelIO is an io.ReadWriter.
	io.ReadWriter

	// SetState sets the state of the tunnel.
	//
	// It is guaranteed that the state of the tunnel will not change between
	// two calls to SetState.
	SetState(tunnel_state pb.State)
}

TunnelIO represents the I/O interface used by tunnels in Sandwich.

Jump to

Keyboard shortcuts

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