Documentation ¶
Index ¶
- Variables
- func GenerateSwarmKey() string
- func SetupLibp2p(ctx context.Context, hostKey crypto.PrivKey, secret pnet.PSK, ...) (host.Host, *dht.IpfsDHT, error)
- type Config
- type Peer
- func (p *Peer) Bootstrap(peers []peer.AddrInfo)
- func (p *Peer) Discover(rendezvous string)
- func (p *Peer) HostAddr() string
- func (p *Peer) ID() string
- func (p *Peer) NewStream(proto, target string) (coreNetwork.Stream, error)
- func (p *Peer) Publish(ctx context.Context, data []byte) error
- func (p *Peer) RoutedHost() host.Host
Constants ¶
This section is empty.
Variables ¶
View Source
var Libp2pOptionsExtra = []libp2p.Option{
libp2p.NATPortMap(),
libp2p.ConnectionManager(connMgr),
libp2p.EnableNATService(),
}
Functions ¶
func GenerateSwarmKey ¶
func GenerateSwarmKey() string
Types ¶
type Config ¶
type Config struct { Offline bool // ReprovideInterval sets how often to reprovide records to the DHT ReprovideInterval time.Duration // Disables wrapping the blockstore in an ARC cache + Bloomfilter. Use // when the given blockstore or datastore already has caching, or when // caching is not needed. UncachedBlockstore bool TopicHandler func(*proto.UpdatePeer) }
Config wraps configuration options for the Peer.
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
func (*Peer) Bootstrap ¶
Bootstrap is an optional helper to connect to the given peers and bootstrap21 the Peer DHT (and Bitswap). This is a best-effort function. Errors are only logged and a warning is printed when less than half of the given peers could be contacted. It is fine to pass a list where some peers will not be reachable.
func (*Peer) RoutedHost ¶
Click to show internal directories.
Click to hide internal directories.