mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-08-11 03:41:47 +00:00
.github
cmd
docs
pkg
acl
engine.go
engine_test.go
entry.go
entry_test.go
ip.go
auth
congestion
core
http
obfs
relay
socks5
tproxy
transport
tun
utils
.gitignore
ACL.md
ACL.zh.md
CHANGELOG.md
Docker.md
Docker.zh.md
Dockerfile
LICENSE.md
README.md
README.zh.md
docker-compose.yaml
go.mod
go.sum
28 lines
397 B
Go
28 lines
397 B
Go
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
|
|
}
|