Documentation
¶
Index ¶
- Constants
- func GenerateTlsConfig(host string, rootCA *x509.Certificate, rootKey *rsa.PrivateKey) (*tls.Config, error)
- type BenchmarkExecDuration
- type BenchmarkExecTimes
- type BenchmarkExecutor
- type BenchmarkExecutorType
- type BenchmarkProxyHeader
- type BenchmarkProxyService
- type BenchmarkReqConfig
- type BenchmarkRespWriter
- type DurationInfo
- type Executor
- type HttpTracer
- type HttpTracerResult
- type Pair
- type Pool
- type ResponseCheckOption
- type ResponseChecker
- type Statistic
- type TagCompoundParser
- type Task
Constants ¶
View Source
const ( TagUUID = "uuid" TagInt = "int" TagString = "string" TagFloat = "float" TagIncr = "incr" TagList = "list:" TagRange = "range:" )
View Source
const ( DebugRequestMessageFormat = "Request Message : %+v \n" DebugRequestErrorFormat = "Request Error : %s \n" DebugResponseMessageFormat = "Response Message : %s \n" )
Variables ¶
This section is empty.
Functions ¶
func GenerateTlsConfig ¶
func GenerateTlsConfig(host string, rootCA *x509.Certificate, rootKey *rsa.PrivateKey) (*tls.Config, error)
Types ¶
type BenchmarkExecDuration ¶
type BenchmarkExecDuration struct { BenchmarkReqConfig Executor // contains filtered or unexported fields }
func (*BenchmarkExecDuration) Run ¶
func (exec *BenchmarkExecDuration) Run() error
type BenchmarkExecTimes ¶
type BenchmarkExecTimes struct { BenchmarkReqConfig Executor // contains filtered or unexported fields }
func (*BenchmarkExecTimes) Run ¶
func (exec *BenchmarkExecTimes) Run() error
type BenchmarkExecutor ¶
type BenchmarkExecutor interface { Run() error // using goroutine pool ClearHopHeaders(header http.Header) http.Header Result() *Statistic }
func NewExecutor ¶
func NewExecutor(req *http.Request) BenchmarkExecutor
type BenchmarkExecutorType ¶
type BenchmarkExecutorType int
type BenchmarkProxyHeader ¶
type BenchmarkProxyHeader struct { ExecTimes int ExecDuration time.Duration ExecConcurrency int ResponseChecker *ResponseChecker }
func NewProxyHeader ¶
func NewProxyHeader(header http.Header) *BenchmarkProxyHeader
type BenchmarkProxyService ¶
type BenchmarkProxyService struct {
// contains filtered or unexported fields
}
func NewBenchProxyService ¶
func NewBenchProxyService(port int, rootCA *x509.Certificate, rootKey *rsa.PrivateKey) *BenchmarkProxyService
func (*BenchmarkProxyService) Serve ¶
func (s *BenchmarkProxyService) Serve()
func (*BenchmarkProxyService) ServeHTTP ¶
func (s *BenchmarkProxyService) ServeHTTP(originRespWriter http.ResponseWriter, originReq *http.Request)
func (*BenchmarkProxyService) WrapInTls ¶
func (s *BenchmarkProxyService) WrapInTls(originReq *http.Request, originRespWriter http.ResponseWriter, fn func(originReq *http.Request, originRespWriter http.ResponseWriter))
type BenchmarkReqConfig ¶
type BenchmarkReqConfig struct {
// contains filtered or unexported fields
}
func (*BenchmarkReqConfig) ClearHopHeaders ¶
func (config *BenchmarkReqConfig) ClearHopHeaders(originHeader http.Header) http.Header
type BenchmarkRespWriter ¶
func (*BenchmarkRespWriter) Header ¶
func (t *BenchmarkRespWriter) Header() http.Header
func (*BenchmarkRespWriter) WriteHeader ¶
func (t *BenchmarkRespWriter) WriteHeader(statusCode int)
type DurationInfo ¶ added in v0.0.26
type DurationInfo struct { Total int64 DNSLookup int64 TCPConnection int64 TLSHandshake int64 ServerProcessing int64 ContentTransfer int64 }
func NewDurationInfo ¶ added in v0.0.26
func NewDurationInfo(t *HttpTracer) DurationInfo
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func (*Executor) ReplaceCustomizeTag ¶
func (exec *Executor) ReplaceCustomizeTag(urlParser, bodyParser *TagCompoundParser, req *http.Request)
func (*Executor) RunOnce ¶
func (exec *Executor) RunOnce(req *http.Request, checker *ResponseChecker) (HttpTracerResult, error)
type HttpTracer ¶
type HttpTracer struct { DNSStart time.Time DNSDone time.Time ConnectStart time.Time ConnectDone time.Time GotConn time.Time GotFirstResponseByte time.Time TLSHandShakeStart time.Time TLSHandSHakeDone time.Time }
func (*HttpTracer) Result ¶
func (t *HttpTracer) Result(req *http.Request, resp *http.Response, checker *ResponseChecker) HttpTracerResult
func (*HttpTracer) Trace ¶
func (t *HttpTracer) Trace() *httptrace.ClientTrace
type HttpTracerResult ¶
type HttpTracerResult struct { IsSuccess bool ResponseMessage string RequestDataLen int64 ResponseDataLen int64 Duration DurationInfo }
type Pair ¶
type Pair struct { Cert *x509.Certificate CertBytes []byte PrivateKey *rsa.PrivateKey PrivateKeyBytes []byte }
func GeneratePem ¶
func GeneratePem(host string, expireDay int, rootCA *x509.Certificate, rootKey *rsa.PrivateKey) (*Pair, error)
GeneratePem 生成证书
type ResponseCheckOption ¶ added in v0.0.24
type ResponseCheckOption func(checker *ResponseChecker)
func ResponseCheckerBodyRule ¶ added in v0.0.24
func ResponseCheckerBodyRule(body string) ResponseCheckOption
func ResponseCheckerStatusRule ¶ added in v0.0.24
func ResponseCheckerStatusRule(status int) ResponseCheckOption
type ResponseChecker ¶ added in v0.0.24
type ResponseChecker struct {
// contains filtered or unexported fields
}
func NewResponseChecker ¶ added in v0.0.24
func NewResponseChecker(options ...ResponseCheckOption) *ResponseChecker
type Statistic ¶
type Statistic struct { Durations []DurationInfo SuccessCount int32 FailCount int32 Total int32 // contains filtered or unexported fields }
func (*Statistic) Aggregate ¶
func (s *Statistic) Aggregate(tracerResultChan <-chan HttpTracerResult)
type TagCompoundParser ¶
type TagCompoundParser struct {
// contains filtered or unexported fields
}
func NewTagCompoundParser ¶
func NewTagCompoundParser() *TagCompoundParser
func (*TagCompoundParser) ParseCustomizeTag ¶
func (p *TagCompoundParser) ParseCustomizeTag(content string) string
Click to show internal directories.
Click to hide internal directories.