Documentation ¶
Index ¶
- Constants
- func BestQuery(ctx context.Context, protocol, request string) (response string, ok bool, err error)
- func GetSessionID(ctx context.Context) (string, error)
- func Query(ctx context.Context, protocol, request string) (response string, ok bool, err error)
- func ReplayMode() bool
- func SetReplayAgent(agent Agent)
- func SetReplayMode(enable bool)
- func SetSessionID(ctx context.Context, sessionID string) error
- type Action
- type Agent
- type HttpTransport
- type LocalAgent
- type MatchStrategy
- type RemoteAgent
- type Session
Constants ¶
View Source
const ( ExactMatch = MatchStrategy(0) // 精确匹配 BestMatch = MatchStrategy(1) // 最佳匹配 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct { Protocol string `json:",omitempty"` // 协议名称 Timestamp int64 `json:",omitempty"` // 时间戳 Request string `json:",omitempty"` // 请求内容 Response string `json:",omitempty"` // 响应内容 FlatRequest map[string]string `json:",omitempty"` FlatResponse map[string]string `json:",omitempty"` RecTimestamp int64 `json:",omitempty"` // 时间戳 RecRequest string `json:",omitempty"` // 请求内容 RecResponse string `json:",omitempty"` // 响应内容 RecFlatRequest map[string]string `json:",omitempty"` RecFlatResponse map[string]string `json:",omitempty"` }
type HttpTransport ¶
type HttpTransport struct {
Transport http.RoundTripper
}
type LocalAgent ¶
type LocalAgent struct {
// contains filtered or unexported fields
}
func NewLocalAgent ¶
func NewLocalAgent() *LocalAgent
func (*LocalAgent) Delete ¶
func (agent *LocalAgent) Delete(sessionID string) error
Delete 删除 sessionID 对应的回放数据。
func (*LocalAgent) QueryAction ¶
func (agent *LocalAgent) QueryAction(ctx context.Context, protocol, request string, matchStrategy MatchStrategy) (response string, ok bool, err error)
type MatchStrategy ¶
type MatchStrategy int
type RemoteAgent ¶
type RemoteAgent struct { }
func (*RemoteAgent) QueryAction ¶
func (agent *RemoteAgent) QueryAction(ctx context.Context, protocol, request string, matchStrategy MatchStrategy) (response string, ok bool, err error)
Click to show internal directories.
Click to hide internal directories.