server

package
v0.0.0-...-c68a447 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

server provides the server end of packetforward functionality. The server reads IP packets from the client's connection, forwards these to the final origin using gonat and writes response packets back to the client.

Index

Constants

View Source
const (
	// DefaultBufferPoolSize is 1MB
	DefaultBufferPoolSize = 1000000

	// DefaultReadBufferSize is gonat.MaximumIPPacketSize
	DefaultReadBufferSize = gonat.MaximumIPPacketSize
)

Variables

View Source
var (

	// ErrNoConnection means that we attempted to write to client for which we have no current connection
	ErrNoConnection = errors.New("no client connection")
)

Functions

This section is empty.

Types

type Opts

type Opts struct {
	gonat.Opts

	// BufferPoolSize is the size of the buffer pool in bytes. If not specified, defaults to 1 MB
	BufferPoolSize int

	// ReadBufferSize is the size of the read buffer for reading framed packets from clients. If not specified, defaults to gonat.MaximumIPPacketSize
	ReadBufferSize int
}

type Server

type Server interface {
	Serve(l net.Listener) error

	// Close closes this server and associated resources.
	Close() error
}

func NewServer

func NewServer(opts *Opts) (Server, error)

NewServer constructs a new unstarted packetforward Server. The server can be started by calling Serve().

Jump to

Keyboard shortcuts

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