This commit is contained in:
wenyifan
2022-10-14 15:49:19 +08:00
parent a6bf1c0e7d
commit 91ac6f7e17
5 changed files with 77 additions and 6 deletions

View File

@ -1,8 +1,8 @@
package shadow
import (
"crypto/tls"
"fmt"
"github.com/refraction-networking/utls"
"io"
"net"
"time"
@ -48,13 +48,13 @@ func handlerClient(conn net.Conn, serverAddress string, fakeAddressSNI string) {
if HandshakePassword != "" {
config.Rand = RandReaderObj
}
dial, err := tls.DialWithDialer(&net.Dialer{
Timeout: time.Second * 5,
}, "tcp", serverAddress, config)
rawConn, err := net.DialTimeout("tcp", serverAddress, time.Second*5)
if err != nil {
fmt.Printf("[Client] Dial server error: %v\n", err)
return
}
dial := tls.UClient(rawConn, config, tls.HelloChrome_102)
err = dial.Handshake()
if err != nil {
fmt.Printf("[Client] Handshake error: %v\n", err)