1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

SPF Optimizer: Add "redirect:" support (#506)

FYI: The support is very minimal. It only supports redirect if it is the last item in an SPF record. At that point, it is equivalent to include.

* In SFP, treat redirect like a special include.
* Document SPF redirect: limited implementation.
This commit is contained in:
Tom Limoncelli
2019-06-19 18:46:56 +01:00
committed by GitHub
parent 4a7a5515a0
commit 2d9d93653b
3 changed files with 44 additions and 3 deletions

View File

@ -40,3 +40,31 @@ func TestParseWithDoubleSpaces(t *testing.T) {
}
t.Log(rec.Print())
}
func TestParseRedirectNotLast(t *testing.T) {
// Make sure redirect:foo fails if it isn't the last item.
dnsres, err := NewCache("testdata-dns1.json")
if err != nil {
t.Fatal(err)
}
_, err = Parse(strings.Join([]string{"v=spf1",
"redirect:servers.mcsv.net",
"~all"}, " "), dnsres)
if err == nil {
t.Fatal("should fail")
}
}
func TestParseRedirectLast(t *testing.T) {
dnsres, err := NewCache("testdata-dns1.json")
if err != nil {
t.Fatal(err)
}
rec, err := Parse(strings.Join([]string{"v=spf1",
"ip4:198.252.206.0/24",
"redirect:servers.mcsv.net"}, " "), dnsres)
if err != nil {
t.Fatal(err)
}
t.Log(rec.Print())
}