dht

package
v1.64.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: BSD-3-Clause Imports: 27 Imported by: 1

Documentation

Overview

Package dht 基于libp2p实现p2p 插件

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenPrivPubkey

func GenPrivPubkey() ([]byte, []byte, error)

GenPrivPubkey return key and pubkey in bytes

func GenPubkey

func GenPubkey(key string) (string, error)

func New

func New(mgr *p2p.Manager, subCfg []byte) p2p.IP2P

New new dht p2p network

Types

type AddrBook

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

AddrBook peer address manager

func NewAddrBook

func NewAddrBook(cfg *types.P2P) *AddrBook

func (*AddrBook) AddrsInfo

func (a *AddrBook) AddrsInfo() []peer.AddrInfo

func (*AddrBook) GetPrivPubKey

func (a *AddrBook) GetPrivPubKey() (string, string)

GetPrivPubKey return privkey and pubkey

func (*AddrBook) GetPrivkey

func (a *AddrBook) GetPrivkey() p2pcrypto.PrivKey

func (*AddrBook) SaveAddr

func (a *AddrBook) SaveAddr(addrinfos []peer.AddrInfo) error

func (*AddrBook) SaveKey

func (a *AddrBook) SaveKey(priv, pub string)

func (*AddrBook) StoreHostID

func (a *AddrBook) StoreHostID(id peer.ID, path string)

StoreHostID store host id into file

type P2P

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

P2P p2p struct

func (*P2P) CloseP2P

func (p *P2P) CloseP2P()

func (*P2P) StartP2P

func (p *P2P) StartP2P()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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