Documentation
¶
Index ¶
- Constants
- type Component
- type Config
- type Container
- type Option
- func WithAddr(addr string) Option
- func WithDebug(debug bool) Option
- func WithEnableAccessInterceptor(enableAccessInterceptor bool) Option
- func WithEnableAccessInterceptorRes(enableAccessInterceptorRes bool) Option
- func WithEnableKeepAlives(enableKeepAlives bool) Option
- func WithEnableTraceInterceptor(enableTraceInterceptor bool) Option
- func WithIdleConnTimeout(idleConnTimeout time.Duration) Option
- func WithMaxIdleConns(maxIdleConns int) Option
- func WithMaxIdleConnsPerHost(maxIdleConnsPerHost int) Option
- func WithRawDebug(rawDebug bool) Option
- func WithReadTimeout(readTimeout time.Duration) Option
- func WithSlowLogThreshold(slowLogThreshold time.Duration) Option
Constants ¶
View Source
const PackageName = "client.ehttp"
PackageName 设置包名
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Addr string // 连接地址
Debug bool // 是否开启调试,默认不开启,开启后并加上export EGO_DEBUG=true,可以看到每次请求,配置名、地址、耗时、请求数据、响应数据
RawDebug bool // 是否开启原生调试,默认不开启
ReadTimeout time.Duration // 读超时,默认2s
SlowLogThreshold time.Duration // 慢日志记录的阈值,默认500ms
IdleConnTimeout time.Duration // 设置空闲连接时间,默认90 * time.Second
MaxIdleConns int // 设置最大空闲连接数
MaxIdleConnsPerHost int // 设置长连接个数
EnableTraceInterceptor bool // 是否开启链路追踪,默认开启
EnableKeepAlives bool // 是否开启长连接,默认打开
EnableAccessInterceptor bool // 是否开启记录请求数据,默认不开启
EnableAccessInterceptorRes bool // 是否开启记录响应参数,默认不开启
}
Config HTTP配置选项
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
Container defines a component instance.
func DefaultContainer ¶
func DefaultContainer() *Container
DefaultContainer returns an default container.
type Option ¶
type Option func(c *Container)
Option 选项
func WithEnableAccessInterceptor ¶
WithEnableAccessInterceptor 设置开启请求日志
func WithEnableAccessInterceptorRes ¶
WithEnableAccessInterceptorRes 设置开启请求日志响应参数
func WithEnableKeepAlives ¶
WithEnableKeepAlives 设置是否开启长连接,默认打开
func WithEnableTraceInterceptor ¶
WithEnableTraceInterceptor 设置开启Trace拦截器
func WithIdleConnTimeout ¶
WithIdleConnTimeout 设置空闲连接时间
func WithMaxIdleConnsPerHost ¶
WithMaxIdleConnsPerHost 设置长连接个数
func WithSlowLogThreshold ¶
WithSlowLogThreshold 设置慢日志阈值
Click to show internal directories.
Click to hide internal directories.