Versions in this module Expand all Collapse all v1 v1.8.14 Aug 22, 2018 v1.8.13 Jul 31, 2018 Changes in this version + var DefaultHTTPSimAddr = ":8888" + var ErrNoPivotNode = errors.New("no pivot node set") + var ErrNodeNotFound = errors.New("node not found") + type AddNodeOption func(*adapters.NodeConfig) + func AddNodeWithMsgEvents(enable bool) AddNodeOption + func AddNodeWithService(serviceName string) AddNodeOption + type BucketKey string + var BucketKeyKademlia BucketKey = "kademlia" + type PeerEvent struct + Error error + Event *p2p.PeerEvent + NodeID discover.NodeID + type PeerEventsFilter struct + func NewPeerEventsFilter() *PeerEventsFilter + func (f *PeerEventsFilter) MsgCode(c uint64) *PeerEventsFilter + func (f *PeerEventsFilter) Protocol(p string) *PeerEventsFilter + func (f *PeerEventsFilter) Type(t p2p.PeerEventType) *PeerEventsFilter + type Result struct + Duration time.Duration + Error error + type RunFunc func(context.Context, *Simulation) error + type ServiceFunc func(ctx *adapters.ServiceContext, bucket *sync.Map) (s node.Service, cleanup func(), err error) + type Simulation struct + Net *simulations.Network + func New(services map[string]ServiceFunc) (s *Simulation) + func (s *Simulation) AddNode(opts ...AddNodeOption) (id discover.NodeID, err error) + func (s *Simulation) AddNodes(count int, opts ...AddNodeOption) (ids []discover.NodeID, err error) + func (s *Simulation) AddNodesAndConnectChain(count int, opts ...AddNodeOption) (ids []discover.NodeID, err error) + func (s *Simulation) AddNodesAndConnectFull(count int, opts ...AddNodeOption) (ids []discover.NodeID, err error) + func (s *Simulation) AddNodesAndConnectRing(count int, opts ...AddNodeOption) (ids []discover.NodeID, err error) + func (s *Simulation) AddNodesAndConnectStar(count int, opts ...AddNodeOption) (ids []discover.NodeID, err error) + func (s *Simulation) Close() + func (s *Simulation) ConnectNodesChain(ids []discover.NodeID) (err error) + func (s *Simulation) ConnectNodesFull(ids []discover.NodeID) (err error) + func (s *Simulation) ConnectNodesRing(ids []discover.NodeID) (err error) + func (s *Simulation) ConnectNodesStar(id discover.NodeID, ids []discover.NodeID) (err error) + func (s *Simulation) ConnectNodesStarPivot(ids []discover.NodeID) (err error) + func (s *Simulation) ConnectToLastNode(id discover.NodeID) (err error) + func (s *Simulation) ConnectToPivotNode(id discover.NodeID) (err error) + func (s *Simulation) ConnectToRandomNode(id discover.NodeID) (err error) + func (s *Simulation) Done() <-chan struct{} + func (s *Simulation) DownNodeIDs() (ids []discover.NodeID) + func (s *Simulation) NodeIDs() (ids []discover.NodeID) + func (s *Simulation) NodeItem(id discover.NodeID, key interface{}) (value interface{}, ok bool) + func (s *Simulation) NodesItems(key interface{}) (values map[discover.NodeID]interface{}) + func (s *Simulation) PeerEvents(ctx context.Context, ids []discover.NodeID, filters ...*PeerEventsFilter) <-chan PeerEvent + func (s *Simulation) PivotNodeID() (id *discover.NodeID) + func (s *Simulation) RandomService(name string) node.Service + func (s *Simulation) RandomUpNode(exclude ...discover.NodeID) *adapters.SimNode + func (s *Simulation) Run(ctx context.Context, f RunFunc) (r Result) + func (s *Simulation) RunSimulation(w http.ResponseWriter, req *http.Request) + func (s *Simulation) Service(name string, id discover.NodeID) node.Service + func (s *Simulation) Services(name string) (services map[discover.NodeID]node.Service) + func (s *Simulation) SetNodeItem(id discover.NodeID, key interface{}, value interface{}) + func (s *Simulation) SetPivotNode(id discover.NodeID) + func (s *Simulation) StartNode(id discover.NodeID) (err error) + func (s *Simulation) StartRandomNode() (id discover.NodeID, err error) + func (s *Simulation) StartRandomNodes(count int) (ids []discover.NodeID, err error) + func (s *Simulation) StopNode(id discover.NodeID) (err error) + func (s *Simulation) StopRandomNode() (id discover.NodeID, err error) + func (s *Simulation) StopRandomNodes(count int) (ids []discover.NodeID, err error) + func (s *Simulation) UpNodeIDs() (ids []discover.NodeID) + func (s *Simulation) UpNodesItems(key interface{}) (values map[discover.NodeID]interface{}) + func (s *Simulation) UploadSnapshot(snapshotFile string, opts ...AddNodeOption) error + func (s *Simulation) WaitTillHealthy(ctx context.Context, kadMinProxSize int) (ill map[discover.NodeID]*network.Kademlia, err error) + func (s *Simulation) WithServer(addr string) *Simulation