libp2p

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: AGPL-3.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bootstrap

func Bootstrap() error

* 后台线程,检查在数据库中是否存在,如果不存在,连接,寻找节点,加入dht 如果连接不上,调度连接根据配置的启动节点进行刷新

func FindPeers

func FindPeers(routingDiscovery *discovery.RoutingDiscovery)

func GetFoundPeer

func GetFoundPeer(peerChan chan peer.AddrInfo) peer.AddrInfo

func GetPeerInfos

func GetPeerInfos() []*peer.AddrInfo

func NewPeerEndpointDHT

func NewPeerEndpointDHT(options []dht2.Option) *dht.PeerEntityDHT

* 为了节点发现启动DHT

func PeerAdded

func PeerAdded(id peer.ID)

func PeerRemoved

func PeerRemoved(id peer.ID)

func Start

func Start()

* 启动本机作为一个p2p节点主机

Types

type MonitorConnMgr

type MonitorConnMgr struct {
	*connmgr.BasicConnMgr
}

func NewConnManager

func NewConnManager(basicConnMgr *connmgr.BasicConnMgr) *MonitorConnMgr

func (*MonitorConnMgr) Notifee

func (cm *MonitorConnMgr) Notifee() network.Notifiee

Notifee returns a sink through which Notifiers can inform the BasicConnMgr when events occur. Currently, the notifee only reacts upon connection events {Connected, Disconnected}.

type OpenPGPPrivateKey

type OpenPGPPrivateKey struct {
	PrivateKey *openpgpcrypto.Key
	KeyType    pb.KeyType
}

func (*OpenPGPPrivateKey) Bytes

func (this *OpenPGPPrivateKey) Bytes() ([]byte, error)

Bytes returns a serialized, storeable representation of this key DEPRECATED in favor of Marshal / Unmarshal

func (*OpenPGPPrivateKey) Equals

func (this *OpenPGPPrivateKey) Equals(key crypto.Key) bool

Equals checks whether two PubKeys are the same

func (*OpenPGPPrivateKey) GetPublic

func (this *OpenPGPPrivateKey) GetPublic() crypto.PubKey

Return a public key paired with this private key

func (*OpenPGPPrivateKey) Raw

func (this *OpenPGPPrivateKey) Raw() ([]byte, error)

Raw returns the raw bytes of the key (not wrapped in the libp2p-crypto protobuf).

This function is the inverse of {Priv,Pub}KeyUnmarshaler.

func (*OpenPGPPrivateKey) Sign

func (this *OpenPGPPrivateKey) Sign(plaintext []byte) ([]byte, error)

PrivateKey Cryptographically sign the given bytes

func (*OpenPGPPrivateKey) Type

func (this *OpenPGPPrivateKey) Type() pb.KeyType

Type returns the protobof key type.

type OpenPGPPublicKey

type OpenPGPPublicKey struct {
	PublicKey *openpgpcrypto.Key
	KeyType   pb.KeyType
}

func (*OpenPGPPublicKey) Bytes

func (this *OpenPGPPublicKey) Bytes() ([]byte, error)

Bytes returns a serialized, storeable representation of this key DEPRECATED in favor of Marshal / Unmarshal

func (*OpenPGPPublicKey) Equals

func (this *OpenPGPPublicKey) Equals(key crypto.Key) bool

Equals checks whether two PubKeys are the same

func (*OpenPGPPublicKey) Raw

func (this *OpenPGPPublicKey) Raw() ([]byte, error)

Raw returns the raw bytes of the key (not wrapped in the libp2p-crypto protobuf).

This function is the inverse of {Priv,Pub}KeyUnmarshaler.

func (*OpenPGPPublicKey) Type

func (this *OpenPGPPublicKey) Type() pb.KeyType

Type returns the protobof key type.

func (*OpenPGPPublicKey) Verify

func (this *OpenPGPPublicKey) Verify(data []byte, sig []byte) (bool, error)

PublicKeys Verify that 'sig' is the signed hash of 'data'

Directories

Path Synopsis
datastore

Jump to

Keyboard shortcuts

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