Documentation ¶
Overview ¶
Package model 数据模型
Package model 请求数据模型package model
Index ¶
- Constants
- func RegisterVerifyHTTP(verify string, verifyFunc VerifyHTTP)
- func RegisterVerifyWebSocket(verify string, verifyFunc VerifyWebSocket)
- type CURL
- type Request
- func (r *Request) CopyHeaders() map[string]string
- func (r *Request) GetBody() (body io.Reader)
- func (r *Request) GetDebug() bool
- func (r *Request) GetVerifyHTTP() VerifyHTTP
- func (r *Request) GetVerifyWebSocket() VerifyWebSocket
- func (r *Request) IsParameterLegal() (err error)
- func (r *Request) Print()
- type RequestResults
- type Verify
- type VerifyHTTP
- type VerifyWebSocket
Constants ¶
View Source
const ( // HTTPOk 请求成功 HTTPOk = 200 // RequestErr 请求错误 RequestErr = 509 // ParseError 解析错误 ParseError = 510 // 解析错误 )
返回 code 码
View Source
const ( // FormTypeHTTP http 协议 FormTypeHTTP = "http" // FormTypeWebSocket webSocket 协议 FormTypeWebSocket = "webSocket" // FormTypeGRPC grpc 协议 FormTypeGRPC = "grpc" FormTypeRadius = "radius" )
支持协议
Variables ¶
This section is empty.
Functions ¶
func RegisterVerifyHTTP ¶
func RegisterVerifyHTTP(verify string, verifyFunc VerifyHTTP)
RegisterVerifyHTTP 注册 http 校验函数
func RegisterVerifyWebSocket ¶
func RegisterVerifyWebSocket(verify string, verifyFunc VerifyWebSocket)
RegisterVerifyWebSocket 注册 webSocket 校验函数
Types ¶
type Request ¶
type Request struct { URL string // URL Form string // http/webSocket/tcp Method string // 方法 GET/POST/PUT Headers map[string]string // Headers Body string // body Verify string // 验证的方法 Timeout time.Duration // 请求超时时间 Debug bool // 是否开启Debug模式 MaxCon int // 每个连接的请求数 HTTP2 bool // 是否使用http2.0 Keepalive bool // 是否开启长连接 Code int // 验证的状态码 Redirect bool // 是否重定向 }
Request 请求数据
func NewRequest ¶
func NewRequest(url string, verify string, code int, timeout time.Duration, debug bool, path string, reqHeaders []string, reqBody string, maxCon int, http2, keepalive, redirect bool) (request *Request, err error)
NewRequest 生成请求结构体 url 压测的url verify 验证方法 在server/verify中 http 支持:statusCode、json webSocket支持:json timeout 请求超时时间 debug 是否开启debug path curl文件路径 http接口压测,自定义参数设置
func (*Request) CopyHeaders ¶ added in v1.0.17
CopyHeaders copy Headers
func (*Request) GetVerifyWebSocket ¶
func (r *Request) GetVerifyWebSocket() VerifyWebSocket
GetVerifyWebSocket 获取数据校验方法
func (*Request) IsParameterLegal ¶
IsParameterLegal 参数是否合法
type RequestResults ¶
type RequestResults struct { ID string // 消息ID ChanID uint64 // 消息ID Time uint64 // 请求时间 纳秒 IsSucceed bool // 是否请求成功 ErrCode int // 错误码 ReceivedBytes int64 }
RequestResults 请求结果
func (*RequestResults) SetID ¶
func (r *RequestResults) SetID(chanID uint64, number uint64)
SetID 设置请求唯一ID
Click to show internal directories.
Click to hide internal directories.