Skip to content

Commit

Permalink
优化ipv6判断
Browse files Browse the repository at this point in the history
  • Loading branch information
keminar committed Mar 28, 2021
1 parent 6f35a6b commit 914370f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions proto/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ func (s *tunnel) dail(dstIP string, dstPort uint16) (err error) {
var conn net.Conn
if strings.Contains(dstIP, ":") {
// tcp6 支持
conn, err = net.DialTimeout("tcp6", fmt.Sprintf("[%s]:%d", dstIP, dstPort), connTimeout) // 3s timeout
conn, err = net.DialTimeout("tcp6", fmt.Sprintf("[%s]:%d", dstIP, dstPort), connTimeout)
} else {
conn, err = net.DialTimeout("tcp", fmt.Sprintf("%s:%d", dstIP, dstPort), connTimeout) // 3s timeout
conn, err = net.DialTimeout("tcp", fmt.Sprintf("%s:%d", dstIP, dstPort), connTimeout)
}
if err != nil {
return
Expand Down

0 comments on commit 914370f

Please sign in to comment.