p2p

package
v0.0.0-...-ebe581b Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type P2P

type P2P struct {
	// contains filtered or unexported fields
}

P2P defines p2p network

func NewP2P

func NewP2P(addrs ...string) *P2P

NewP2P creates P2P instance

func (*P2P) FreePeer

func (p *P2P) FreePeer()

FreePeer frees a peer

func (*P2P) GetPeer

func (p *P2P) GetPeer(address string) (*Peer, error)

GetPeer gets an available peer

func (*P2P) Stop

func (p *P2P) Stop()

Stop stops p2p, and closes all the grpc connection

type Peer

type Peer struct {
	// contains filtered or unexported fields
}

Peer defines peer

func (*Peer) GetConnect

func (p *Peer) GetConnect() (*grpc.ClientConn, error)

GetConnect gets rpc connection

type State

type State uint8

State is the state of the P2P

const (
	// NEW indicates that the P2P is new and ready for providing service
	NEW State = iota

	// CLOSED indicates that the P2P has been closed
	CLOSED
)

Jump to

Keyboard shortcuts

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