MCPcopy Create free account
hub / github.com/chainreactors/spray / customDialFunc

Function customDialFunc

core/ihttp/client.go:126–137  ·  view source on GitHub ↗
(dialer proxyclient.Dial, timeout time.Duration)

Source from the content-addressed store, hash-verified

124}
125
126func customDialFunc(dialer proxyclient.Dial, timeout time.Duration) fasthttp.DialFunc {
127 if dialer == nil {
128 return func(addr string) (net.Conn, error) {
129 return fasthttp.DialTimeout(addr, timeout)
130 }
131 }
132 return func(addr string) (net.Conn, error) {
133 ctx, cancel := context.WithTimeout(context.Background(), timeout)
134 defer cancel()
135 return dialer.DialContext(ctx, "tcp", addr)
136 }
137}

Callers 1

NewClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected