Documentation
¶
Overview ¶
Package controller implements the DSNet network controller with testing capabilities. It manages node registrations, message forwarding, and network partitions. It also provides functions to manipulate message delivery according to testing configurations. These include dropping, duplicating, and reordering messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Serve ¶
func Serve(cfg TestConfig)
Serve starts the gRPC server for the DSNet controller with the given test configuration. Server listens on port 50051.
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a DSNet node that can send messages via the controller.
type Server ¶
type Server struct {
pb.UnimplementedNetworkControllerServer
// contains filtered or unexported fields
}
Server implements the DSNet network controller with testing capabilities.
func NewServer ¶ added in v0.0.6
func NewServer(cfg TestConfig) *Server
newServer creates a new DSNet controller server with the specified test configuration.
func (*Server) BlockCommunication ¶
BlockCommunication blocks messages from node a to node b.
func (*Server) CreatePartition ¶
CreatePartition creates a partition between two groups of nodes. Nodes in group1 cannot communicate with nodes in group2 and vice versa.
func (*Server) Stream ¶
func (s *Server) Stream(stream pb.NetworkController_StreamServer) error
Stream handles the bi-directional streaming RPC between the controller and a node.
func (*Server) UnblockCommunication ¶
UnblockCommunication unblocks messages from node a to node b.
type TestConfig ¶ added in v0.0.6
type TestConfig struct {
MsgDropProb float64
MsgDupeProb float64
AsyncDuplicate bool
DisableMessageDelays bool
MsgMinDelay int
MsgMaxDelay int
//Network Spikes
EnableNetworkSpikes bool
NetSpikeSmallProb float64
NetSpikeMedProb float64
NetSpikeLargeProb float64
}
TestConfig holds the configuration parameters for simulating network messaging conditions. These include probabilities for message drops, duplications, and reordering, as well as parameters for reordering delays.
func (*TestConfig) FillDefaults ¶ added in v0.0.13
func (cfg *TestConfig) FillDefaults()
FillDefaults fills in default values for TestConfig fields if they are not set.