base

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package base

Package base

Index

Constants

View Source
const (
	HeaderDefaultLength = 4
	BodyDefaultLength   = 1024
)

Variables

View Source
var Clients = make(map[Protocol]Client)

已经实现的协议池

Functions

func Register

func Register(pt Protocol, c Client)

Types

type AW

type AW struct {
	Req Request
	Res Response
}

type AWResult

type AWResult struct {
	Id            string
	Name          string
	Result        bool
	ReqBegin      int64
	RespTime      int64
	TransactionId string
	LogInfo       []interface{}
	AW
}

请求响应

func NewAWResult

func NewAWResult() *AWResult

func (*AWResult) Release

func (aw *AWResult) Release()

type BaseCase

type BaseCase struct {
	PodId    int
	PodCount int
	Clients  map[Protocol]Client
}

type Client

type Client interface {
	SetLogger(Logger)
	Logger
	Exec(*AWResult)
}

协议接口

type End

type End struct {
	Type   uint8
	Length int
	Char   string
}

type Logger

type Logger interface {
	Debug(format string)
	Debugf(format string, v ...interface{})
	Info(format string)
	Infof(format string, v ...interface{})
	Error(format string)
	Errorf(format string, v ...interface{})
}

日志接口

type PluginFunc

type PluginFunc interface {
	SetBase(*BaseCase)
	Setup()
	Test()
	TearDown()
}

插件系统的解析对接接口

type Protocol

type Protocol string
const (
	Http Protocol = "HTTP"
	Tcp  Protocol = "TCP"
	Udp  Protocol = "UDP"
)

协议

type Request

type Request struct {
	Method           string
	Url              string
	Header           map[string]string
	HeaderLen        int
	Body             string
	RedirectsEnabled bool
	TimeOut
	End
}

type Response

type Response struct {
	Header     map[string]string
	HeaderLen  int
	Body       string
	ErrReason  string
	StatusCode int
}

type TimeOut

type TimeOut struct {
	Connect int64
	Write   int64
	Read    int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL