mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
34 lines
878 B
Go
34 lines
878 B
Go
package http
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"net"
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
defaultDialer = net.Dialer{
|
|
Timeout: 60 * time.Second,
|
|
}
|
|
DefaultTransport = &http.Transport{
|
|
Proxy: http.ProxyFromEnvironment,
|
|
DialContext: defaultDialer.DialContext,
|
|
ForceAttemptHTTP2: true,
|
|
MaxIdleConnsPerHost: 100,
|
|
IdleConnTimeout: 90 * time.Second,
|
|
TLSHandshakeTimeout: 10 * time.Second,
|
|
ExpectContinueTimeout: 1 * time.Second,
|
|
DisableCompression: true, // Prevent double compression
|
|
ResponseHeaderTimeout: 30 * time.Second,
|
|
WriteBufferSize: 16 * 1024, // 16KB
|
|
ReadBufferSize: 16 * 1024, // 16KB
|
|
}
|
|
DefaultTransportNoTLS = func() *http.Transport {
|
|
clone := DefaultTransport.Clone()
|
|
clone.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
|
|
return clone
|
|
}()
|
|
)
|
|
|
|
const StaticFilePathPrefix = "/$gperrorpage/"
|