Skip to content

Commit 83c1d3b

Browse files
committed
Fix IPv6 bug
1 parent 8d439de commit 83c1d3b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

client.go

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"io"
88
"net/http"
99
"strconv"
10+
"strings"
1011

1112
"github.com/coyove/goflyway/toh"
1213
"github.com/coyove/goflyway/v"
@@ -161,5 +162,10 @@ func handleSOCKS5(conn net.Conn) (string, error) {
161162
host = string(buf[:addrsize-2])
162163
}
163164

165+
if strings.Contains(host, ":") {
166+
// IPv6?
167+
host = "[" + host + "]"
168+
}
169+
164170
return host + ":" + port, nil
165171
}

0 commit comments

Comments
 (0)