Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions blocklist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ func TestBlocklistDuplicateEntry(t *testing.T) {
var now time.Time
b.now = func() time.Time { return now }
b.add("foo")
now = now.Add(3*time.Minute)
now = now.Add(3 * time.Minute)
b.add("foo")
now = now.Add(3*time.Minute)
now = now.Add(3 * time.Minute)
b.contains("foo")
now = now.Add(3*time.Minute)
now = now.Add(3 * time.Minute)
b.contains("foo")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 11
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:14 GMT
X-Cached-Time: 2026-03-22T16:54:14Z
X-Request-Time: 2026-03-22T16:54:14Z
X-Response-Time: 2026-03-22T16:54:14Z

test script
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 82
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:15 GMT
X-Cached-Time: 2026-03-22T16:54:15Z
X-Request-Time: 2026-03-22T16:54:15Z
X-Response-Time: 2026-03-22T16:54:15Z

function FindProxyForURL(url, host) { return "PROXY primary:80; PROXY backup:80" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 55
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return 'DIRECT' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 82
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return "PROXY primary:80; PROXY backup:80" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 63
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:15 GMT
X-Cached-Time: 2026-03-22T16:54:15Z
X-Request-Time: 2026-03-22T16:54:15Z
X-Response-Time: 2026-03-22T16:54:15Z

function FindProxyForURL(url, host) { return 'HTTP http.test' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 11
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:15 GMT
X-Cached-Time: 2026-03-22T16:59:15Z
X-Request-Time: 2026-03-22T16:59:15Z
X-Response-Time: 2026-03-22T16:59:15Z

test script
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 69
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:15 GMT
X-Cached-Time: 2026-03-22T16:54:15Z
X-Request-Time: 2026-03-22T16:54:15Z
X-Response-Time: 2026-03-22T16:54:15Z

function FindProxyForURL(url, host) { return 'INVALID RETURN VALUE' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 13
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:15 GMT
X-Cached-Time: 2026-03-22T16:59:15Z
X-Request-Time: 2026-03-22T16:59:15Z
X-Response-Time: 2026-03-22T16:59:15Z

test script 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 72
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:15 GMT
X-Cached-Time: 2026-03-22T16:54:15Z
X-Request-Time: 2026-03-22T16:54:15Z
X-Response-Time: 2026-03-22T16:54:15Z

function FindProxyForURL(url, host) { return 'SOCKS socksproxy.test:3' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return 'HTTP http.test:4' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 72
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return 'SOCKS socksproxy.test:3' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return 'HTTPS https.test' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 11
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:14 GMT
X-Cached-Time: 2026-03-22T16:54:14Z
X-Request-Time: 2026-03-22T16:54:14Z
X-Response-Time: 2026-03-22T16:54:14Z

test script
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return 'PROXY proxy.test' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return 'HTTPS https.test:5' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 11
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:15 GMT
X-Cached-Time: 2026-03-22T16:59:15Z
X-Request-Time: 2026-03-22T16:59:15Z
X-Response-Time: 2026-03-22T16:59:15Z

test script
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:15 GMT
X-Cached-Time: 2026-03-22T16:54:15Z
X-Request-Time: 2026-03-22T16:54:15Z
X-Response-Time: 2026-03-22T16:54:15Z

function FindProxyForURL(url, host) { return 'PROXY proxy.test' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 55
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:15 GMT
X-Cached-Time: 2026-03-22T16:54:15Z
X-Request-Time: 2026-03-22T16:54:15Z
X-Response-Time: 2026-03-22T16:54:15Z

function FindProxyForURL(url, host) { return 'DIRECT' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:15 GMT
X-Cached-Time: 2026-03-22T16:54:15Z
X-Request-Time: 2026-03-22T16:54:15Z
X-Response-Time: 2026-03-22T16:54:15Z

function FindProxyForURL(url, host) { return 'HTTP http.test:4' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 63
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return 'HTTP http.test' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:15 GMT
X-Cached-Time: 2026-03-22T16:54:15Z
X-Request-Time: 2026-03-22T16:54:15Z
X-Response-Time: 2026-03-22T16:54:15Z

function FindProxyForURL(url, host) { return 'HTTPS https.test:5' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 75
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return 'PROXY proxy.test:1; DIRECT' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:15 GMT
X-Cached-Time: 2026-03-22T16:54:15Z
X-Request-Time: 2026-03-22T16:54:15Z
X-Response-Time: 2026-03-22T16:54:15Z

function FindProxyForURL(url, host) { return 'PROXY proxy.test:2' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 69
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return 'INVALID RETURN VALUE' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 67
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { return 'PROXY proxy.test:2' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 53
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:59:16 GMT
X-Cached-Time: 2026-03-22T16:59:16Z
X-Request-Time: 2026-03-22T16:59:16Z
X-Response-Time: 2026-03-22T16:59:16Z

function FindProxyForURL(url, host) { throw 'error' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 13
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:14 GMT
X-Cached-Time: 2026-03-22T16:54:14Z
X-Request-Time: 2026-03-22T16:54:14Z
X-Response-Time: 2026-03-22T16:54:14Z

test script 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 75
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:14 GMT
X-Cached-Time: 2026-03-22T16:54:14Z
X-Request-Time: 2026-03-22T16:54:14Z
X-Response-Time: 2026-03-22T16:54:14Z

function FindProxyForURL(url, host) { return 'PROXY proxy.test:1; DIRECT' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 53
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:14 GMT
X-Cached-Time: 2026-03-22T16:54:14Z
X-Request-Time: 2026-03-22T16:54:14Z
X-Response-Time: 2026-03-22T16:54:14Z

function FindProxyForURL(url, host) { throw 'error' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
HTTP/1.1 200 OK
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Date: Sun, 22 Mar 2026 16:54:15 GMT
X-Cached-Time: 2026-03-22T16:54:15Z
X-Request-Time: 2026-03-22T16:54:15Z
X-Response-Time: 2026-03-22T16:54:15Z

function FindProxyForURL(url, host) { return 'HTTPS https.test' }
17 changes: 9 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
module github.com/samuong/alpaca/v2

go 1.22.3

toolchain go1.22.4
go 1.25.3

require (
github.com/gobwas/glob v0.2.3
github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6
github.com/robertkrimen/otto v0.4.0
github.com/samuong/go-ntlmssp v0.0.0-20240616070040-65a20607c744
github.com/stretchr/testify v1.9.0
github.com/sandrolain/httpcache v1.4.0
github.com/stretchr/testify v1.11.1
github.com/zalando/go-keyring v0.2.5
golang.org/x/term v0.21.0
golang.org/x/term v0.36.0
)

require (
github.com/alessio/shellescape v1.4.1 // indirect
github.com/danieljoos/wincred v1.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/crypto v0.43.0 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/text v0.30.0 // indirect
gopkg.in/sourcemap.v1 v1.0.5 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading