Merge pull request #3895 from jacksontj/issue_3881
Correctly format ipv6 resolver config for lua
This commit is contained in:
commit
614a2d43bc
2 changed files with 8 additions and 4 deletions
|
@ -250,11 +250,15 @@ func buildResolversForLua(res interface{}, disableIpv6 interface{}) string {
|
|||
|
||||
r := []string{}
|
||||
for _, ns := range nss {
|
||||
if ing_net.IsIPV6(ns) && no6 {
|
||||
if ing_net.IsIPV6(ns) {
|
||||
if no6 {
|
||||
continue
|
||||
}
|
||||
r = append(r, fmt.Sprintf("\"[%v]\"", ns))
|
||||
} else {
|
||||
r = append(r, fmt.Sprintf("\"%v\"", ns))
|
||||
}
|
||||
}
|
||||
|
||||
return strings.Join(r, ", ")
|
||||
}
|
||||
|
|
|
@ -516,7 +516,7 @@ func TestBuildResolversForLua(t *testing.T) {
|
|||
t.Errorf("Expected '%v' but returned '%v'", expected, actual)
|
||||
}
|
||||
|
||||
expected = "\"192.0.0.1\", \"2001:db8:1234::\""
|
||||
expected = "\"192.0.0.1\", \"[2001:db8:1234::]\""
|
||||
actual = buildResolversForLua(ipList, false)
|
||||
|
||||
if expected != actual {
|
||||
|
|
Loading…
Reference in a new issue