Files
curlx/options.go
T

35 lines
562 B
Go
Raw Normal View History

2024-01-01 14:10:18 +08:00
package curlx
import "time"
type clientOptions struct {
TimeOut time.Duration
InsecureSkipVerify bool
}
func defaultOptions() clientOptions {
return clientOptions{
TimeOut: time.Second * 120, // 默认超时120
}
}
type Option func(*clientOptions)
/**
* 设置超时时间
*/
func SetTimeOut(t time.Duration) Option {
return func(options *clientOptions) {
options.TimeOut = t
}
}
/**
* 不校验HTTPS证书
*/
func SetTLSInsecureSkipVerify() Option {
return func(options *clientOptions) {
options.InsecureSkipVerify = true
}
}