pac

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DirectPAC = "function FindProxyForURL(url, host){ return 'DIRECT'; }"

DirectPAC for simply always returning "DIRECT"

Variables

View Source
var DirectProxy = Proxy{}

DirectProxy is used to represent a "DIRECT" value

Functions

This section is empty.

Types

type EngineManager

type EngineManager interface {
	Start() error
	Stop() error
	Reload() error
}

EngineManager to deal with the starting, stoping, reloading of any runtime

type FirstItemSelector

type FirstItemSelector struct{}

FirstItemSelector simply selects the first item or returns DirectProxy

func (*FirstItemSelector) SelectProxy

func (s *FirstItemSelector) SelectProxy(from Proxies) Proxy

type Loader

type Loader func() (string, error)

Loader to load the pac as a string

func FileLoader

func FileLoader(file string) Loader

func HTTPLoader

func HTTPLoader(u *url.URL) Loader

func SmartLoader

func SmartLoader(thing string) Loader

SmartLoader attempt to detect if we are using js, a url, or a file path

type OttoEngine

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

OttoEngine struct

func NewOttoEngine

func NewOttoEngine(opts ...OttoEngineOpt) *OttoEngine

NewOttoEngine instance with configuration

func (*OttoEngine) FindProxyForURL

func (o *OttoEngine) FindProxyForURL(in *url.URL) (Proxies, error)

func (*OttoEngine) Reload

func (o *OttoEngine) Reload() error

func (*OttoEngine) Start

func (o *OttoEngine) Start() error

func (*OttoEngine) Stop

func (o *OttoEngine) Stop() error

type OttoEngineOpt

type OttoEngineOpt func(*OttoEngine)

OttoEngineOpt used to configure an OttoEngine via the NewOttoEngine func

func OttoLoader

func OttoLoader(fn Loader) OttoEngineOpt

OttoLoader that the engine should use

func OttoStringLoader

func OttoStringLoader(pac string) OttoEngineOpt

OttoStringLoader implements a string loader

type Proxies

type Proxies []Proxy

Proxies is a slice of Proxy that implements Stringer

func ParseFindProxyString

func ParseFindProxyString(s string) (Proxies, error)

ParseFindProxyString into a Proxies

func (Proxies) String

func (p Proxies) String() string

type Proxy

type Proxy struct {
	Hostname string
	Port     int
}

Proxy information struct

func (Proxy) String

func (p Proxy) String() string

type ProxyFinder

type ProxyFinder interface {
	FindProxyForURL(in *url.URL) (Proxies, error)
}

ProxyFinder for chosing the proxy for a URL

type ProxySelector

type ProxySelector interface {
	SelectProxy(from Proxies) Proxy
}

ProxySelector for proxy selection

Jump to

Keyboard shortcuts

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