go-ipfs-http-client: github.com/ipfs/go-ipfs-http-client Index | Files

package httpapi

import "github.com/ipfs/go-ipfs-http-client"

Index

Package Files

api.go apifile.go block.go dag.go dht.go key.go name.go object.go path.go pin.go pubsub.go request.go requestbuilder.go response.go swarm.go unixfs.go

Constants

const (
    DefaultPathName = ".ipfs"
    DefaultPathRoot = "~/" + DefaultPathName
    DefaultApiFile  = "api"
    EnvDir          = "IPFS_PATH"
)

Variables

var ErrApiNotFound = errors.New("ipfs api address could not be found")

ErrApiNotFound if we fail to find a running daemon.

func ApiAddr Uses

func ApiAddr(ipfspath string) (ma.Multiaddr, error)

ApiAddr reads api file in specified ipfs path

type BlockAPI Uses

type BlockAPI HttpApi

func (*BlockAPI) Get Uses

func (api *BlockAPI) Get(ctx context.Context, p path.Path) (io.Reader, error)

func (*BlockAPI) Put Uses

func (api *BlockAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.BlockPutOption) (iface.BlockStat, error)

func (*BlockAPI) Rm Uses

func (api *BlockAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.BlockRmOption) error

func (*BlockAPI) Stat Uses

func (api *BlockAPI) Stat(ctx context.Context, p path.Path) (iface.BlockStat, error)

type DhtAPI Uses

type DhtAPI HttpApi

func (*DhtAPI) FindPeer Uses

func (api *DhtAPI) FindPeer(ctx context.Context, p peer.ID) (peer.AddrInfo, error)

func (*DhtAPI) FindProviders Uses

func (api *DhtAPI) FindProviders(ctx context.Context, p path.Path, opts ...caopts.DhtFindProvidersOption) (<-chan peer.AddrInfo, error)

func (*DhtAPI) Provide Uses

func (api *DhtAPI) Provide(ctx context.Context, p path.Path, opts ...caopts.DhtProvideOption) error

type Error Uses

type Error = cmds.Error

type HttpApi Uses

type HttpApi struct {
    Headers http.Header
    // contains filtered or unexported fields
}

HttpApi implements github.com/ipfs/interface-go-ipfs-core/CoreAPI using IPFS HTTP API.

For interface docs see https://godoc.org/github.com/ipfs/interface-go-ipfs-core#CoreAPI

func NewApi Uses

func NewApi(a ma.Multiaddr) (*HttpApi, error)

NewApi constructs HttpApi with specified endpoint

func NewApiWithClient Uses

func NewApiWithClient(a ma.Multiaddr, c *gohttp.Client) (*HttpApi, error)

NewApiWithClient constructs HttpApi with specified endpoint and custom http client

func NewLocalApi Uses

func NewLocalApi() (*HttpApi, error)

NewLocalApi tries to construct new HttpApi instance communicating with local IPFS daemon

Daemon api address is pulled from the $IPFS_PATH/api file. If $IPFS_PATH env var is not present, it defaults to ~/.ipfs

func NewPathApi Uses

func NewPathApi(ipfspath string) (*HttpApi, error)

NewPathApi constructs new HttpApi by pulling api address from specified ipfspath. Api file should be located at $ipfspath/api

func NewURLApiWithClient Uses

func NewURLApiWithClient(url string, c *gohttp.Client) (*HttpApi, error)

func (*HttpApi) Block Uses

func (api *HttpApi) Block() iface.BlockAPI

func (*HttpApi) Dag Uses

func (api *HttpApi) Dag() iface.APIDagService

func (*HttpApi) Dht Uses

func (api *HttpApi) Dht() iface.DhtAPI

func (*HttpApi) Key Uses

func (api *HttpApi) Key() iface.KeyAPI

func (*HttpApi) Name Uses

func (api *HttpApi) Name() iface.NameAPI

func (*HttpApi) Object Uses

func (api *HttpApi) Object() iface.ObjectAPI

func (*HttpApi) Pin Uses

func (api *HttpApi) Pin() iface.PinAPI

func (*HttpApi) PubSub Uses

func (api *HttpApi) PubSub() iface.PubSubAPI

func (*HttpApi) Request Uses

func (api *HttpApi) Request(command string, args ...string) RequestBuilder

func (*HttpApi) ResolveNode Uses

func (api *HttpApi) ResolveNode(ctx context.Context, p path.Path) (ipld.Node, error)

func (*HttpApi) ResolvePath Uses

func (api *HttpApi) ResolvePath(ctx context.Context, p path.Path) (path.Resolved, error)

func (*HttpApi) Swarm Uses

func (api *HttpApi) Swarm() iface.SwarmAPI

func (*HttpApi) Unixfs Uses

func (api *HttpApi) Unixfs() iface.UnixfsAPI

func (*HttpApi) WithOptions Uses

func (api *HttpApi) WithOptions(opts ...caopts.ApiOption) (iface.CoreAPI, error)

type HttpDagServ Uses

type HttpDagServ httpNodeAdder

func (*HttpDagServ) Add Uses

func (api *HttpDagServ) Add(ctx context.Context, nd format.Node) error

func (*HttpDagServ) AddMany Uses

func (api *HttpDagServ) AddMany(ctx context.Context, nds []format.Node) error

func (*HttpDagServ) Get Uses

func (api *HttpDagServ) Get(ctx context.Context, c cid.Cid) (format.Node, error)

func (*HttpDagServ) GetMany Uses

func (api *HttpDagServ) GetMany(ctx context.Context, cids []cid.Cid) <-chan *format.NodeOption

func (*HttpDagServ) Pinning Uses

func (api *HttpDagServ) Pinning() format.NodeAdder

func (*HttpDagServ) Remove Uses

func (api *HttpDagServ) Remove(ctx context.Context, c cid.Cid) error

func (*HttpDagServ) RemoveMany Uses

func (api *HttpDagServ) RemoveMany(ctx context.Context, cids []cid.Cid) error

type KeyAPI Uses

type KeyAPI HttpApi

func (*KeyAPI) Generate Uses

func (api *KeyAPI) Generate(ctx context.Context, name string, opts ...caopts.KeyGenerateOption) (iface.Key, error)

func (*KeyAPI) List Uses

func (api *KeyAPI) List(ctx context.Context) ([]iface.Key, error)

func (*KeyAPI) Remove Uses

func (api *KeyAPI) Remove(ctx context.Context, name string) (iface.Key, error)

func (*KeyAPI) Rename Uses

func (api *KeyAPI) Rename(ctx context.Context, oldName string, newName string, opts ...caopts.KeyRenameOption) (iface.Key, bool, error)

func (*KeyAPI) Self Uses

func (api *KeyAPI) Self(ctx context.Context) (iface.Key, error)

type NameAPI Uses

type NameAPI HttpApi

func (*NameAPI) Publish Uses

func (api *NameAPI) Publish(ctx context.Context, p path.Path, opts ...caopts.NamePublishOption) (iface.IpnsEntry, error)

func (*NameAPI) Resolve Uses

func (api *NameAPI) Resolve(ctx context.Context, name string, opts ...caopts.NameResolveOption) (path.Path, error)

func (*NameAPI) Search Uses

func (api *NameAPI) Search(ctx context.Context, name string, opts ...caopts.NameResolveOption) (<-chan iface.IpnsResult, error)

type ObjectAPI Uses

type ObjectAPI HttpApi
func (api *ObjectAPI) AddLink(ctx context.Context, base path.Path, name string, child path.Path, opts ...caopts.ObjectAddLinkOption) (path.Resolved, error)

func (*ObjectAPI) AppendData Uses

func (api *ObjectAPI) AppendData(ctx context.Context, p path.Path, r io.Reader) (path.Resolved, error)

func (*ObjectAPI) Data Uses

func (api *ObjectAPI) Data(ctx context.Context, p path.Path) (io.Reader, error)

func (*ObjectAPI) Diff Uses

func (api *ObjectAPI) Diff(ctx context.Context, a path.Path, b path.Path) ([]iface.ObjectChange, error)

func (*ObjectAPI) Get Uses

func (api *ObjectAPI) Get(ctx context.Context, p path.Path) (ipld.Node, error)
func (api *ObjectAPI) Links(ctx context.Context, p path.Path) ([]*ipld.Link, error)

func (*ObjectAPI) New Uses

func (api *ObjectAPI) New(ctx context.Context, opts ...caopts.ObjectNewOption) (ipld.Node, error)

func (*ObjectAPI) Put Uses

func (api *ObjectAPI) Put(ctx context.Context, r io.Reader, opts ...caopts.ObjectPutOption) (path.Resolved, error)
func (api *ObjectAPI) RmLink(ctx context.Context, base path.Path, link string) (path.Resolved, error)

func (*ObjectAPI) SetData Uses

func (api *ObjectAPI) SetData(ctx context.Context, p path.Path, r io.Reader) (path.Resolved, error)

func (*ObjectAPI) Stat Uses

func (api *ObjectAPI) Stat(ctx context.Context, p path.Path) (*iface.ObjectStat, error)

type PinAPI Uses

type PinAPI HttpApi

func (*PinAPI) Add Uses

func (api *PinAPI) Add(ctx context.Context, p path.Path, opts ...caopts.PinAddOption) error

func (*PinAPI) Ls Uses

func (api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption) ([]iface.Pin, error)

func (*PinAPI) Rm Uses

func (api *PinAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.PinRmOption) error

func (*PinAPI) Update Uses

func (api *PinAPI) Update(ctx context.Context, from path.Path, to path.Path, opts ...caopts.PinUpdateOption) error

func (*PinAPI) Verify Uses

func (api *PinAPI) Verify(ctx context.Context) (<-chan iface.PinStatus, error)

type PubsubAPI Uses

type PubsubAPI HttpApi

func (*PubsubAPI) Ls Uses

func (api *PubsubAPI) Ls(ctx context.Context) ([]string, error)

func (*PubsubAPI) Peers Uses

func (api *PubsubAPI) Peers(ctx context.Context, opts ...caopts.PubSubPeersOption) ([]peer.ID, error)

func (*PubsubAPI) Publish Uses

func (api *PubsubAPI) Publish(ctx context.Context, topic string, message []byte) error

func (*PubsubAPI) Subscribe Uses

func (api *PubsubAPI) Subscribe(ctx context.Context, topic string, opts ...caopts.PubSubSubscribeOption) (iface.PubSubSubscription, error)

type Request Uses

type Request struct {
    Ctx     context.Context
    ApiBase string
    Command string
    Args    []string
    Opts    map[string]string
    Body    io.Reader
    Headers map[string]string
}

func NewRequest Uses

func NewRequest(ctx context.Context, url, command string, args ...string) *Request

func (*Request) Send Uses

func (r *Request) Send(c *http.Client) (*Response, error)

type RequestBuilder Uses

type RequestBuilder interface {
    Arguments(args ...string) RequestBuilder
    BodyString(body string) RequestBuilder
    BodyBytes(body []byte) RequestBuilder
    Body(body io.Reader) RequestBuilder
    FileBody(body io.Reader) RequestBuilder
    Option(key string, value interface{}) RequestBuilder
    Header(name, value string) RequestBuilder
    Send(ctx context.Context) (*Response, error)
    Exec(ctx context.Context, res interface{}) error
}

type Response Uses

type Response struct {
    Output io.ReadCloser
    Error  *Error
}

func (*Response) Cancel Uses

func (r *Response) Cancel() error

Cancel aborts running request (without draining request body)

func (*Response) Close Uses

func (r *Response) Close() error

type SwarmAPI Uses

type SwarmAPI HttpApi

func (*SwarmAPI) Connect Uses

func (api *SwarmAPI) Connect(ctx context.Context, pi peer.AddrInfo) error

func (*SwarmAPI) Disconnect Uses

func (api *SwarmAPI) Disconnect(ctx context.Context, addr multiaddr.Multiaddr) error

func (*SwarmAPI) KnownAddrs Uses

func (api *SwarmAPI) KnownAddrs(ctx context.Context) (map[peer.ID][]multiaddr.Multiaddr, error)

func (*SwarmAPI) ListenAddrs Uses

func (api *SwarmAPI) ListenAddrs(ctx context.Context) ([]multiaddr.Multiaddr, error)

func (*SwarmAPI) LocalAddrs Uses

func (api *SwarmAPI) LocalAddrs(ctx context.Context) ([]multiaddr.Multiaddr, error)

func (*SwarmAPI) Peers Uses

func (api *SwarmAPI) Peers(ctx context.Context) ([]iface.ConnectionInfo, error)

type UnixfsAPI Uses

type UnixfsAPI HttpApi

func (*UnixfsAPI) Add Uses

func (api *UnixfsAPI) Add(ctx context.Context, f files.Node, opts ...caopts.UnixfsAddOption) (path.Resolved, error)

func (*UnixfsAPI) Get Uses

func (api *UnixfsAPI) Get(ctx context.Context, p path.Path) (files.Node, error)

func (*UnixfsAPI) Ls Uses

func (api *UnixfsAPI) Ls(ctx context.Context, p path.Path, opts ...caopts.UnixfsLsOption) (<-chan iface.DirEntry, error)

Package httpapi imports 38 packages (graph) and is imported by 2 packages. Updated 2019-10-02. Refresh now. Tools for package owners.