Compare commits

..

No commits in common. "anywhere" and "master" have entirely different histories.

1 changed files with 1 additions and 14 deletions

15
main.go
View File

@ -9,7 +9,6 @@ import (
"net"
"os"
"sort"
"strings"
)
type lines []string
@ -17,19 +16,7 @@ type lines []string
func (l lines) Len() int { return len(l) }
func (l lines) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
func (l lines) Less(i, j int) bool {
var a, b net.IP
for _, s := range strings.Fields(l[i]) {
a = net.ParseIP(s)
if a != nil {
break
}
}
for _, s := range strings.Fields(l[j]) {
b = net.ParseIP(s)
if b != nil {
break
}
}
a, b := net.ParseIP(l[i]), net.ParseIP(l[j])
return bytes.Compare(a, b) < 0
}