discover

package
v1.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Membership

type Membership interface {
	Join(Ip []string) (num int, err error)
	Leave()
	Listen(ctx context.Context, outch chan P2PEvent)
	Lookup(id []byte) (addr string)
	NumOfPeers() int
	IsAlive() bool
	MembersIP() (addr []net.IP)
	MembersID() (list [][]byte)
}

Membership represents the p2p network

func NewSerfNet

func NewSerfNet(Addr net.IP, id, port string) (Membership, error)

NewSerfNet creates a Serf implementation

func NewSimulator

func NewSimulator() (Membership, error)

NewSerfNet creates a Serf implementation

type P2PEvent

type P2PEvent struct {
	EventType string
	NodeID    string
	Addr      net.IP
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL