Skip to content

Commit

Permalink
blocking_resolver unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
kwitsch committed Nov 12, 2021
1 parent cdb009d commit cb059de
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions resolver/blocking_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ badcnamedomain.com`)
"defaultGroup": {defaultGroupFile.Name()},
},
ClientGroupsBlock: map[string][]string{
"client1": {"gr1"},
"192.168.178.55": {"gr1"},
"altName": {"gr2"},
"10.43.8.67/28": {"gr1"},
"wildcard[0-9]*": {"gr1"},
"default": {"defaultGroup"},
"client1": {"gr1"},
"client2,client3": {"gr1"},
"192.168.178.55": {"gr1"},
"altName": {"gr2"},
"10.43.8.67/28": {"gr1"},
"wildcard[0-9]*": {"gr1"},
"default": {"defaultGroup"},
},
BlockType: "ZeroIP",
}
Expand All @@ -139,6 +140,16 @@ badcnamedomain.com`)

Expect(resp.Res.Answer).Should(BeDNSRecord("domain1.com.", dns.TypeA, 21600, "0.0.0.0"))
})
It("should block the A query if domain is on the black list multipart 1", func() {
resp, err = sut.Resolve(newRequestWithClient("domain1.com.", dns.TypeA, "1.2.1.2", "client2"))

Expect(resp.Res.Answer).Should(BeDNSRecord("domain1.com.", dns.TypeA, 21600, "0.0.0.0"))
})
It("should block the A query if domain is on the black list multipart 2", func() {
resp, err = sut.Resolve(newRequestWithClient("domain1.com.", dns.TypeA, "1.2.1.2", "client3"))

Expect(resp.Res.Answer).Should(BeDNSRecord("domain1.com.", dns.TypeA, 21600, "0.0.0.0"))
})
It("should block the AAAA query if domain is on the black list", func() {
resp, err = sut.Resolve(newRequestWithClient("domain1.com.", dns.TypeAAAA, "1.2.1.2", "client1"))

Expand Down

0 comments on commit cb059de

Please sign in to comment.