aliyun / alibaba-cloud-sdk-go

Alibaba Cloud SDK for Go
Apache License 2.0
1.16k stars 271 forks source link

自定义Transport里的DialContext被内部timeout设置覆盖 #560

Closed cinience closed 2 years ago

cinience commented 2 years ago

` 问题代码在: github.com/aliyun/alibaba-cloud-sdk-go/sdk/client.go 的方法: func (client *Client) setTimeout(request requests.AcsRequest)

`

调用代码如下:

var SpecifiDnsServerTransport http.Transport = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 time.Second, KeepAlive: 30 time.Second, Resolver: &net.Resolver{PreferGo: true, Dial: func(ctx context.Context, network, address string) (net.Conn, error) { d := net.Dialer{} address = "223.5.5.5:53" return d.DialContext(ctx, network, address) }}, }).DialContext, ForceAttemptHTTP2: true, MaxIdleConns: 100, IdleConnTimeout: 90 time.Second, TLSHandshakeTimeout: 10 time.Second, ExpectContinueTimeout: 1 time.Second, }

config := sdk.NewConfig()
config.HttpTransport = SpecifiDnsServerTransport
yndu13 commented 2 years ago

您好,暂时还未有 DialContext 的支持计划。