1 Star 2 Fork 0

api-go/iris

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
client.go 662 Bytes
一键复制 编辑 原始数据 按行查看 历史
kataras 提交于 2017-08-10 20:21 +08:00 . Update to 8.2.2 | Google reCAPTCHA. Read HISTORY.md
package netutil
import (
"net"
"net/http"
"time"
"github.com/kataras/golog"
)
// Client returns a new http.Client using
// the "timeout" for open connection and read-write operations.
func Client(timeout time.Duration) *http.Client {
transport := http.Transport{
Dial: func(network string, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(network, addr, timeout)
if err != nil {
golog.Debugf("%v", err)
return nil, err
}
if err = conn.SetDeadline(time.Now().Add(timeout)); err != nil {
golog.Debugf("%v", err)
}
return conn, err
},
}
client := &http.Client{
Transport: &transport,
}
return client
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/netscript/iris.git
git@gitee.com:netscript/iris.git
netscript
iris
iris
v8.4.2

搜索帮助