Add missing file

This commit is contained in:
Toby 2021-04-19 00:20:39 -07:00
parent b09880a050
commit eb9006bd0d

27
pkg/acl/ip.go Normal file
View file

@ -0,0 +1,27 @@
package acl
import "net"
func parseIPZone(s string) (net.IP, string) {
s, zone := splitHostZone(s)
return net.ParseIP(s), zone
}
func splitHostZone(s string) (host, zone string) {
if i := last(s, '%'); i > 0 {
host, zone = s[:i], s[i+1:]
} else {
host = s
}
return
}
func last(s string, b byte) int {
i := len(s)
for i--; i >= 0; i-- {
if s[i] == b {
break
}
}
return i
}