libs5-go/interfaces/p2p.go

26 lines
771 B
Go
Raw Normal View History

package interfaces
import (
"git.lumeweb.com/LumeWeb/libs5-go/encoding"
"git.lumeweb.com/LumeWeb/libs5-go/net"
"git.lumeweb.com/LumeWeb/libs5-go/structs"
"net/url"
)
2024-01-08 05:16:32 +00:00
//go:generate mockgen -source=p2p.go -destination=../mocks/interfaces/p2p.go -package=interfaces
type P2PService interface {
Node() Node
Peers() structs.Map
Start() error
Stop() error
Init() error
ConnectToNode(connectionUris []*url.URL, retried bool) error
OnNewPeer(peer net.Peer, verifyId bool) error
OnNewPeerListen(peer net.Peer, verifyId bool)
2024-01-07 08:54:50 +00:00
ReadNodeScore(nodeId *encoding.NodeId) (NodeVotes, error)
GetNodeScore(nodeId *encoding.NodeId) (float64, error)
SortNodesByScore(nodes []*encoding.NodeId) ([]*encoding.NodeId, error)
2024-01-07 14:02:39 +00:00
SignMessageSimple(message []byte) ([]byte, error)
}