Documentation ¶
Index ¶
- Constants
- Variables
- func AddDirectory(ctx commands.Context, fpath string) (rootHash string, err 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, ...) ([]ps.PeerInfo, error)
- func FindPointersAsync(dht *routing.IpfsDHT, ctx context.Context, mhKey multihash.Multihash, ...) <-chan ps.PeerInfo
- func GetHash(ctx commands.Context, fpath string) (string, error)
- func IdentityFromKey(privkey []byte) (config.Identity, error)
- func IdentityKeyFromSeed(seed []byte, bits int) ([]byte, error)
- func MockCmdsCtx() (commands.Context, error)
- func MockHostOption(mn mocknet.Mocknet) core.HostOption
- func NewMockNode() (*core.IpfsNode, error)
- func NewRequest(ctx cmds.Context, args []string) (cmds.Request, *cmds.Command, error)
- func NewRequestWithTimeout(ctx cmds.Context, args []string, timeout time.Duration) (cmds.Request, *cmds.Command, error)
- func Publish(ctx commands.Context, hash string) (string, error)
- func Query(ctx commands.Context, peerID string) ([]peer.ID, error)
- func RePublishPointer(node *core.IpfsNode, ctx context.Context, pointer Pointer) error
- func Resolve(ctx commands.Context, hash string) (string, error)
- func ResolveThenCat(ctx commands.Context, ipnsPath path.Path) ([]byte, error)
- func UnPinDir(ctx commands.Context, rootHash string) error
- type DeterministicReader
- type Pointer
- type Purpose
Constants ¶
View Source
const CatTimeout = 30 * time.Second
View Source
const MAGIC string = "000000000000000000000000"
View Source
const ResolveTimeout = 30 * time.Second
Variables ¶
Functions ¶
func AddDirectory ¶
Resursively add a directory to IPFS and return the root hash
func FindPointers ¶
func FindPointers(dht *routing.IpfsDHT, ctx context.Context, mhKey multihash.Multihash, prefixLen int) ([]ps.PeerInfo, error)
Fetch pointers from the dht
func FindPointersAsync ¶
func FindPointersAsync(dht *routing.IpfsDHT, ctx context.Context, mhKey multihash.Multihash, prefixLen int) <-chan ps.PeerInfo
Fetch pointers from the dht. They will be returned asynchronously.
func MockCmdsCtx ¶
func MockHostOption ¶
func MockHostOption(mn mocknet.Mocknet) core.HostOption
func NewMockNode ¶
NewMockNode constructs an IpfsNode for use in tests.
func NewRequest ¶
func NewRequestWithTimeout ¶ added in v0.1.1
func RePublishPointer ¶
func ResolveThenCat ¶ added in v0.1.1
Types ¶
type DeterministicReader ¶
type Pointer ¶
type Pointer struct { Cid *cid.Cid Value ps.PeerInfo Purpose Purpose Timestamp time.Time CancelID *peer.ID }
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.
Click to show internal directories.
Click to hide internal directories.