Documentation ¶
Index ¶
- func BlackHole(r io.Reader)
- type Client
- type HTTPClient
- type NopRSCloser
- type Option
- func WithContentLength(s int64) Option
- func WithContext(c context.Context) Option
- func WithCredential(instance auth.Auth, ttl int64) Option
- func WithEndpoint(endpoint string) Option
- func WithHeader(header http.Header) Option
- func WithMasterMeta() Option
- func WithSlaveMeta(s string) Option
- func WithTPSLimit(token string, tps float64, burst int) Option
- func WithTimeout(t time.Duration) Option
- func WithoutHeader(header []string) Option
- type Response
- type TPSLimiter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient 实现 Client 接口
type NopRSCloser ¶
type NopRSCloser struct {
// contains filtered or unexported fields
}
NopRSCloser 实现不完整seeker
func (NopRSCloser) Read ¶
func (instance NopRSCloser) Read(p []byte) (n int, err error)
Read 实现 NopRSCloser reader
func (NopRSCloser) Seek ¶
func (instance NopRSCloser) Seek(offset int64, whence int) (int64, error)
Seek 实现 NopRSCloser seeker, 只实现seek开头/结尾以便http.ServeContent用于确定正文大小
func (NopRSCloser) SetContentLength ¶
func (instance NopRSCloser) SetContentLength(size int64)
SetContentLength 设置数据流大小
func (NopRSCloser) SetFirstFakeChunk ¶
func (instance NopRSCloser) SetFirstFakeChunk()
SetFirstFakeChunk 开启第一次read返回空数据 TODO 测试
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option 发送请求的额外设置
func WithCredential ¶
WithCredential 对请求进行签名
func WithTPSLimit ¶
WithTPSLimit 请求时使用全局流量限制
type Response ¶
Response 请求的响应或错误信息
func (*Response) CheckHTTPResponse ¶
CheckHTTPResponse 检查请求响应HTTP状态码
func (*Response) DecodeResponse ¶
func (resp *Response) DecodeResponse() (*serializer.Response, error)
DecodeResponse 尝试解析为serializer.Response,并对状态码进行检查
func (*Response) GetRSCloser ¶
func (resp *Response) GetRSCloser() (*NopRSCloser, error)
GetRSCloser 返回带有空seeker的RSCloser,供http.ServeContent使用
func (*Response) GetResponse ¶
GetResponse 检查响应并获取响应正文
type TPSLimiter ¶
func NewTPSLimiter ¶
func NewTPSLimiter() TPSLimiter
Click to show internal directories.
Click to hide internal directories.