tunnels

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package tunnels allows creation of simple forwarding tunnels between address pairs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tunnel

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

Tunnel forwards data between source and destination addresses.

func (*Tunnel) Addr

func (t *Tunnel) Addr() net.Addr

Addr returns address on which it listens for connection.

It should be used to make a connection to the Tunnel.

func (*Tunnel) Close

func (t *Tunnel) Close() error

Close stops listening on the port for new connections and terminates exisiting ones.

func (*Tunnel) Create

func (t *Tunnel) Create(src net.IP, dest net.TCPAddr) (err error)

Create sets up data forwarding tunnel between src and dest addresses. It will listen on random port on src and forward to dest.

When connection to src is made a corresponding one is created to dest and data is copied between them.

Close should be called to clean up this function and terminate connections.

type Tunneler

type Tunneler interface {
	// Create sets up a new tunnel.
	Create(net.IP, net.TCPAddr) error
	// Close shuts down tunnel.
	Close() error
	// Addr returns the address of the tunnel to be used by a user
	// for a connection to Dryad.
	Addr() net.Addr
}

Tunneler defines API for basic operations on tunnels.

Jump to

Keyboard shortcuts

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