Documentation ¶
Overview ¶
Package ipfs implements an interface to ipfs's codebase that also fulfills the backend.Backend interface.
Index ¶
- Variables
- func ForwardLog(w io.Writer)
- func Init(path string, keySize int) error
- func WithIpfs(t *testing.T, f func(*Node))
- func WithIpfsAtPath(t *testing.T, root string, f func(*Node))
- func WithIpfsAtPathAndPort(t *testing.T, root string, port int, f func(*Node))
- func WithIpfsAtPort(t *testing.T, port int, f func(*Node))
- type Listener
- type Node
- func (nd *Node) Add(r io.Reader) (h.Hash, error)
- func (nd *Node) Cat(hash h.Hash) (mio.Stream, error)
- func (nd *Node) Close() error
- func (nd *Node) Connect() error
- func (nd *Node) Dial(peerHash, protocol string) (net.Conn, error)
- func (nd *Node) Disconnect() error
- func (nd *Node) GC() ([]h.Hash, error)
- func (nd *Node) Identity() (peer.Info, error)
- func (nd *Node) IsOnline() bool
- func (nd *Node) IsPinned(hash h.Hash) (bool, error)
- func (nd *Node) Listen(protocol string) (net.Listener, error)
- func (nd *Node) Name() string
- func (nd *Node) Pin(hash h.Hash) error
- func (nd *Node) Ping(addr string) (netBackend.Pinger, error)
- func (nd *Node) PublishName(name string) error
- func (nd *Node) ResolveName(ctx context.Context, name string) ([]peer.Info, error)
- func (nd *Node) Unpin(hash h.Hash) error
- type Pinger
- type VersionInfo
Constants ¶
This section is empty.
Variables ¶
var ( // ErrIsOffline is returned when an online operation was done offline. ErrIsOffline = errors.New("Node is offline") )
Functions ¶
func ForwardLog ¶ added in v0.2.0
ForwardLog routes all ipfs logs to a file provided by brig.
func Init ¶
Init creates an initialized .ipfs directory in the directory `path`. The generated RSA key will have `keySize` bits.
func WithIpfsAtPath ¶
WithIpfsAtPath creates a new ipfs node at `path` and passes it to `f`.
func WithIpfsAtPathAndPort ¶
WithIpfsAtPathAndPort is the same as WithIpfs with the ability to change `port` and `path`.
Types ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is a ipfs net.Listener that will accecpt all incoming ipfs connections having a certain protocol.
type Node ¶
Node remembers the settings needed for accessing the ipfs daemon.
func NewWithPort ¶
NewWithPort creates a new ipfs instance with the repo at `ipfsPath` the additional bootstrap addrs in `bootstrapAddrs` at port `swarmPort`.
func (*Node) Dial ¶
Dial connects to the repo identified by `peerHash` with the protocol `protocol`.
func (*Node) Disconnect ¶
Disconnect disconnects from the ipfs network.
func (*Node) GC ¶
GC triggers IPFS' garbage collector. It returns the hashes of the collected nodes.
func (*Node) Ping ¶
func (nd *Node) Ping(addr string) (netBackend.Pinger, error)
Ping returns a new Pinger. It can be used to query the time the remote was last seen. It will be constantly updated until close is called on it.
func (*Node) PublishName ¶
PublishName makes the string `name` known in the network.
func (*Node) ResolveName ¶
ResolveName finds the object pointed to by `hash`. it will wait for max `timeout` duration if it got less than `n` items in that time. if `n` is less than 0, all reachable peers that have `hash` will be returned. if `n` is 0, locate will return immeditately. this operation requires online-mode.
type Pinger ¶
type Pinger struct {
// contains filtered or unexported fields
}
Pinger handles pinging over nodes on a network level.
type VersionInfo ¶ added in v0.2.0
type VersionInfo struct {
// contains filtered or unexported fields
}
VersionInfo holds version info (yeah, golint)
func (*VersionInfo) Name ¶ added in v0.2.0
func (v *VersionInfo) Name() string
Name returns the name of the backend
func (*VersionInfo) Rev ¶ added in v0.2.0
func (v *VersionInfo) Rev() string
Rev returns the git revision of the backend
func (*VersionInfo) SemVer ¶ added in v0.2.0
func (v *VersionInfo) SemVer() string
SemVer returns a VersionInfo string complying semantic versioning