exchange

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Textile Client API URL
	TextileClientURL = "https://api.textile.io"

	// Textile Miner Index Target
	TextileMinerIdx = "api.minerindex.hub.textile.io:443"

	// Textile Mailbox Directory
	TextileMailboxDirName = "mailbox"

	RequestPID protocol.ID = "/exchange/request/0.0.1"

	ResponsePID protocol.ID = "/exchange/response/0.0.1"
)

Textile API definitions

Variables

View Source
var (
	ErrMailboxDisabled  = errors.New("Mailbox not enabled, cannot perform request.")
	ErrMissingAPIKey    = errors.New("Missing Textile API Key in env")
	ErrMissingAPISecret = errors.New("Missing Textile API Secret in env")
	ErrRequestNotFound  = errors.New("Request not found in protocol cache")
	ErrNotSupported     = errors.New("Action not supported for StubMode")
)

Functions

func RequestToEvent

func RequestToEvent(ir *v1.InviteRequest) *motor.OnTransmitInviteResponse

ToEvent method on InviteRequest converts InviteRequest to InviteEvent.

func ResponseToEvent

func ResponseToEvent(ir *v1.InviteResponse) *motor.OnTransmitDecisionResponse

ToEvent method on InviteResponse converts InviteResponse to DecisionEvent.

Types

type ExchangeProtocol

type ExchangeProtocol struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, node node.HostImpl, cb config.CallbackImpl, options ...Option) (*ExchangeProtocol, error)

New creates a new ExchangeProtocol

func (*ExchangeProtocol) Request

func (p *ExchangeProtocol) Request(shareReq *motor.ShareRequest) error

Request Method sends a request to Transfer Data to a remote peer

func (*ExchangeProtocol) Respond

func (p *ExchangeProtocol) Respond(decs bool, to *types.Peer) (*types.Payload, error)

Respond Method authenticates or declines a Transfer Request

type Option

type Option func(*options)

Option is a function that can be applied to ExchangeProtocol config

func EnableMailbox

func EnableMailbox() Option

EnableMailbox enables the mailbox

Jump to

Keyboard shortcuts

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