minitunnel

package
v2.0.0-...-f0b7fcc Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

The minitunnel package implements bidirectional TCP tunnels over any io.ReadWriter. It does this in a way similar to the ssh -L command. Tunnel construction requires a source port, destination host, and destination port.

minitunnel supports multiple connections and multiple tunnels over a single transport.

Index

Constants

View Source
const (
	HANDSHAKE = iota
	CONNECT
	CLOSED
	DATA
	FORWARD
)

tunnel message types

View Source
const BufferSize = 32768

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(transport io.ReadWriteCloser) error

Listen for an incoming Tunnel connection. Only one tunnel connection is permitted. ListenAndServe will block indefinitely until an error occurs.

Types

type Tunnel

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

func Dial

func Dial(transport io.ReadWriteCloser) (*Tunnel, error)

Dial a listening minitunnel. Only one tunnel connection is permitted per transport.

func (*Tunnel) CloseForward

func (t *Tunnel) CloseForward(id int) error

func (*Tunnel) Forward

func (t *Tunnel) Forward(source int, host string, dest int) error

Forward a local port to a remote host and destination port

func (*Tunnel) ListForwards

func (t *Tunnel) ListForwards() map[int]string

func (*Tunnel) Reverse

func (t *Tunnel) Reverse(source int, host string, dest int) error

Create a reverse forwarded port from a source port on the remote end, destination host, and destination port on the local end.

Jump to

Keyboard shortcuts

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