Documentation ¶
Overview ¶
Example ¶
package main import ( "fmt" "io/ioutil" "os" "github.com/saucelabs/pacman" ) func main() { pacf, _ := os.Open("resources/data.pac") defer pacf.Close() data, _ := ioutil.ReadAll(pacf) pac, _ := pacman.New(string(data)) r, _ := pac.FindProxyForURL("http://www.example.com/") fmt.Println(r) }
Output: PROXY http://4.5.6.7:8080; PROXY https://4.5.6.7:8081; PROXY socks://4.5.6.7:8082; PROXY socks5://4.5.6.7:8083; PROXY quic://4.5.6.7:8084; PROXY 4.5.6.7:8085
Index ¶
Examples ¶
Constants ¶
View Source
const ( NonDirectTypeAddsLen = 2 SOCKS5Number = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
Parser definition.
func New ¶
New is able to load PAC from many sources. - Directly: `textOrURI` is the PAC content - Remotely: `textOrURI` is a HTTP/HTTPS URI - File: `textOrURI` points to a file (requires `.pac` extension).
func (*Parser) FindProxyForURL ¶
FindProxyForURL finding proxy for url returns string like: "PROXY 4.5.6.7:8080; PROXY 7.8.9.10:8080; DIRECT".
Click to show internal directories.
Click to hide internal directories.