Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bunji2/findproxy

Go implementation of FindProxyForURL
https://github.com/bunji2/findproxy

findproxyforurl golang javascript

Last synced: about 14 hours ago
JSON representation

Go implementation of FindProxyForURL

Awesome Lists containing this project

README

        

# findproxy

Go implementation of FindProxyForURL

## Usage

```
C:\work> findproxy.exe
findproxy.exe proxy.pac url...
```

## Proxy.pac

[Proxy Auto Configuration file](https://developer.mozilla.org/ja/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_(PAC)_file)

## Sample

```javascript
// proxy.pac
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".foo.co.jp")) {
return "PROXY proxy1:8000"
}
if (shExpMatch(host, "*.com")) {
return "PROXY proxy2:8080";
}
if (isInNet(host, "192.168.1.0", "255.255.255.0")) {
return "PROXY 192.168.3.2:8000";
}
return "DIRECT";

}
```

```
C:\work> findproxy.exe proxy.pac http://hogehoge/hoge http://hoge.com/hoge http://192.168.1.45/ http://www.foo.co.jp/
http://hogehoge/hoge => DIRECT
http://hoge.com/hoge => PROXY proxy2:8080
http://192.168.1.45/ => PROXY 192.168.3.2:8000
http://www.foo.co.jp/ => PROXY proxy1:8000
```