plugin/hosts: fix for ipv4-in-ipv6 (#2506)
* fix for ipv4-in-ipv6 * update comment as requested
This commit is contained in:
parent
d571fbe046
commit
e343556687
2 changed files with 18 additions and 2 deletions
|
@ -185,8 +185,10 @@ func (h *Hostsfile) parse(r io.Reader, override *hostsMap) *hostsMap {
|
|||
}
|
||||
|
||||
// ipVersion returns what IP version was used textually
|
||||
// For why the string is parsed end to start,
|
||||
// see IPv4-Compatible IPv6 addresses - RFC 4291 section 2.5.5
|
||||
func ipVersion(s string) int {
|
||||
for i := 0; i < len(s); i++ {
|
||||
for i := len(s) - 1; i >= 0; i-- {
|
||||
switch s[i] {
|
||||
case '.':
|
||||
return 4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue