diff --git a/.gitea/workflows/release-tag.yml b/.gitea/workflows/release-tag.yml index 867aa4a..672727d 100644 --- a/.gitea/workflows/release-tag.yml +++ b/.gitea/workflows/release-tag.yml @@ -16,6 +16,7 @@ jobs: uses: https://github.com/actions/setup-go@v4 with: go-version: '>=1.20.1' + cache: false - name: release-build run: go build -ldflags="-s -w -X 'main.Version=${{ github.ref_name }}'" -o bin/honeyspot-${{ github.ref_name }}-linux-amd64 - name: release-build-windows diff --git a/main.go b/main.go index 1d683f9..ae5219b 100644 --- a/main.go +++ b/main.go @@ -409,7 +409,13 @@ func listen(addr string) { } // check is ip - ip := net.ParseIP(remoteAddr.String()) + remoteAddrStr := remoteAddr.String() + // remove port with IPv6 support + if strings.Contains(remoteAddrStr, ":") { + remoteAddrStr = remoteAddrStr[:strings.LastIndex(remoteAddrStr, ":")] + } + + ip := net.ParseIP(remoteAddrStr) if ip == nil { log.Warnf("Got request from non-IP %s, ignoring request", remoteAddr) _ = conn.Close()