Merge: - clients: IPv6 address matching didn't work
Close #1261 Squashed commit of the following: commit acc39ea6c0d88cb9d2b07837e89db2c170263891 Author: Simon Zolin <s.zolin@adguard.com> Date: Mon Dec 16 12:29:33 2019 +0300 minor commit 0d2ef3d53185d5ca17797e2ac20f0efc1498a53c Author: Simon Zolin <s.zolin@adguard.com> Date: Mon Dec 16 12:13:17 2019 +0300 add link to GH commit 0da754b1751057968780b457a2f490f4148275a8 Author: Simon Zolin <s.zolin@adguard.com> Date: Mon Dec 16 11:53:42 2019 +0300 - clients: IPv6 address matching didn't work
This commit is contained in:
@@ -17,7 +17,7 @@ func TestClients(t *testing.T) {
|
||||
|
||||
// add
|
||||
c = Client{
|
||||
IDs: []string{"1.1.1.1", "aa:aa:aa:aa:aa:aa"},
|
||||
IDs: []string{"1.1.1.1", "1:2:3::4", "aa:aa:aa:aa:aa:aa"},
|
||||
Name: "client1",
|
||||
}
|
||||
b, e = clients.Add(c)
|
||||
@@ -36,14 +36,13 @@ func TestClients(t *testing.T) {
|
||||
}
|
||||
|
||||
c, b = clients.Find("1.1.1.1")
|
||||
if !b || c.Name != "client1" {
|
||||
t.Fatalf("Find #1")
|
||||
}
|
||||
assert.True(t, b && c.Name == "client1")
|
||||
|
||||
c, b = clients.Find("1:2:3::4")
|
||||
assert.True(t, b && c.Name == "client1")
|
||||
|
||||
c, b = clients.Find("2.2.2.2")
|
||||
if !b || c.Name != "client2" {
|
||||
t.Fatalf("Find #2")
|
||||
}
|
||||
assert.True(t, b && c.Name == "client2")
|
||||
|
||||
// failed add - name in use
|
||||
c = Client{
|
||||
|
||||
Reference in New Issue
Block a user