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:
Simon Zolin
2019-12-16 12:36:52 +03:00
parent d9ee9b88d6
commit 6a2430b799
3 changed files with 34 additions and 14 deletions

View File

@@ -784,3 +784,15 @@ func TestValidateUpstreamsSet(t *testing.T) {
t.Fatalf("there is an invalid upstream in set, but it pass through validation")
}
}
func TestIpFromAddr(t *testing.T) {
addr := net.UDPAddr{}
addr.IP = net.ParseIP("1:2:3::4")
addr.Port = 12345
addr.Zone = "eth0"
a := ipFromAddr(&addr)
assert.True(t, a == "1:2:3::4")
a = ipFromAddr(nil)
assert.True(t, a == "")
}