Documentation ¶
Index ¶
- func AddFileToNodes(ctx context.Context, filePath string, clients ...Client) (string, error)
- func AddTextToNodes(ctx context.Context, fileContent []byte, clients ...Client) (string, error)
- func ParsePeersString(peers []string) ([]peer.AddrInfo, error)
- type Client
- func (cl Client) APIAddress() string
- func (cl Client) Get(ctx context.Context, cid, outputPath string) error
- func (cl Client) GetCidSize(ctx context.Context, cid string) (uint64, error)
- func (cl Client) GetTreeNode(ctx context.Context, cid string) (IPLDTreeNode, error)
- func (cl Client) HasCID(ctx context.Context, cid string) (bool, error)
- func (cl Client) ID(ctx context.Context) (string, error)
- func (cl Client) Put(ctx context.Context, inputPath string) (string, error)
- func (cl Client) Stat(ctx context.Context, cid string) (*StatResult, error)
- func (cl Client) SwarmAddresses(ctx context.Context) ([]string, error)
- func (cl Client) SwarmConnect(ctx context.Context, peers []peer.AddrInfo)
- func (cl Client) SwarmMultiAddresses(ctx context.Context) ([]ma.Multiaddr, error)
- type IPLDTreeNode
- type IPLDType
- type StatResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFileToNodes ¶
func AddTextToNodes ¶
Types ¶
type Client ¶
Client is a front-end for an ipfs node's API endpoints
func (Client) APIAddress ¶
APIAddress returns Api address that was used to connect to the node.
func (Client) GetCidSize ¶
func (Client) GetTreeNode ¶
func (Client) HasCID ¶
HasCID returns true if the node has the given CID locally, whether pinned or not.
func (Client) Put ¶
Put uploads and pins a file or directory to the ipfs network. Timeouts and cancellation should be handled by passing an appropriate context value.
func (Client) SwarmAddresses ¶
SwarmAddresses returns a list of swarm addresses the node has announced.
func (Client) SwarmConnect ¶ added in v1.1.0
SwarmConnect establishes concurrent connections to each peer from the provided `peers` list. It spawns a goroutine for each peer connection. In the event of a connection failure, a warning log containing the error and peer details is generated.
type IPLDTreeNode ¶
type IPLDTreeNode struct { Cid cid.Cid Path []string Children []IPLDTreeNode }
func FlattenTreeNode ¶
func FlattenTreeNode(ctx context.Context, rootNode IPLDTreeNode) ([]IPLDTreeNode, error)
type StatResult ¶
type StatResult struct {
Type IPLDType
}