ipfs_files

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 3 Imported by: 0

README

Ipfs-files

Provides the following features:

  • Start up an in IPFS node
  • Configure IPFS node with custom options in config.IpfsOptions
  • Provide access to CoreAPI and FileAPI over the exported IpfsAPI

Usage

  • Import the package github.com/rish1988/ipfs-files

  • Starting an IPFS node is simple as using the below code

package main

import (
	"context"
	"github.com/rish1988/ipfs-files"
)

func main() {
	
  // Get a context to work with
  ctx, cancel := context.WithCancel(context.context.Backround())
	
  // When the context is destroyed, the IPFS node is also destroyed
  defer cancel()
	
  // Set some options
  opts := config.IpfsOptions {
    NodeType: config.Default,
    BootstrapNodes: []string {
      "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
			"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
			"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
			"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
    },
    EnableExperimental: true,
  }

  // Get access to Ipfs CoreAPI and FileAPI
  ipfsApi, err := ipfs_files.IpfsNode(ctx, opts)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIpfsNode

func NewIpfsNode(context context.Context, options config.IpfsOptions) (ipfs.IpfsApi, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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