Skip to content

Commit

Permalink
Revert "Don't convert to 4in6 address to ipv4"
Browse files Browse the repository at this point in the history
This reverts commit f28cc15853c10d2ed75a47e3625bc00a4ae388d3.
  • Loading branch information
zhanhb committed Apr 21, 2020
1 parent 234548e commit bd0f186
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@ func fprintln(w io.Writer, a ...interface{}) {
}

func parseIp(str string) net.IP {
for _, b := range str {
switch b {
case '.':
if ip := net.ParseIP(str); ip != nil {
return ip.To4()
}
case ':':
return net.ParseIP(str)
ip := net.ParseIP(str)
if ip != nil {
if ipv4 := ip.To4(); ipv4 != nil {
return ipv4
}
}
return nil
return ip
}

// maybe IpCidr, Range or Ip is returned
Expand Down

0 comments on commit bd0f186

Please sign in to comment.