Versions in this module Expand all Collapse all v0 v0.4.0 Oct 11, 2018 Changes in this version + var DefaultClient = NewClient("http://localhost:8888") + var DialBanTimeout = 200 * time.Millisecond + 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 (c *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 (m *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 (net *Network) Config() *NetworkConfig + func (net *Network) Connect(oneID, otherID discover.NodeID) error + func (net *Network) DidConnect(one, other discover.NodeID) error + func (net *Network) DidDisconnect(one, other discover.NodeID) error + func (net *Network) DidReceive(sender, receiver discover.NodeID, proto string, code uint64) error + func (net *Network) DidSend(sender, receiver discover.NodeID, proto string, code uint64) error + func (net *Network) Disconnect(oneID, otherID discover.NodeID) error + func (net *Network) Events() *event.Feed + func (net *Network) GetConn(oneID, otherID discover.NodeID) *Conn + func (net *Network) GetNode(id discover.NodeID) *Node + func (net *Network) GetNodeByName(name string) *Node + func (net *Network) GetNodes() (nodes []*Node) + func (net *Network) GetOrCreateConn(oneID, otherID discover.NodeID) (*Conn, error) + func (net *Network) InitConn(oneID, otherID discover.NodeID) (*Conn, error) + func (net *Network) Load(snap *Snapshot) error + func (net *Network) NewNodeWithConfig(conf *adapters.NodeConfig) (*Node, error) + func (net *Network) Reset() + func (net *Network) Shutdown() + func (net *Network) Snapshot() (*Snapshot, error) + func (net *Network) Start(id discover.NodeID) error + func (net *Network) StartAll() error + func (net *Network) Stop(id discover.NodeID) error + func (net *Network) StopAll() error + func (net *Network) Subscribe(events chan *Event) + type NetworkConfig struct + DefaultService string + ID string + type Node struct + Config *adapters.NodeConfig + Up bool + func (n *Node) ID() discover.NodeID + func (n *Node) MarshalJSON() ([]byte, error) + func (n *Node) NodeInfo() *p2p.NodeInfo + func (n *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