ipfsaddr

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2019 License: MIT Imports: 5 Imported by: 52

README

go-ipfs-addr

Coverage Status Travis CI

A parsing utility for ipfs multiaddrs.

Table of Contents

Install

make install

Examples

import "github.com/ipfs/go-ipfs-addr"

addrstr := "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
a, _ := ipfsaddr.ParseString(addr)

fmt.Println("peer id: ", a.ID())
fmt.Println("transport multiaddr: ", a.Transport())

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Whyrusleeping

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAddr = errors.New("invalid IPFS address")

ErrInvalidAddr signals an address is not a valid IPFS address.

Functions

func Transport

func Transport(iaddr IPFSAddr) ma.Multiaddr

Types

type IPFSAddr

type IPFSAddr interface {
	ID() peer.ID
	Multiaddr() ma.Multiaddr
	Transport() ma.Multiaddr
	String() string
	Equal(b interface{}) bool
}

func ParseMultiaddr

func ParseMultiaddr(m ma.Multiaddr) (a IPFSAddr, err error)

ParseMultiaddr parses a multiaddr into an IPFSAddr

func ParseString

func ParseString(str string) (a IPFSAddr, err error)

ParseString parses a string representation of an address into an IPFSAddr

Jump to

Keyboard shortcuts

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