Documentation
¶
Index ¶
- Constants
- func Addresses(addrs [][]byte) []ma.Multiaddr
- func Connectedness(c pb.ConnectionType) network.Connectedness
- func ConnectionType(c network.Connectedness) pb.ConnectionType
- func EncodeAddrs(maddrs []ma.Multiaddr) [][]byte
- func IfNeededSign(verifyIntegrity bool, cert []byte) []byte
- type P2PNode
- func (n *P2PNode) Addrs() []ma.Multiaddr
- func (n *P2PNode) App() interface{}
- func (n *P2PNode) Close() error
- func (n *P2PNode) Encode() *p2p.Peer
- func (n *P2PNode) Equals(o ayame.Node) bool
- func (n *P2PNode) Id() peer.ID
- func (n *P2PNode) Key() ayame.Key
- func (n *P2PNode) ListAllPeerProtocols(label string)
- func (n *P2PNode) MV() *ayame.MembershipVector
- func (n *P2PNode) MessageIdPrefix() string
- func (n *P2PNode) Name() string
- func (n *P2PNode) NewMessage(messageId string, mtype p2p.MessageType, originator ayame.Node, ...) *p2p.Message
- func (n *P2PNode) Send(ctx context.Context, ev ayame.SchedEvent, sign bool) error
- func (n *P2PNode) SetApp(app interface{})
- func (n *P2PNode) SetChild(c ayame.Node)
- func (n *P2PNode) SetKey(key ayame.Key)
- func (n *P2PNode) SetMV(mv *ayame.MembershipVector)
- func (n *P2PNode) SetName(name string)
- func (n *P2PNode) String() string
- type RemoteNode
- func (n *RemoteNode) Addrs() []ma.Multiaddr
- func (n *RemoteNode) App() interface{}
- func (n *RemoteNode) Close() error
- func (n *RemoteNode) Encode() *pb.Peer
- func (n *RemoteNode) Equals(o ayame.Node) bool
- func (n *RemoteNode) Id() peer.ID
- func (n *RemoteNode) Key() ayame.Key
- func (n *RemoteNode) MV() *ayame.MembershipVector
- func (n *RemoteNode) MessageIdPrefix() string
- func (n *RemoteNode) Name() string
- func (n *RemoteNode) Send(ctx context.Context, ev ayame.SchedEvent, sign bool) error
- func (n *RemoteNode) SetApp(app interface{})
- func (n *RemoteNode) SetKey(key ayame.Key)
- func (n *RemoteNode) SetMV(mv *ayame.MembershipVector)
- func (n *RemoteNode) SetName(name string)
- func (n *RemoteNode) String() string
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 Connectedness ¶
func Connectedness(c pb.ConnectionType) network.Connectedness
XXX not used yet.
func ConnectionType ¶
func ConnectionType(c network.Connectedness) pb.ConnectionType
func EncodeAddrs ¶
func IfNeededSign ¶
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) ListAllPeerProtocols ¶
func (*P2PNode) MV ¶
func (n *P2PNode) MV() *ayame.MembershipVector
func (*P2PNode) MessageIdPrefix ¶
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) SetMV ¶
func (n *P2PNode) SetMV(mv *ayame.MembershipVector)
type RemoteNode ¶
type RemoteNode struct {
// contains filtered or unexported fields
}
func NewIntroducerRemoteNode ¶
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) Id ¶
func (n *RemoteNode) Id() peer.ID
func (*RemoteNode) MV ¶
func (n *RemoteNode) MV() *ayame.MembershipVector
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
Click to show internal directories.
Click to hide internal directories.