remote

package
v0.0.0-...-c0cc0bc Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const P2PRemoteCallProto = "/rapi"

Variables

This section is empty.

Functions

func FindPeer

func FindPeer(ctx context.Context, n *core.IpfsNode, pid string) (*peer.AddrInfo, error)

FindPeer decodes a string-based peer id and tries to find it in the current routing table (if not connected, will retry).

func GetStreamRequestRemotePeerID

func GetStreamRequestRemotePeerID(req *cmds.Request, node *core.IpfsNode) (peer.ID, bool)

GetStreamRequestRemotePeerID checks to see if current request is part of a streamedd libp2p connection, if yes, return the remote peer id, otherwise return false.

func P2PCall

func P2PCall(ctx context.Context, n *core.IpfsNode, coreApi iface.CoreAPI, pid peer.ID, api string, args ...interface{}) ([]byte, error)

P2PCall is a wrapper for creating a client and calling a get If passed a nil context, a new one will be created

func P2PCallStrings

func P2PCallStrings(ctx context.Context, n *core.IpfsNode, coreApi iface.CoreAPI, pid peer.ID, api string, strs ...string) ([]byte, error)

P2PCallStrings is a helper to pass string arguments to P2PCall

func UnmarshalResp

func UnmarshalResp(body []byte) (map[string]interface{}, error)

Types

type BusinessError

type BusinessError error

type Call

type Call interface {
	CallGet(context.Context, string, []string) ([]byte, error)
	CallPost()
}

type ErrorMessage

type ErrorMessage struct {
	Message string
	Code    int
	Type    string
}

type IoError

type IoError error

type P2PRemoteCall

type P2PRemoteCall struct {
	Node *core.IpfsNode
	ID   peer.ID
}

func (*P2PRemoteCall) CallGet

func (r *P2PRemoteCall) CallGet(ctx context.Context, api string, args []interface{}) ([]byte, error)

func (*P2PRemoteCall) CallPost

func (r *P2PRemoteCall) CallPost()

type RemoteCall

type RemoteCall struct {
	URL string
	ID  string
}

func (*RemoteCall) CallGet

func (r *RemoteCall) CallGet(ctx context.Context, api string, args []string) ([]byte, error)

func (*RemoteCall) CallPost

func (r *RemoteCall) CallPost()

Jump to

Keyboard shortcuts

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