Documentation ¶
Index ¶
- Variables
- func ConnLabel(source, target discover.NodeID) string
- func GetMockerList() []string
- func LookupMocker(mockerType string) func(net *Network, quit chan struct{}, nodeCount int)
- type Client
- func (c *Client) ConnectNode(nodeID, peerID string) error
- func (c *Client) CreateNode(config *adapters.NodeConfig) (*p2p.NodeInfo, error)
- func (c *Client) CreateSnapshot() (*Snapshot, error)
- func (c *Client) Delete(path string) error
- func (c *Client) DisconnectNode(nodeID, peerID string) error
- func (c *Client) Get(path string, out interface{}) error
- func (c *Client) GetNetwork() (*Network, error)
- func (c *Client) GetNode(nodeID string) (*p2p.NodeInfo, error)
- func (c *Client) GetNodes() ([]*p2p.NodeInfo, error)
- func (c *Client) LoadSnapshot(snap *Snapshot) error
- func (c *Client) Post(path string, in, out interface{}) error
- func (c *Client) RPCClient(ctx context.Context, nodeID string) (*rpc.Client, error)
- func (c *Client) Send(method, path string, in, out interface{}) error
- func (c *Client) StartNetwork() error
- func (c *Client) StartNode(nodeID string) error
- func (c *Client) StopNetwork() error
- func (c *Client) StopNode(nodeID string) error
- func (c *Client) SubscribeNetwork(events chan *Event, opts SubscribeOpts) (event.Subscription, error)
- type Conn
- type Event
- type EventType
- type Expectation
- type Msg
- type MsgFilter
- type MsgFilters
- type Network
- func (self *Network) Config() *NetworkConfig
- func (self *Network) Connect(oneID, otherID discover.NodeID) error
- func (self *Network) DidConnect(one, other discover.NodeID) error
- func (self *Network) DidDisconnect(one, other discover.NodeID) error
- func (self *Network) DidReceive(sender, receiver discover.NodeID, proto string, code uint64) error
- func (self *Network) DidSend(sender, receiver discover.NodeID, proto string, code uint64) error
- func (self *Network) Disconnect(oneID, otherID discover.NodeID) error
- func (self *Network) Events() *event.Feed
- func (self *Network) GetConn(oneID, otherID discover.NodeID) *Conn
- func (self *Network) GetNode(id discover.NodeID) *Node
- func (self *Network) GetNodeByName(name string) *Node
- func (self *Network) GetNodes() (nodes []*Node)
- func (self *Network) GetOrCreateConn(oneID, otherID discover.NodeID) (*Conn, error)
- func (self *Network) InitConn(oneID, otherID discover.NodeID) (*Conn, error)
- func (self *Network) Load(snap *Snapshot) error
- func (self *Network) NewNode() (*Node, error)
- func (self *Network) NewNodeWithConfig(conf *adapters.NodeConfig) (*Node, error)
- func (self *Network) Reset()
- func (self *Network) Shutdown()
- func (self *Network) Snapshot() (*Snapshot, error)
- func (self *Network) Start(id discover.NodeID) error
- func (self *Network) StartAll() error
- func (self *Network) Stop(id discover.NodeID) error
- func (self *Network) StopAll() error
- func (self *Network) Subscribe(events chan *Event)
- type NetworkConfig
- type Node
- type NodeSnapshot
- type Server
- func (s *Server) ConnectNode(w http.ResponseWriter, req *http.Request)
- func (s *Server) CreateNode(w http.ResponseWriter, req *http.Request)
- func (s *Server) CreateSnapshot(w http.ResponseWriter, req *http.Request)
- func (s *Server) DELETE(path string, handle http.HandlerFunc)
- func (s *Server) DisconnectNode(w http.ResponseWriter, req *http.Request)
- func (s *Server) GET(path string, handle http.HandlerFunc)
- func (s *Server) GetMockers(w http.ResponseWriter, req *http.Request)
- func (s *Server) GetNetwork(w http.ResponseWriter, req *http.Request)
- func (s *Server) GetNode(w http.ResponseWriter, req *http.Request)
- func (s *Server) GetNodes(w http.ResponseWriter, req *http.Request)
- func (s *Server) JSON(w http.ResponseWriter, status int, data interface{})
- func (s *Server) LoadSnapshot(w http.ResponseWriter, req *http.Request)
- func (s *Server) NodeRPC(w http.ResponseWriter, req *http.Request)
- func (s *Server) OPTIONS(path string, handle http.HandlerFunc)
- func (s *Server) Options(w http.ResponseWriter, req *http.Request)
- func (s *Server) POST(path string, handle http.HandlerFunc)
- func (s *Server) ResetNetwork(w http.ResponseWriter, req *http.Request)
- func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (s *Server) StartMocker(w http.ResponseWriter, req *http.Request)
- func (s *Server) StartNetwork(w http.ResponseWriter, req *http.Request)
- func (s *Server) StartNode(w http.ResponseWriter, req *http.Request)
- func (s *Server) StopMocker(w http.ResponseWriter, req *http.Request)
- func (s *Server) StopNetwork(w http.ResponseWriter, req *http.Request)
- func (s *Server) StopNode(w http.ResponseWriter, req *http.Request)
- func (s *Server) StreamNetworkEvents(w http.ResponseWriter, req *http.Request)
- type Simulation
- type Snapshot
- type Step
- type StepResult
- type SubscribeOpts
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultClient = NewClient("http://localhost:8888")
Functions ¶
func GetMockerList ¶
func GetMockerList() []string
func LookupMocker ¶
Types ¶
type Client ¶
type Client struct { URL string // contains filtered or unexported fields }
func (*Client) ConnectNode ¶
func (*Client) CreateNode ¶
func (*Client) CreateSnapshot ¶
func (*Client) DisconnectNode ¶
func (*Client) GetNetwork ¶
func (*Client) LoadSnapshot ¶
func (*Client) StartNetwork ¶
func (*Client) StopNetwork ¶
func (*Client) SubscribeNetwork ¶
func (c *Client) SubscribeNetwork(events chan *Event, opts SubscribeOpts) (event.Subscription, error)
type Conn ¶
type Event ¶
type Event struct { Type EventType `json:"type"` Time time.Time `json:"time"` Control bool `json:"control"` Node *Node `json:"node,omitempty"` Conn *Conn `json:"conn,omitempty"` Msg *Msg `json:"msg,omitempty"` }
func ControlEvent ¶
func ControlEvent(v interface{}) *Event
type Expectation ¶
type Msg ¶
type MsgFilters ¶
type MsgFilters map[MsgFilter]struct{}
func NewMsgFilters ¶
func NewMsgFilters(filterParam string) (MsgFilters, error)
func (MsgFilters) Match ¶
func (m MsgFilters) Match(msg *Msg) bool
type Network ¶
type Network struct { NetworkConfig Nodes []*Node `json:"nodes"` Conns []*Conn `json:"conns"` // contains filtered or unexported fields }
func NewNetwork ¶
func NewNetwork(nodeAdapter adapters.NodeAdapter, conf *NetworkConfig) *Network
func (*Network) Config ¶
func (self *Network) Config() *NetworkConfig
func (*Network) DidDisconnect ¶
func (*Network) DidReceive ¶
func (*Network) GetNodeByName ¶
func (*Network) GetOrCreateConn ¶
func (*Network) NewNodeWithConfig ¶
func (self *Network) NewNodeWithConfig(conf *adapters.NodeConfig) (*Node, error)
type NetworkConfig ¶
type Node ¶
type Node struct { adapters.Node `json:"-"` Config *adapters.NodeConfig `json:"config"` Up bool `json:"up"` }
func (*Node) MarshalJSON ¶
type NodeSnapshot ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ConnectNode ¶
func (s *Server) ConnectNode(w http.ResponseWriter, req *http.Request)
func (*Server) CreateNode ¶
func (s *Server) CreateNode(w http.ResponseWriter, req *http.Request)
func (*Server) CreateSnapshot ¶
func (s *Server) CreateSnapshot(w http.ResponseWriter, req *http.Request)
func (*Server) DisconnectNode ¶
func (s *Server) DisconnectNode(w http.ResponseWriter, req *http.Request)
func (*Server) GetMockers ¶
func (s *Server) GetMockers(w http.ResponseWriter, req *http.Request)
func (*Server) GetNetwork ¶
func (s *Server) GetNetwork(w http.ResponseWriter, req *http.Request)
func (*Server) LoadSnapshot ¶
func (s *Server) LoadSnapshot(w http.ResponseWriter, req *http.Request)
func (*Server) ResetNetwork ¶
func (s *Server) ResetNetwork(w http.ResponseWriter, req *http.Request)
func (*Server) StartMocker ¶
func (s *Server) StartMocker(w http.ResponseWriter, req *http.Request)
func (*Server) StartNetwork ¶
func (s *Server) StartNetwork(w http.ResponseWriter, req *http.Request)
func (*Server) StopMocker ¶
func (s *Server) StopMocker(w http.ResponseWriter, req *http.Request)
func (*Server) StopNetwork ¶
func (s *Server) StopNetwork(w http.ResponseWriter, req *http.Request)
func (*Server) StreamNetworkEvents ¶
func (s *Server) StreamNetworkEvents(w http.ResponseWriter, req *http.Request)
type Simulation ¶
type Simulation struct {
// contains filtered or unexported fields
}
func NewSimulation ¶
func NewSimulation(network *Network) *Simulation
func (*Simulation) Run ¶
func (s *Simulation) Run(ctx context.Context, step *Step) (result *StepResult)
type Snapshot ¶
type Snapshot struct { Nodes []NodeSnapshot `json:"nodes,omitempty"` Conns []Conn `json:"conns,omitempty"` }
type StepResult ¶
type SubscribeOpts ¶
Click to show internal directories.
Click to hide internal directories.