replay

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConnGroupConfig = ConnectionGroupConfig{
	ConnectionNumber:         1,
	ActionIntervalMultiplier: 1,
	WaitAuthSuccess:          true,
	AuthOnlyOnce:             true,
}

Functions

func ReadReplaySessionFile

func ReadReplaySessionFile(cprPath string) (*replaypb.ReplaySession, error)

Types

type AlterChannelIdBeforeSendHandlerFunc

type AlterChannelIdBeforeSendHandlerFunc func(channelId uint32, msgType channeldpb.MessageType, msgPack *channeldpb.MessagePack, c *client.ChanneldClient) (chId uint32, needToSend bool)

type BeforeSendMessageHandlerFunc

type BeforeSendMessageHandlerFunc func(msg proto.Message, msgPack *channeldpb.MessagePack, c *client.ChanneldClient) (needToSend bool)

type CaseConfig

type CaseConfig struct {
	ChanneldAddr     string                  `json:"channeldAddr"`
	ConnectionGroups []ConnectionGroupConfig `json:"connectionGroups"`
}

type ConnectionGroup

type ConnectionGroup struct {
	// contains filtered or unexported fields
}

type ConnectionGroupConfig

type ConnectionGroupConfig struct {
	CprFilePath              string   `json:"cprFilePath"`
	ConnectionNumber         int      `json:"connectionNumber"`         // Number of connections
	ConnectInterval          Duration `json:"connectInterval"`          // start connections interval
	RunningTime              Duration `json:"runningTime"`              // replay session running time
	SleepEndOfSession        Duration `json:"sleepEndOfSession"`        // sleep each end of session
	MaxTickInterval          Duration `json:"maxTickInterval"`          // channeld connection max tick time
	ActionIntervalMultiplier float64  `json:"actionIntervalMultiplier"` // used to adjust the packet offsettime (ActionIntervalMultiplier * ReplayPacket.Offsettime)
	WaitAuthSuccess          bool     `json:"waitAuthSuccess"`          // if true, replay loop will wait for auth success
	AuthOnlyOnce             bool     `json:"authOnlyOnce"`             // if true, only send auth message once in the entire replay
}

type Duration

type Duration time.Duration

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type MessageHandlerFunc

type MessageHandlerFunc func(c *client.ChanneldClient, channelId uint32, m proto.Message)

type NeedWaitMessageCallbackHandlerFunc

type NeedWaitMessageCallbackHandlerFunc func(msgType channeldpb.MessageType, msgPack *channeldpb.MessagePack, c *client.ChanneldClient) bool

type ReplayClient

type ReplayClient struct {
	CaseConfig       CaseConfig
	ConnectionGroups []ConnectionGroup
	// contains filtered or unexported fields
}

func CreateReplayClientByConfigFile

func CreateReplayClientByConfigFile(configPath string) (*ReplayClient, error)

func (*ReplayClient) AddMessageHandler

func (rc *ReplayClient) AddMessageHandler(msgType channeldpb.MessageType, handlers ...MessageHandlerFunc)

func (*ReplayClient) LoadCaseConfig

func (rc *ReplayClient) LoadCaseConfig(path string) error

func (*ReplayClient) Run

func (rc *ReplayClient) Run()

func (*ReplayClient) SetAlterChannelIdBeforeSendHandler

func (rc *ReplayClient) SetAlterChannelIdBeforeSendHandler(handler AlterChannelIdBeforeSendHandlerFunc)

func (*ReplayClient) SetBeforeSendMessageEntry

func (rc *ReplayClient) SetBeforeSendMessageEntry(msgType channeldpb.MessageType, msgTemp proto.Message, handler BeforeSendMessageHandlerFunc)

func (*ReplayClient) SetMessageEntry

func (rc *ReplayClient) SetMessageEntry(msgType uint32, msgTemp proto.Message, handlers ...MessageHandlerFunc)

func (*ReplayClient) SetNeedWaitMessageCallback

func (rc *ReplayClient) SetNeedWaitMessageCallback(handler NeedWaitMessageCallbackHandlerFunc)

Jump to

Keyboard shortcuts

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