routeproto

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0, MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublishProtocol = "/fcr-calibr/paynet/route/publish"
	ProtocolVersion = "/0.0.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts struct {
	// The timeout for every network io operation.
	IOTimeout time.Duration

	// The timeout for every internal operation.
	OpTimeout time.Duration

	// The publish frequency
	PublishFreq time.Duration

	// The route expiry
	RouteExpiry time.Duration

	// Initial wait time for publish.
	PublishWait time.Duration
}

Opts is the options for route protocol.

type RouteProtocol

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

RouteProtocol manages route protocol. It handles route publish and share.

func NewRouteProtocol

func NewRouteProtocol(
	h host.Host,
	addrProto *addrproto.AddrProtocol,
	paychProto *paychproto.PaychProtocol,
	signer crypto.Signer,
	peerMgr peermgr.PeerManager,
	pservMgr pservmgr.PaychServingManager,
	rs routestore.RouteStore,
	sbs substore.SubStore,
	opts Opts,
) *RouteProtocol

NewRouteProtocol creates a new route protocol.

@input - host, addr protocol, signer, peer manager, payment serving manager,

route store, subscriber store, options.

@output - route protocol.

func (*RouteProtocol) Publish

func (proto *RouteProtocol) Publish(ctx context.Context, currencyID byte, toAddr string) error

Publish publishes served route to a given peer.

@input - context, currency id, recipient address.

@output - error.

func (*RouteProtocol) Shutdown

func (p *RouteProtocol) Shutdown()

Shutdown safely shuts down the component.

func (*RouteProtocol) StartPublish

func (p *RouteProtocol) StartPublish(ctx context.Context) error

StartPublish publishes the routes to the network immediately.

@input - context.

@output - error.

Jump to

Keyboard shortcuts

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