Versions in this module Expand all Collapse all v1 v1.8.0 Feb 14, 2018 Changes in this version + var DefaultClient = NewClient("http://localhost:8888") + func ConnLabel(source, target discover.NodeID) string + func GetMockerList() []string + func LookupMocker(mockerType string) func(net *Network, quit chan struct{}, nodeCount int) + type Client struct + URL string + func NewClient(url string) *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 struct + One discover.NodeID + Other discover.NodeID + Up bool + func (self *Conn) String() string + type Event struct + Conn *Conn + Control bool + Msg *Msg + Node *Node + Time time.Time + Type EventType + func ControlEvent(v interface{}) *Event + func NewEvent(v interface{}) *Event + func (e *Event) String() string + type EventType string + const EventTypeConn + const EventTypeMsg + const EventTypeNode + type Expectation struct + Check func(context.Context, discover.NodeID) (bool, error) + Nodes []discover.NodeID + type Msg struct + Code uint64 + One discover.NodeID + Other discover.NodeID + Protocol string + Received bool + func (self *Msg) String() string + type MsgFilter struct + Code int64 + Proto string + type MsgFilters map[MsgFilter]struct + func NewMsgFilters(filterParam string) (MsgFilters, error) + func (m MsgFilters) Match(msg *Msg) bool + type Network struct + Conns []*Conn + Nodes []*Node + func NewNetwork(nodeAdapter adapters.NodeAdapter, conf *NetworkConfig) *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 struct + DefaultService string + ID string + type Node struct + Config *adapters.NodeConfig + Up bool + func (self *Node) ID() discover.NodeID + func (self *Node) MarshalJSON() ([]byte, error) + func (self *Node) NodeInfo() *p2p.NodeInfo + func (self *Node) String() string + type NodeSnapshot struct + Node Node + Snapshots map[string][]byte + type Server struct + func NewServer(network *Network) *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 struct + func NewSimulation(network *Network) *Simulation + func (s *Simulation) Run(ctx context.Context, step *Step) (result *StepResult) + type Snapshot struct + Conns []Conn + Nodes []NodeSnapshot + type Step struct + Action func(context.Context) error + Expect *Expectation + Trigger chan discover.NodeID + type StepResult struct + Error error + FinishedAt time.Time + NetworkEvents []*Event + Passes map[discover.NodeID]time.Time + StartedAt time.Time + type SubscribeOpts struct + Current bool + Filter string