package xffecho import ( "testing" "go.ntppool.org/common/xff" ) func TestTrustOptions(t *testing.T) { tp, err := xff.NewFromCIDRs([]string{ "192.0.2.0/24", "203.0.113.0/24", "2001:db8::/32", }) if err != nil { t.Fatal(err) } opts := TrustOptions(tp) if len(opts) != 3 { t.Errorf("expected 3 trust options, got %d", len(opts)) } } func TestTrustOptionsEmpty(t *testing.T) { tp := xff.New() opts := TrustOptions(tp) if len(opts) != 0 { t.Errorf("expected 0 trust options, got %d", len(opts)) } }