proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	XMLEndpoints = []string{
		"/cgi-bin/datalog.xml",
		"/cgi-bin/outlog.xml",
		"/cgi-bin/status.xml",
	}
	JSONEndpoints = []string{
		"/cgi-bin/datalog.json",
		"/cgi-bin/outlog.json",
		"/cgi-bin/status.json",
	}
)

Functions

This section is empty.

Types

type AccessList

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

AccessList represents an IP access list.

func NewAccessList

func NewAccessList(cidr []string, cacheSize int) (*AccessList, error)

NewAccessList creates a new IP access list for given CIDRs. A LRU cache is used when cacheSize is specified to speedup frequently looked up addresses.

func (*AccessList) Contains

func (a *AccessList) Contains(in string) bool

Contains verifies if given IP address is member of any defined access list nets.

type Apex

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

Apex proxy handler.

func New

func New(endpoint string, opts ...ProxyOption) (*Apex, error)

New creates a new Apex proxy handler.

func (*Apex) ServeHTTP

func (a *Apex) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler.

type ProxyOption

type ProxyOption func(*Apex)

ProxyOption allows configuring the Apex proxy.

func WithAccessListCacheSize

func WithAccessListCacheSize(size int) ProxyOption

WithAccessListCacheSize configures the LRU IP matcher cache size.

func WithAllowIPs

func WithAllowIPs(ips []string) ProxyOption

WithAllowIPs allows requests from given list of IP ranges.

func WithAllowJSONEndpoints

func WithAllowJSONEndpoints() ProxyOption

WithAllowJSONEndpoints allows GET requests for cgi-bin JSON endpoints.

func WithAllowPrivateIPs

func WithAllowPrivateIPs() ProxyOption

WithAllowPrivateIPs allows requests from all private IP ranges.

func WithAllowXMLEndpoints

func WithAllowXMLEndpoints() ProxyOption

WithAllowXMLEndpoints allows GET requests for cgi-bin XML endpoints.

func WithAllowedURLs

func WithAllowedURLs(urls []string) ProxyOption

WithAllowedURLs allows GET requests to given list of URLs.

Jump to

Keyboard shortcuts

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