Documentation ¶
Index ¶
- Constants
- func DecodeCSV(data string) ([]string, error)
- func DecodeTTY(data string) ([]string, error)
- func EncodeCSV(data ...interface{}) string
- func EncodeTTY(data ...interface{}) string
- func FlatJSON(data interface{}) map[string]string
- func Init()
- func RecordAction(ctx context.Context, protocol string, action *SimpleAction)
- func RecordInbound(ctx context.Context, protocol string, inbound *SimpleAction)
- func RecordMode() bool
- func RegisterProtocol(name string, protocol Protocol)
- func SetRecordMode(mode bool)
- func StartRecord(ctx context.Context, fn func() (string, error))
- func ToJson(v interface{}) string
- func ToJsonE(v interface{}) ([]byte, error)
- func ToJsonValue(v reflect.Value) string
- func ToPrettyJson(v interface{}) string
- func ToPrettyJsonE(v interface{}) ([]byte, error)
- type Action
- type HttpTransport
- type Message
- type Protocol
- type RawAction
- type RawSession
- type Recorder
- type Session
- type SimpleAction
Constants ¶
View Source
const ( CACHE = "CACHE" HTTP = "HTTP" SQL = "SQL" REDIS = "REDIS" )
Variables ¶
This section is empty.
Functions ¶
func EncodeCSV ¶
func EncodeCSV(data ...interface{}) string
EncodeCSV 将数据转换为 CSV 格式,可用于 redis 结果格式化。
func RecordAction ¶
func RecordAction(ctx context.Context, protocol string, action *SimpleAction)
RecordAction 录制 outbound 流量。
func RecordInbound ¶
func RecordInbound(ctx context.Context, protocol string, inbound *SimpleAction)
RecordInbound 录制 inbound 流量。
func RegisterProtocol ¶
func StartRecord ¶
StartRecord 开始流量录制
func ToJsonValue ¶
func ToPrettyJson ¶
func ToPrettyJson(v interface{}) string
func ToPrettyJsonE ¶
Types ¶
type HttpTransport ¶
type HttpTransport struct {
Transport http.RoundTripper
}
type Protocol ¶
type Protocol interface { GetLabel(data string) string FlatRequest(data string) (map[string]string, error) FlatResponse(data string) (map[string]string, error) }
func GetProtocol ¶
type RawSession ¶
type RawSession struct { Session string `json:",omitempty"` // 会话 ID Timestamp int64 `json:",omitempty"` // 时间戳 Inbound *RawAction `json:",omitempty"` // 上游数据 Actions []*RawAction `json:",omitempty"` // 动作数据 }
func ToRawSession ¶
func ToRawSession(data string) (*RawSession, error)
Click to show internal directories.
Click to hide internal directories.