mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-08 06:08:30 +02:00
Merge pull request #631 from Nirostar/patch-1
Fix IPv6 whitelisting for Link-Local addresses by removing the scope ID
This commit is contained in:
@@ -57,7 +57,7 @@ func GetRequesterIP(r *http.Request) string {
|
||||
//e.g. [15c4:cbb4:cc98:4291:ffc1:3a46:06a1:51a7]
|
||||
requesterRawIp = requesterRawIp[1 : len(requesterRawIp)-1]
|
||||
}
|
||||
|
||||
|
||||
return requesterRawIp
|
||||
}
|
||||
|
||||
@@ -87,6 +87,11 @@ func MatchIpWildcard(ipAddress, wildcard string) bool {
|
||||
|
||||
// Match ip address with CIDR
|
||||
func MatchIpCIDR(ip string, cidr string) bool {
|
||||
// Trim away scope ID if present in IP (e.g. fe80::1%eth0)
|
||||
if i := strings.Index(ip, "%"); i != -1 {
|
||||
ip = ip[:i]
|
||||
}
|
||||
|
||||
// parse the CIDR string
|
||||
_, cidrnet, err := net.ParseCIDR(cidr)
|
||||
if err != nil {
|
||||
|
@@ -1,12 +1,12 @@
|
||||
//go:build (windows && amd64) || (linux && mipsle) || (linux && riscv64)
|
||||
// +build windows,amd64 linux,mipsle linux,riscv64
|
||||
//go:build (windows && amd64) || (linux && mipsle) || (linux && riscv64) || (freebsd && amd64)
|
||||
// +build windows,amd64 linux,mipsle linux,riscv64 freebsd,amd64
|
||||
|
||||
package sshprox
|
||||
|
||||
import "embed"
|
||||
|
||||
/*
|
||||
Bianry embedding
|
||||
Binary embedding
|
||||
|
||||
Make sure when compile, gotty binary exists in static.gotty
|
||||
*/
|
||||
|
Reference in New Issue
Block a user