pac

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToCreateParser  = customerror.NewFailedToError("create PAC parser", "", nil)
	ErrFailedToFindParserNil = customerror.NewFailedToError("PAC parser isn't initialized", "", nil)
	ErrFailedToFindURL       = customerror.NewFailedToError("find URL", "", nil)
	ErrFailedToParseURI      = customerror.NewFailedToError("parse URI", "", nil)
	ErrInvalidParams         = customerror.NewInvalidError("params", "", nil)
)

Functions

This section is empty.

Types

type IParser

type IParser interface {
	Find(url string) ([]string, error)
}

IParser specifies what a Parser does.

type PACProxies

type PACProxies = []PACProxy

type PACProxy

type PACProxy = pacman.Proxy

Type aliasing.

type Parser

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

Parser definition.

func New

func New(source string, proxiesURIs ...string) (*Parser, error)

New is the Parser factory. It's able to load PAC from many sources: - Direct: `source` is the PAC content - Remote: `source` is an HTTP/HTTPS URI - File: `source` points to a file:

  • As per PAC spec, PAC file should have the `.pac` extension
  • Absolute and relative paths are supported
  • `file://` scheme is supported. It should be an absolute path.

Notes:

  • Optionally, credentials for each/any proxy specified in the PAC content can be set (`proxiesURIs`) using standard URI format. These credentials will be automatically set when `FindProxy` is called.
  • URI is: scheme://[credential]@host[/path]` where:
  • `credential` is `username:password`, and is optional
  • `host` (also known as `authority`) is `hostname:port`, and is optional.

func (*Parser) Find

func (pP *Parser) Find(url string) (PACProxies, error)

Find proxy(ies) for the given `url`.

Jump to

Keyboard shortcuts

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