ipfs

package
v1.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddData

func AddData(node *core.IpfsNode, reader io.Reader, pin bool) (*cid.Cid, error)

AddData takes a reader and adds it, optionally pins it

func AddDataToDirectory

func AddDataToDirectory(node *core.IpfsNode, dir uio.Directory, fname string, reader io.Reader) (*cid.Cid, error)

AddDataToDirectory adds reader bytes to a virtual dir

func AddLinkToDirectory

func AddLinkToDirectory(node *core.IpfsNode, dir uio.Directory, fname string, pth string) error

AddLinkToDirectory adds a link to a virtual dir

func DataAtPath

func DataAtPath(node *core.IpfsNode, pth string) ([]byte, error)

DataAtPath return bytes under an ipfs path

func IdentityConfig

func IdentityConfig(sk libp2pc.PrivKey) (config.Identity, error)

IdentityConfig initializes a new identity.

func IpnsSubs

func IpnsSubs(node *core.IpfsNode) ([]string, error)

IpnsSubs shows current name subscriptions

func LinksAtPath

func LinksAtPath(node *core.IpfsNode, pth string) ([]*ipld.Link, error)

LinksAtPath return ipld links under a path

func NodeAtCid

func NodeAtCid(node *core.IpfsNode, id *cid.Cid) (ipld.Node, error)

NodeAtCid returns the node behind a cid

func NodeAtLink(node *core.IpfsNode, link *ipld.Link) (ipld.Node, error)

NodeAtLink returns the node behind an ipld link

func NodeAtPath

func NodeAtPath(node *core.IpfsNode, pth string) (ipld.Node, error)

NodeAtPath returns the last node under path

func PinNode

func PinNode(node *core.IpfsNode, nd ipld.Node, recursive bool) error

PinNode pins an ipld node

func PinPath

func PinPath(node *core.IpfsNode, pth string, recursive bool) error

PinPath takes an ipfs path string and pins it

func PrintSwarmAddrs

func PrintSwarmAddrs(node *core.IpfsNode) error

PrintSwarmAddrs prints the addresses of the host

func PublicIPv4Addr

func PublicIPv4Addr(node *core.IpfsNode) (string, error)

PublicIPv4Addr uses the ipfs NAT traveral result to locate a (possibly) public ipv4 address. this method is used to inform cafe clients of the http api address

func Resolve

func Resolve(node *core.IpfsNode, name peer.ID) (*path.Path, error)

Resolve resolves an ipns path to an ipfs path

func ShortenID

func ShortenID(id string) string

ShortenID returns the last 7 chars of a string

func SwarmConnect

func SwarmConnect(node *core.IpfsNode, addrs []string) ([]string, error)

SwarmConnect opens a direct connection to a list of peer multi addresses

func UnmarshalPrivateKeyFromString

func UnmarshalPrivateKeyFromString(key string) (libp2pc.PrivKey, error)

UnmarshalPrivateKeyFromString attempts to create a private key from a base64 encoded string

func UnmarshalPublicKeyFromString

func UnmarshalPublicKeyFromString(key string) (libp2pc.PubKey, error)

UnmarshalPublicKeyFromString attempts to create a public key from a base64 encoded string

func UnpinNode

func UnpinNode(node *core.IpfsNode, nd ipld.Node, recursive bool) error

UnpinNode unpins an ipld node

func UnpinPath

func UnpinPath(node *core.IpfsNode, pth string) error

UnpinPath takes an ipfs path string and unpins it Note: This is always recursive. Use UnpinNode for finer control.

Types

type ConnInfos

type ConnInfos struct {
	Peers []connInfo
}

func SwarmPeers

func SwarmPeers(node *core.IpfsNode, verbose bool, latency bool, streams bool, direction bool) (*ConnInfos, error)

SwarmPeers lists the set of peers this node is connected to

func (ConnInfos) Len

func (ci ConnInfos) Len() int

func (ConnInfos) Less

func (ci ConnInfos) Less(i, j int) bool

func (ConnInfos) Swap

func (ci ConnInfos) Swap(i, j int)

type IpnsEntry

type IpnsEntry struct {
	Name  string
	Value string
}

func Publish

func Publish(node *core.IpfsNode, sk libp2pc.PrivKey, id string, dur time.Duration, cache time.Duration) (*IpnsEntry, error)

Publish publishes a content id to ipns

Jump to

Keyboard shortcuts

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