Initial import

This commit is contained in:
2025-09-26 08:49:53 +02:00
commit a76650da35
35 changed files with 4660 additions and 0 deletions

25
proxy/mitm/cache_test.go Normal file
View File

@@ -0,0 +1,25 @@
package mitm
import "testing"
func TestDiskCachePath(t *testing.T) {
cache := diskCache("testdata")
tests := []struct {
test string
want string
}{
{"x.com", "testdata/com/x/x.com.crt"},
{"feed.x.com", "testdata/com/x/x/feed.x.com.crt"},
{"nu.nl", "testdata/nl/n/nu/nu.nl.crt"},
{"maze.io", "testdata/io/m/ma/maze.io.crt"},
{"lab.maze.io", "testdata/io/m/ma/maze/lab.maze.io.crt"},
{"dev.lab.maze.io", "testdata/io/m/ma/maze/dev.lab.maze.io.crt"},
}
for _, test := range tests {
t.Run(test.test, func(it *testing.T) {
if v := cache.path(test.test); v != test.want {
it.Errorf("expected %q to resolve to %q, got %q", test.test, test.want, v)
}
})
}
}