MCPcopy Index your code
hub / github.com/DOSNetwork/core / P2PInterface

Interface P2PInterface

p2p/p2p_interface.go:36–56  ·  view source on GitHub ↗

P2PInterface represents a p2p network

Source from the content-addressed store, hash-verified

34
35// P2PInterface represents a p2p network
36type P2PInterface interface {
37 GetIP() net.IP
38 GetID() []byte
39 SetPort(port string)
40 GetPort() string
41 Listen() error
42 Join(bootstrapIp []string) (num int, err error)
43 DisConnectTo(id []byte) error
44 Leave()
45 Request(ctx context.Context, id []byte, m proto.Message) (msg P2PMessage, err error)
46 Reply(ctx context.Context, id []byte, nonce uint64, m proto.Message) (err error)
47 SubscribeEvent() (subID int, outch chan discover.P2PEvent, err error)
48 UnSubscribeEvent(int)
49 SubscribeMsg(chanBuffer int, messages ...interface{}) (outch chan P2PMessage, err error)
50 UnSubscribeMsg(messages ...interface{})
51 NumOfMembers() int
52 MembersID() [][]byte
53 RandomPeerIP() []string
54 //ConnectToAll(ctx context.Context, groupIds [][]byte, sessionID string) (out chan bool, errc chan error)
55 numOfClient() (int, int)
56}
57
58// CreateP2PNetwork creates a P2PInterface implementation , gets a public IP and generates a secret key
59func CreateP2PNetwork(id []byte, ip, port string, netType int) (P2PInterface, error) {

Callers 41

statusMethod · 0.65
buildConnFunction · 0.65
GroupingMethod · 0.65
sendToMembersFunction · 0.65
TestChoseSubmitterFunction · 0.65
dispatchSignFunction · 0.65
statusMethod · 0.65
TestServerFunction · 0.65
buildConnFunction · 0.65
TestChoseSubmitterFunction · 0.65
buildConnFunction · 0.65
buildPdkgFunction · 0.65

Implementers 1

serverp2p/server.go

Calls

no outgoing calls

Tested by

no test coverage detected