ptunnel

package
v0.0.0-...-5f133c6 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: BSD-3-Clause, BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CloseRequested = errors.New("close requested")

CloseRequested error is returned to interrupt Reads/Writes once a Close() has been requested by the user.

Functions

func Connect

func Connect(proxy *url.URL, host string, port uint16, pos, ack uint32, mods ...GetModifier) (*websocket.Conn, error)

func ConnectSID

func ConnectSID(proxy *url.URL, sid string, pos, ack uint32, mods ...ConnectModifier) (*websocket.Conn, error)

func ConnectURL

func ConnectURL(curl *url.URL, mods ...ConnectModifier) (*websocket.Conn, error)

func DefaultOptions

func DefaultOptions() *options

func GetSID

func GetSID(proxy *url.URL, host string, port uint16, mods ...GetModifier) (string, error)

Types

type ConnectModifier

type ConnectModifier func(*websocket.Dialer, http.Header) error

func WithBufferSize

func WithBufferSize(read, write int) ConnectModifier

func WithHandshakeTimeout

func WithHandshakeTimeout(t time.Duration) ConnectModifier

func WithHeader

func WithHeader(key, value string) ConnectModifier

type ConnectModifiers

type ConnectModifiers []ConnectModifier

func (ConnectModifiers) Apply

type Flags

type Flags struct {
	MaxReceiveWindow int
	MaxSendWindow    int

	*Timeouts
}

func DefaultFlags

func DefaultFlags() *Flags

func (*Flags) Register

func (fl *Flags) Register(set kflags.FlagSet, prefix string) *Flags

type Flushable

type Flushable interface {
	Flush() error
}

type GetModifier

type GetModifier func(*GetOptions) error

func WithConnectOptions

func WithConnectOptions(mods ...ConnectModifier) GetModifier

Configures options to use to establish the websocket moving bytes around.

This mostly affects the Connect(), ConnectSID() and ConnectURL() call, invoked once per attempt to establish the websocket used as the actual tunnel.

func WithGetOptions

func WithGetOptions(mods ...protocol.Modifier) GetModifier

Configures options to use in the GET requests to prepare the tunnel. This mostly affects the GetSID() call, invoked once per attempt to log in.

func WithOptions

func WithOptions(r *GetOptions) GetModifier

func WithRetryOptions

func WithRetryOptions(mods ...retry.Modifier) GetModifier

type GetModifiers

type GetModifiers []GetModifier

func (GetModifiers) Apply

func (mods GetModifiers) Apply(o *GetOptions) error

type GetOptions

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

type Modifier

type Modifier func(o *options) error

func FromFlags

func FromFlags(fl *Flags) Modifier

func WithLogger

func WithLogger(l logger.Logger) Modifier

func WithTimeouts

func WithTimeouts(t *Timeouts) Modifier

func WithWindowSize

func WithWindowSize(send, receive int) Modifier

type Modifiers

type Modifiers []Modifier

func (Modifiers) Apply

func (mods Modifiers) Apply(o *options) error

type TimeSource

type TimeSource func() time.Time

type Timeouts

type Timeouts struct {
	Now TimeSource

	ConnWriteTimeout    time.Duration
	BrowserWriteTimeout time.Duration

	BrowserAckInterval  time.Duration
	BrowserPingInterval time.Duration
	BrowserPingTimeout  time.Duration
}

func DefaultTimeouts

func DefaultTimeouts() *Timeouts

func (*Timeouts) Register

func (t *Timeouts) Register(set kflags.FlagSet, prefix string) *Timeouts

type Tunnel

type Tunnel struct {
	SendWin    *nasshp.BlockingSendWindow
	ReceiveWin *nasshp.BlockingReceiveWindow
	// contains filtered or unexported fields
}

func NewTunnel

func NewTunnel(pool *nasshp.BufferPool, mods ...Modifier) (*Tunnel, error)

func (*Tunnel) BrowserReceive

func (t *Tunnel) BrowserReceive() error

func (*Tunnel) BrowserSend

func (t *Tunnel) BrowserSend() error

func (*Tunnel) Close

func (t *Tunnel) Close()

func (*Tunnel) KeepConnected

func (t *Tunnel) KeepConnected(proxy *url.URL, host string, port uint16, mods ...GetModifier) error

func (*Tunnel) Receive

func (t *Tunnel) Receive(file io.Writer) error

func (*Tunnel) Send

func (t *Tunnel) Send(file io.Reader) error

type TunnelType

type TunnelType int
const (
	TunnelTypeNone TunnelType = iota
	TunnelTypePersistent
	TunnelTypeLocal
)

func TunnelTypeForHost

func TunnelTypeForHost(host string) (TunnelType, error)

type WithWriteDeadline

type WithWriteDeadline interface {
	SetWriteDeadline(time.Time) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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