Versions in this module Expand all Collapse all v1 v1.0.6 Apr 12, 2022 Changes in this version + var DefaultClient = NewClient("http://localhost:8888") + var DialBanTimeout = 200 * time.Millisecond + var ErrNodeNotFound = errors.New("node not found") + func ConnLabel(source, target enode.ID) string + func GetMockerList() []string + func LookupMocker(mockerType string) func(net *Network, quit chan struct{}, nodeCount int) + func VerifyChain(t *testing.T, net *Network, ids []enode.ID) + func VerifyFull(t *testing.T, net *Network, ids []enode.ID) + func VerifyRing(t *testing.T, net *Network, ids []enode.ID) + func VerifyStar(t *testing.T, net *Network, ids []enode.ID, centerIndex 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 enode.ID + Other enode.ID + Up bool + func (c *Conn) String() string + type Event struct + Conn *Conn + Control bool + Data interface{} + 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, enode.ID) (bool, error) + Nodes []enode.ID + type Msg struct + Code uint64 + One enode.ID + Other enode.ID + 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 enode.ID) error + func (net *Network) ConnectNodesChain(ids []enode.ID) (err error) + func (net *Network) ConnectNodesFull(ids []enode.ID) (err error) + func (net *Network) ConnectNodesRing(ids []enode.ID) (err error) + func (net *Network) ConnectNodesStar(ids []enode.ID, center enode.ID) (err error) + func (net *Network) ConnectToLastNode(id enode.ID) (err error) + func (net *Network) ConnectToRandomNode(id enode.ID) (err error) + func (net *Network) DidConnect(one, other enode.ID) error + func (net *Network) DidDisconnect(one, other enode.ID) error + func (net *Network) DidReceive(sender, receiver enode.ID, proto string, code uint64) error + func (net *Network) DidSend(sender, receiver enode.ID, proto string, code uint64) error + func (net *Network) Disconnect(oneID, otherID enode.ID) error + func (net *Network) Events() *event.Feed + func (net *Network) GetConn(oneID, otherID enode.ID) *Conn + func (net *Network) GetNode(id enode.ID) *Node + func (net *Network) GetNodeByName(name string) *Node + func (net *Network) GetNodeIDs(excludeIDs ...enode.ID) []enode.ID + func (net *Network) GetNodeIDsByProperty(property string) []enode.ID + func (net *Network) GetNodes(excludeIDs ...enode.ID) []*Node + func (net *Network) GetNodesByID(nodeIDs []enode.ID) []*Node + func (net *Network) GetNodesByProperty(property string) []*Node + func (net *Network) GetOrCreateConn(oneID, otherID enode.ID) (*Conn, error) + func (net *Network) GetRandomDownNode(excludeIDs ...enode.ID) *Node + func (net *Network) GetRandomNode(excludeIDs ...enode.ID) *Node + func (net *Network) GetRandomUpNode(excludeIDs ...enode.ID) *Node + func (net *Network) InitConn(oneID, otherID enode.ID) (*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) SnapshotWithServices(addServices []string, removeServices []string) (*Snapshot, error) + func (net *Network) Start(id enode.ID) error + func (net *Network) StartAll() error + func (net *Network) Stop(id enode.ID) 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 + func (n *Node) ID() enode.ID + func (n *Node) MarshalJSON() ([]byte, error) + func (n *Node) NodeInfo() *p2p.NodeInfo + func (n *Node) SetUp(up bool) + func (n *Node) String() string + func (n *Node) UnmarshalJSON(raw []byte) error + func (n *Node) Up() bool + type NodeSnapshot struct + Node Node + Snapshots map[string][]byte + type NoopService struct + func NewNoopService(ackC map[enode.ID]chan struct{}) *NoopService + func (t *NoopService) APIs() []rpc.API + func (t *NoopService) Protocols() []p2p.Protocol + func (t *NoopService) Start() error + func (t *NoopService) Stop() error + 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 enode.ID + type StepResult struct + Error error + FinishedAt time.Time + NetworkEvents []*Event + Passes map[enode.ID]time.Time + StartedAt time.Time + type SubscribeOpts struct + Current bool + Filter string