mirror of https://github.com/0xERR0R/blocky.git
IPv6 upstream support
This commit is contained in:
parent
313b8af18b
commit
cc87d1507d
|
@ -53,7 +53,7 @@ func ParseUpstream(upstream string) (result Upstream, err error) {
|
|||
return Upstream{}, nil
|
||||
}
|
||||
|
||||
r := regexp.MustCompile(`(?P<Net>[^\s:]*):/?/?(?P<Host>[^\s/:]*):?(?P<Port>[^\s/:]*)?(?P<Path>/[^\s]*)?`)
|
||||
r := regexp.MustCompile(`(?P<Net>[^\s:]*):/?/?(?P<Host>(?:\[[^\]]+\])|[^\s/:]+):?(?P<Port>[^\s/:]*)?(?P<Path>/[^\s]*)?`)
|
||||
|
||||
match := r.FindStringSubmatch(upstream)
|
||||
|
||||
|
|
|
@ -131,6 +131,10 @@ var _ = Describe("Config", func() {
|
|||
"",
|
||||
Upstream{Net: ""},
|
||||
false),
|
||||
Entry("udpIpv6WithPort",
|
||||
"udp:[fd00::6cd4:d7e0:d99d:2952]:53",
|
||||
Upstream{Net: "udp", Host: "[fd00::6cd4:d7e0:d99d:2952]", Port: 53},
|
||||
false),
|
||||
Entry("without host",
|
||||
"tcp::53",
|
||||
nil,
|
||||
|
|
Loading…
Reference in New Issue