Documentation ¶
Index ¶
- type IIpfs
- type IPubSubSubscription
- type Ipfs
- func (ipfs *Ipfs) Add(r io.Reader) (string, error)
- func (ipfs *Ipfs) AddDir(dir string) (string, error)
- func (ipfs *Ipfs) Get(hash string, outdir string) error
- func (ipfs *Ipfs) ID() (*ipfsapi.IdOutput, error)
- func (ipfs *Ipfs) P2PCloseListener(ctx context.Context, protocol string, closeAll bool) error
- func (ipfs *Ipfs) P2PCloseStream(ctx context.Context, handlerID string, closeAll bool) error
- func (ipfs *Ipfs) P2PListen(ctx context.Context, protocol, maddr string) (*P2PListener, error)
- func (ipfs *Ipfs) P2PStreamDial(ctx context.Context, peerID, protocol, listenerMaddr string) (*P2PStream, error)
- func (ipfs *Ipfs) PubSubPublish(topic string, data string) error
- func (ipfs *Ipfs) PubSubSubscribe(topic string) (IPubSubSubscription, error)
- func (ipfs *Ipfs) Publish(node string, value string) error
- type P2PListener
- type P2PStream
- type PubSubSubscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IIpfs ¶
type IIpfs interface { ID() (*ipfsapi.IdOutput, error) PubSubPublish(topic string, data string) error PubSubSubscribe(topic string) (IPubSubSubscription, error) Get(hash string, outdir string) error AddDir(dir string) (string, error) Publish(node string, value string) error Add(r io.Reader) (string, error) P2PListen(ctx context.Context, protocol, maddr string) (*P2PListener, error) P2PCloseListener(ctx context.Context, protocol string, closeAll bool) error P2PStreamDial(ctx context.Context, peerID, protocol, listenerMaddr string) (*P2PStream, error) P2PCloseStream(ctx context.Context, handlerID string, closeAll bool) error }
IIpfs is an interface to IPFS. It is done this way to be able to mock IPFS in unit tests later
type IPubSubSubscription ¶
IPubSubSubscription is an interface to IPFS pubsub subscriptions
type Ipfs ¶
type Ipfs struct {
// contains filtered or unexported fields
}
Ipfs is implementation of IIpfs
func (*Ipfs) P2PCloseListener ¶
P2PCloseListener closes an open P2P listener
func (*Ipfs) P2PCloseStream ¶
P2PCloseStream closes an open libp2p stream
func (*Ipfs) P2PStreamDial ¶
func (ipfs *Ipfs) P2PStreamDial(ctx context.Context, peerID, protocol, listenerMaddr string) (*P2PStream, error)
P2PStreamDial dials to the given IPFS id and forwards the message to the listener multiaddress
func (*Ipfs) PubSubPublish ¶
PubSubPublish publishes a message in the given topic
func (*Ipfs) PubSubSubscribe ¶
func (ipfs *Ipfs) PubSubSubscribe(topic string) (IPubSubSubscription, error)
PubSubSubscribe subscribes to a topic on IPFS pubsub
type P2PListener ¶
P2PListener is a struct for storing the results of IPFS p2p listen
type PubSubSubscription ¶
type PubSubSubscription ipfsapi.PubSubSubscription
PubSubSubscription is an own version of PubSubSubscription
func (*PubSubSubscription) Cancel ¶
func (sub *PubSubSubscription) Cancel() error
Cancel cancels a pubsub subscription