mirror of https://github.com/0xERR0R/blocky.git
This commit is contained in:
parent
3315873b35
commit
120e32c1eb
|
@ -118,7 +118,7 @@ func NewBlockingResolver(
|
|||
cgb := make(map[string][]string, len(cfg.ClientGroupsBlock))
|
||||
|
||||
for identifier, cfgGroups := range cfg.ClientGroupsBlock {
|
||||
for _, ipart := range strings.Split(identifier, ",") {
|
||||
for _, ipart := range strings.Split(strings.ToLower(identifier), ",") {
|
||||
existingGroups, found := cgb[ipart]
|
||||
if found {
|
||||
cgb[ipart] = append(existingGroups, cfgGroups...)
|
||||
|
|
|
@ -178,7 +178,7 @@ var _ = Describe("BlockingResolver", Label("blockingResolver"), func() {
|
|||
"defaultGroup": {defaultGroupFile.Path},
|
||||
},
|
||||
ClientGroupsBlock: map[string][]string{
|
||||
"client1": {"gr1"},
|
||||
"Client1": {"gr1"},
|
||||
"client2,client3": {"gr1"},
|
||||
"client3": {"gr2"},
|
||||
"192.168.178.55": {"gr1"},
|
||||
|
@ -324,7 +324,7 @@ var _ = Describe("BlockingResolver", Label("blockingResolver"), func() {
|
|||
|
||||
When("Client has multiple names and for each name a client group block definition exists", func() {
|
||||
It("should block query if domain is in one group", func() {
|
||||
Expect(sut.Resolve(newRequestWithClient("domain1.com.", A, "1.2.1.2", "client1", "altName"))).
|
||||
Expect(sut.Resolve(newRequestWithClient("domain1.com.", A, "1.2.1.2", "client1", "altname"))).
|
||||
Should(
|
||||
SatisfyAll(
|
||||
BeDNSRecord("domain1.com.", A, "0.0.0.0"),
|
||||
|
|
|
@ -196,7 +196,7 @@ func CidrContainsIP(cidr string, ip net.IP) bool {
|
|||
|
||||
// ClientNameMatchesGroupName checks if a group with optional wildcards contains a client name
|
||||
func ClientNameMatchesGroupName(group, clientName string) bool {
|
||||
match, _ := filepath.Match(group, clientName)
|
||||
match, _ := filepath.Match(strings.ToLower(group), strings.ToLower(clientName))
|
||||
|
||||
return match
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue