Increase timeouts

This commit is contained in:
世界 2024-10-30 13:09:05 +08:00
parent 419058f466
commit 8c143feec8
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
6 changed files with 12 additions and 10 deletions

View file

@ -17,8 +17,8 @@ import (
"os"
"strconv"
"sync"
"time"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/bufio"
E "github.com/sagernet/sing/common/exceptions"
@ -69,8 +69,9 @@ type httpClient struct {
func NewHTTPClient() HTTPClient {
client := new(httpClient)
client.client.Timeout = 15 * time.Second
client.client.Transport = &client.transport
client.transport.ForceAttemptHTTP2 = true
client.transport.TLSHandshakeTimeout = C.TCPTimeout
client.transport.TLSClientConfig = &client.tls
client.transport.DisableKeepAlives = true
return client
@ -127,7 +128,6 @@ func (c *httpClient) TrySocks5(port int32) {
}
func (c *httpClient) KeepAlive() {
c.transport.ForceAttemptHTTP2 = true
c.transport.DisableKeepAlives = false
}