Documentation
¶
Index ¶
- Constants
- Variables
- func AddDirectory(ctx commands.Context, fpath string) (string, error)
- func AddFile(ctx commands.Context, fpath string) (string, error)
- func Cat(ctx commands.Context, hash string) ([]byte, error)
- func ConnectedPeers(ctx commands.Context) ([]string, error)
- func FindPointers(dht *routing.IpfsDHT, ctx context.Context, mhKey multihash.Multihash, ...) ([]peer.PeerInfo, error)
- func FindPointersAsync(dht *routing.IpfsDHT, ctx context.Context, mhKey multihash.Multihash, ...) <-chan peer.PeerInfo
- func IdentityFromKey(privkey []byte) (config.Identity, error)
- func IdentityKeyFromSeed(seed []byte, bits int) ([]byte, error)
- func NewRequest(ctx cmds.Context, args []string) (cmds.Request, *cmds.Command, error)
- func Publish(ctx commands.Context, hash string) (string, error)
- func RePublishPointer(node *core.IpfsNode, ctx context.Context, pointer Pointer) error
- func UnPinDir(ctx commands.Context, rootHash string) error
- type DeterministicReader
- type Pointer
- type Purpose
Constants ¶
View Source
const MAGIC string = "000000000000000000000000"
Variables ¶
View Source
var Root = &cmds.Command{
Options: commands.Root.Options,
Helptext: commands.Root.Helptext,
}
Functions ¶
func AddDirectory ¶
func AddDirectory(ctx commands.Context, fpath string) (string, error)
Resursively add a directory to IPFS and return the root hash
func Cat ¶
func Cat(ctx commands.Context, hash string) ([]byte, error)
Fetch data from IPFS given the hash
func ConnectedPeers ¶
func ConnectedPeers(ctx commands.Context) ([]string, error)
func FindPointers ¶
func FindPointers(dht *routing.IpfsDHT, ctx context.Context, mhKey multihash.Multihash, prefixLen int) ([]peer.PeerInfo, error)
Fetch pointers from the dht.
func FindPointersAsync ¶
func FindPointersAsync(dht *routing.IpfsDHT, ctx context.Context, mhKey multihash.Multihash, prefixLen int) <-chan peer.PeerInfo
Fetch pointers from the dht. They will be returned asynchronously.
func IdentityFromKey ¶
func IdentityFromKey(privkey []byte) (config.Identity, error)
func IdentityKeyFromSeed ¶
func IdentityKeyFromSeed(seed []byte, bits int) ([]byte, error)
func NewRequest ¶
func NewRequest(ctx cmds.Context, args []string) (cmds.Request, *cmds.Command, error)
func Publish ¶
func Publish(ctx commands.Context, hash string) (string, error)
Publish a signed IPNS record to our Peer ID
func RePublishPointer ¶
func RePublishPointer(node *core.IpfsNode, ctx context.Context, pointer Pointer) error
Types ¶
type DeterministicReader ¶
type DeterministicReader struct {
Seed []byte
Counter int
}
type Pointer ¶
type Pointer struct {
Key key.Key
Value peer.PeerInfo
Purpose Purpose
Timestamp time.Time
}
A pointer is a custom provider inserted into the dht which points to a location of a file. For offline messaging purposes we use a hash of the recipient's ID as the key and set the provider to the location of the ciphertext. We set the Peer ID of the provider object to a magic number so we distinguish it from regular providers and use a longer ttl. Note this will only be compatible with the OpenBazaar/go-ipfs fork.
func PublishPointer ¶
func PublishPointer(node *core.IpfsNode, ctx context.Context, mhKey multihash.Multihash, prefixLen int, addr ma.Multiaddr) (Pointer, error)
Click to show internal directories.
Click to hide internal directories.