mirror of
https://github.com/coredns/coredns.git
synced 2025-12-13 05:45:11 -05:00
plugin/hosts: fix for ipv4-in-ipv6 (#2506)
* fix for ipv4-in-ipv6 * update comment as requested
This commit is contained in:
committed by
Miek Gieben
parent
d571fbe046
commit
e343556687
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user