forwardproxy

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_PORTNO int = 10000

constant defining the default port the forwarder will be served on.

View Source
const DEFAULT_TIMEOUT time.Duration = 10 * time.Second

constant defining the default timeout for a request.

Variables

This section is empty.

Functions

This section is empty.

Types

type Forwarder

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

struct defining the forwarder object used to proxy traffic.

func NewForwarder

func NewForwarder(userOptions ...ForwarderOptionsFunc) (forwarder *Forwarder, err error)

function designed to create and initialize a new proxy forwarder object. this will be used to proxy the traffic sent to the server.

func (*Forwarder) Serve

func (f *Forwarder) Serve() (err error)

function designed to start the forwarder server and begin forwarding traffic.

type ForwarderOptions

type ForwarderOptions struct {
	// transport to use to transmit the requests.
	ForwardTransport http.RoundTripper
	// flag indicating whether to log traffic to STDOUT.
	// this flag is set by default.
	Logging bool
	// port to host the forwarder on.
	Portno int
	// server to use to serve the forwarder.
	Server *http.Server
}

struct defining various options the user can set when initializing a new forwarder object.

type ForwarderOptionsFunc

type ForwarderOptionsFunc func(*ForwarderOptions) error

type definition explaining a Forwarder Options function. this will be used during initialization of a new Forwarder object to set user-controlled options and variables.

func NoLogging added in v0.0.41

func NoLogging() ForwarderOptionsFunc

function designed to clear the Logging flag for the forwarder. this will turn off logging traffic to STDOUT.

func UseServePort

func UseServePort(portno int) ForwarderOptionsFunc

function designed to set the serve port for the forwarder. this can be passed to the NewForwarder function during creation of a new object.

func UseTransport

func UseTransport(transport http.RoundTripper) ForwarderOptionsFunc

function designed to set the transport object for the forwarder. this can be passed to the NewForwarder function during creation of a new object.

this transport object is responsible for taking the incoming request and forwarding it onto the target destination.

Jump to

Keyboard shortcuts

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