ayame

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONNMGR_LOW             = 100
	CONNMGR_HIGH            = 400
	RECORD_BYTES_PER_KEY    = true
	MAX_MESSAGE_AGE         = 60 // 1 minute in seconds
	MAX_MESSAGE_FROM_FUTURE = 30 // 30 seconds
)

Variables

This section is empty.

Functions

func Addresses

func Addresses(addrs [][]byte) []ma.Multiaddr

func Connectedness

func Connectedness(c pb.ConnectionType) network.Connectedness

XXX not used yet.

func ConnectionType

func ConnectionType(c network.Connectedness) pb.ConnectionType

func EncodeAddrs

func EncodeAddrs(maddrs []ma.Multiaddr) [][]byte

func IfNeededSign

func IfNeededSign(verifyIntegrity bool, cert []byte) []byte

Types

type P2PNode

type P2PNode struct {
	Host host.Host // libp2p host

	Cert []byte
	//CertSign           []byte // for cache
	//CertValidAfter     int64  // for cache
	//CertValidBefore    int64  // for cache
	Validator          func(peer.ID, ayame.Key, string, *ayame.MembershipVector, []byte) bool
	VerifyIntegrity    bool
	DetailedStatistics bool
	KeyInBytes         map[string]int64

	OutBytes int64
	InBytes  int64
	InCount  int64
	OutCount int64
	// contains filtered or unexported fields
}

Node type - a p2p host implementing one or more p2p protocols

func New

func New(h host.Host, key ayame.Key, name string, mv *ayame.MembershipVector, cert []byte,
	converter func(*p2p.Message, *P2PNode, bool) ayame.SchedEvent,
	validator func(peer.ID, ayame.Key, string, *ayame.MembershipVector, []byte) bool,
	verifyIntegrity bool, detailedStatistics bool,
	sendMessageProto string) *P2PNode

func (*P2PNode) Addrs

func (n *P2PNode) Addrs() []ma.Multiaddr

func (*P2PNode) App

func (n *P2PNode) App() interface{}

func (*P2PNode) Close

func (n *P2PNode) Close() error

func (*P2PNode) Encode

func (n *P2PNode) Encode() *p2p.Peer

func (*P2PNode) Equals

func (n *P2PNode) Equals(o ayame.Node) bool

func (*P2PNode) Id

func (n *P2PNode) Id() peer.ID

func (*P2PNode) Key

func (n *P2PNode) Key() ayame.Key

ayame.Node interface

func (*P2PNode) ListAllPeerProtocols

func (n *P2PNode) ListAllPeerProtocols(label string)

func (*P2PNode) MV

func (n *P2PNode) MV() *ayame.MembershipVector

func (*P2PNode) MessageIdPrefix

func (n *P2PNode) MessageIdPrefix() string

func (*P2PNode) Name

func (n *P2PNode) Name() string

func (*P2PNode) NewMessage

func (n *P2PNode) NewMessage(messageId string, mtype p2p.MessageType,
	originator ayame.Node, originatorSign []byte, originatorPubKey []byte,
	key ayame.Key, mv *ayame.MembershipVector) *p2p.Message

helper method - generate message data messageId: unique for requests, copied from request to responses

func (*P2PNode) Send

func (n *P2PNode) Send(ctx context.Context, ev ayame.SchedEvent, sign bool) error

Node API

func (*P2PNode) SetApp

func (n *P2PNode) SetApp(app interface{})

func (*P2PNode) SetChild

func (n *P2PNode) SetChild(c ayame.Node)

func (*P2PNode) SetKey

func (n *P2PNode) SetKey(key ayame.Key)

func (*P2PNode) SetMV

func (n *P2PNode) SetMV(mv *ayame.MembershipVector)

func (*P2PNode) SetName

func (n *P2PNode) SetName(name string)

func (*P2PNode) String

func (n *P2PNode) String() string

type RemoteNode

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

func NewIntroducerRemoteNode

func NewIntroducerRemoteNode(self *P2PNode, id peer.ID, addrs []ma.Multiaddr) *RemoteNode

func NewRemoteNode

func NewRemoteNode(self *P2PNode, p *pb.Peer) *RemoteNode

func (*RemoteNode) Addrs

func (n *RemoteNode) Addrs() []ma.Multiaddr

func (*RemoteNode) App

func (n *RemoteNode) App() interface{}

func (*RemoteNode) Close

func (n *RemoteNode) Close() error

func (*RemoteNode) Encode

func (n *RemoteNode) Encode() *pb.Peer

func (*RemoteNode) Equals

func (n *RemoteNode) Equals(o ayame.Node) bool

func (*RemoteNode) Id

func (n *RemoteNode) Id() peer.ID

func (*RemoteNode) Key

func (n *RemoteNode) Key() ayame.Key

ayame.Node interface

func (*RemoteNode) MV

func (*RemoteNode) MessageIdPrefix

func (n *RemoteNode) MessageIdPrefix() string

func (*RemoteNode) Name

func (n *RemoteNode) Name() string

func (*RemoteNode) Send

func (n *RemoteNode) Send(ctx context.Context, ev ayame.SchedEvent, sign bool) error

func (*RemoteNode) SetApp

func (n *RemoteNode) SetApp(app interface{})

func (*RemoteNode) SetKey

func (n *RemoteNode) SetKey(key ayame.Key)

func (*RemoteNode) SetMV

func (n *RemoteNode) SetMV(mv *ayame.MembershipVector)

func (*RemoteNode) SetName

func (n *RemoteNode) SetName(name string)

func (*RemoteNode) String

func (n *RemoteNode) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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