helper

package
v0.0.3-0...-19b0325 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2019 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenKey

func GenKey(dir string) (ic.PrivKey, error)

func GenSwarm

func GenSwarm() *swarm.Swarm

func GenSwarm2

func GenSwarm2() (*swarm.Swarm, *tptu.Upgrader)

func GenSwarmByKey

func GenSwarmByKey(key ic.PrivKey) (*swarm.Swarm, *tptu.Upgrader)

func GenUpgrader

func GenUpgrader(n *swarm.Swarm) *tptu.Upgrader

GenUpgrader creates a new connection upgrader for use with this swarm.

func LoadKey

func LoadKey(dir string) (ic.PrivKey, error)

Types

type MyID

type MyID struct {
	ID  string `json:"id"`
	PRV string `json:"prv"`
}

type Node

type Node struct {
	Host    host.Host
	Routing *dht.IpfsDHT
}

func NewLocalNode

func NewLocalNode() *Node

func NewNode

func NewNode(key ic.PrivKey, port int) *Node

func (*Node) Bootstrap

func (self *Node) Bootstrap(ctx context.Context) error

func (*Node) Close

func (self *Node) Close()

func (*Node) Connect

func (self *Node) Connect(ctx context.Context, targetID interface{}, targetAddrs []ma.Multiaddr) error

func (*Node) FindPeer

func (self *Node) FindPeer(ctx context.Context, targetID interface{}) (pstore.PeerInfo, error)

func (*Node) GetValue

func (self *Node) GetValue(ctx context.Context, key string) ([]byte, error)

func (*Node) PutValue

func (self *Node) PutValue(ctx context.Context, key string, value []byte) error

Jump to

Keyboard shortcuts

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