Enhance Dockerfile to build and include a new HTTP API service (mtproxy_checkerd) alongside the existing CLI tool (mtproxy_checker). Update README and documentation to reflect the new service and its usage, including environment variables and Docker run instructions.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package allowlist
|
||||
|
||||
import (
|
||||
"net/netip"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseCommaList(t *testing.T) {
|
||||
list, err := ParseCommaList(" ")
|
||||
if err != nil || list != nil {
|
||||
t.Fatalf("empty: list=%v err=%v", list, err)
|
||||
}
|
||||
list, err = ParseCommaList("192.168.1.1, 10.0.0.0/8")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(list) != 2 {
|
||||
t.Fatalf("want 2 prefixes, got %d", len(list))
|
||||
}
|
||||
a := netip.MustParseAddr("10.5.5.5")
|
||||
if !Contains(list, a) {
|
||||
t.Fatal("10.5.5.5 should match 10.0.0.0/8")
|
||||
}
|
||||
b := netip.MustParseAddr("192.168.1.1")
|
||||
if !Contains(list, b) {
|
||||
t.Fatal("192.168.1.1 should match host /32")
|
||||
}
|
||||
c := netip.MustParseAddr("8.8.8.8")
|
||||
if Contains(list, c) {
|
||||
t.Fatal("8.8.8.8 should not match")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user