listen

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

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

Listener is a net.Listener that connects to a Border0 tunnel server and forwards connections to the local machine.

func New

func New(options ...Option) *Listener

New creates a new Listener with the given options.

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

Accept waits for and returns the next connection to the listener.

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

Addr returns the listener's network address.

func (*Listener) Close

func (l *Listener) Close() error

Close closes the listener.

func (*Listener) Start

func (l *Listener) Start() error

Start connects to Border0 tunnel server and starts listening for connections. It will block until the listener is ready to accept connections.

type Option

type Option func(*Listener)

Option is a function that configures a Listener.

func WithAPIClient

func WithAPIClient(api client.Requester) Option

WithAPIClient sets the API client to use for the Listener.

func WithAuthToken

func WithAuthToken(token string) Option

WithAuthToken sets the auth token to use with the API client.

func WithSocketName

func WithSocketName(name string) Option

WithSocketName sets the socket name to use for the HTTP socket that the Listener will create.

func WithTunnelServer

func WithTunnelServer(server string) Option

WithTunnelServer sets the tunnel server address for the Listener.

Jump to

Keyboard shortcuts

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