diff --git a/docker/Dockerfile b/docker/Dockerfile index c54306f..2375adb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -35,6 +35,8 @@ RUN curl -Lo ZeroTierOne.tar.gz https://codeload.github.com/zerotier/ZeroTierOne FROM docker.io/golang:bookworm +# If you build it yourself, you will need to add the example directory into the docker directory. + COPY --chmod=700 ./entrypoint.sh /opt/zoraxy/ COPY --chmod=700 ./build_plugins.sh /usr/local/bin/build_plugins COPY --chmod=700 ./example/plugins/ztnc/mod/zoraxy_plugin/ /opt/zoraxy/zoraxy_plugin/ diff --git a/src/Makefile b/src/Makefile index f2a8ae3..aa9b2c0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ # PLATFORMS := darwin/amd64 darwin/arm64 freebsd/amd64 linux/386 linux/amd64 linux/arm linux/arm64 linux/mipsle windows/386 windows/amd64 windows/arm windows/arm64 -PLATFORMS := linux/amd64 linux/386 linux/arm linux/arm64 linux/mipsle linux/riscv64 windows/amd64 +PLATFORMS := linux/amd64 linux/386 linux/arm linux/arm64 linux/mipsle linux/riscv64 windows/amd64 freebsd/amd64 temp = $(subst /, ,$@) os = $(word 1, $(temp)) arch = $(word 2, $(temp)) diff --git a/src/mod/netutils/ipmatch.go b/src/mod/netutils/ipmatch.go index a9733c9..b5f6ff4 100644 --- a/src/mod/netutils/ipmatch.go +++ b/src/mod/netutils/ipmatch.go @@ -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 { diff --git a/src/mod/sshprox/embed.go b/src/mod/sshprox/embed.go index 23336de..4c5fe2d 100644 --- a/src/mod/sshprox/embed.go +++ b/src/mod/sshprox/embed.go @@ -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 */