Build the Go API and React UI for managing domain denylist/allowlist/recipient deny and spam settings, plus shared lists that import/apply across domains with wildcard compaction, entry verification, and Migadu-friendly list encoding (including per-domain recipient filtering and rejection bisect on apply).
26 lines
514 B
Go
26 lines
514 B
Go
package config
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
)
|
|
|
|
func TestIsTrustedProxy(t *testing.T) {
|
|
cfg := &Config{}
|
|
networks, err := parseCIDRs("10.0.0.0/8,127.0.0.1")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
cfg.TrustedProxies = networks
|
|
|
|
if !cfg.IsTrustedProxy(net.ParseIP("10.1.2.3")) {
|
|
t.Fatal("expected 10.1.2.3 trusted")
|
|
}
|
|
if !cfg.IsTrustedProxy(net.ParseIP("127.0.0.1")) {
|
|
t.Fatal("expected 127.0.0.1 trusted")
|
|
}
|
|
if cfg.IsTrustedProxy(net.ParseIP("192.168.1.1")) {
|
|
t.Fatal("expected 192.168.1.1 untrusted")
|
|
}
|
|
}
|