Documentation
¶
Index ¶
Constants ¶
const DEFAULT_PORTNO int = 10000
constant defining the default port the forwarder will be served on.
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.
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.