grpc: update deprecated method (#74)

* grpc: update deprecated method

* grpc: add connection timeout

* remove cf-ns.com

* prolong connection timeout to 10s

* remove connection timeout
This commit is contained in:
UUBulb
2024-10-18 15:08:51 +08:00
committed by GitHub
parent c6eb90708e
commit 404260187c
5 changed files with 9 additions and 12 deletions
+2 -2
View File
@@ -128,7 +128,7 @@ func getPendingConnectionID(dest string, alpnIsH2 bool) pendingConnKey {
func (r *uTLSHTTPRoundTripperImpl) putConn(addr string, alpnIsH2 bool, conn net.Conn) {
connId := getPendingConnectionID(addr, alpnIsH2)
r.pendingConn[connId] = NewUnclaimedConnection(conn, time.Minute)
r.pendingConn[connId] = newUnclaimedConnection(conn, time.Minute)
}
func (r *uTLSHTTPRoundTripperImpl) getConn(addr string, alpnIsH2 bool) net.Conn {
@@ -241,7 +241,7 @@ func (r *uTLSHTTPRoundTripperImpl) init() {
}
}
func NewUnclaimedConnection(conn net.Conn, expireTime time.Duration) *unclaimedConnection {
func newUnclaimedConnection(conn net.Conn, expireTime time.Duration) *unclaimedConnection {
c := &unclaimedConnection{
Conn: conn,
}
+1 -1
View File
@@ -26,7 +26,7 @@ func TestCloudflareDetection(t *testing.T) {
headers := util.BrowserHeaders()
client.Transport = utlsx.NewUTLSHTTPRoundTripperWithProxy(
utls.HelloChrome_Auto, new(utls.Config),
http.DefaultTransport, nil, headers,
http.DefaultTransport, nil, &headers,
)
resp, err = doRequest(client, url)
if err != nil {