Documentation ¶
Overview ¶
Package pac provides a PAC file parser and evaluator. Under the hood uses Goja JavaScript VM to run the PAC script. It supports Mozilla FindProxyForURL and the Microsoft IPv6 extension FindProxyForURLEx as well as all the helper functions as described in the PAC specification.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SupportedFunctions ¶
func SupportedFunctions() []string
SupportedFunctions returns a list of supported javascript functions from the PAC specification.
Types ¶
type Proxies ¶
type Proxies string
Proxies is a list of proxies as returned from FindProxyForURL. If the string is empty, no proxies should be used. The string can contain any number of the following building blocks, separated by a semicolon: <type> <host>:<port> where <type> = "DIRECT" | "PROXY" | "SOCKS" | "HTTP" | "HTTPS" | "SOCKS4" <host> = a valid DNS hostname or IP address <port> = a valid port number.
type Proxy ¶
Proxy specifies proxy to be used as parsed from FindProxyForURL result. See ParseResult for details.
type ProxyResolver ¶
type ProxyResolver struct {
// contains filtered or unexported fields
}
ProxyResolver is a PAC resolver. It can be used to resolve a proxy for a given URL. It supports both FindProxyForURL and FindProxyForURLEx functions. It is not safe for concurrent use.
func NewProxyResolver ¶
func NewProxyResolver(cfg *ProxyResolverConfig, r *net.Resolver, opts ...Option) (*ProxyResolver, error)
func (*ProxyResolver) FindProxyForURL ¶
FindProxyForURL calls FindProxyForURL or FindProxyForURLEx function in the PAC script. The hostname is optional, if empty it will be extracted from URL.
type ProxyResolverConfig ¶
type ProxyResolverConfig struct { Script string AlertSink io.Writer // contains filtered or unexported fields }
func (*ProxyResolverConfig) Validate ¶
func (c *ProxyResolverConfig) Validate() error
type ProxyResolverPool ¶
type ProxyResolverPool struct {
// contains filtered or unexported fields
}
func NewProxyResolverPool ¶
func NewProxyResolverPool(cfg *ProxyResolverConfig, r *net.Resolver, opts ...Option) (*ProxyResolverPool, error)
func (*ProxyResolverPool) FindProxyForURL ¶
FindProxyForURL calls FindProxyForURL or FindProxyForURLEx function in the PAC script with the alternate hostname. The hostname is optional, if empty it will be extracted from URL. This is to handle cases when the hostname is not a valid hostname, but a URL.