Documentation
¶
Index ¶
- Constants
- type Opts
- type PaychProtocol
- func (proto *PaychProtocol) Add(ctx context.Context, chAddr string, offer fcroffer.PaychOffer) error
- func (p *PaychProtocol) DeregisterPublishHook()
- func (proto *PaychProtocol) QueryAdd(ctx context.Context, currencyID byte, toAddr string) (fcroffer.PaychOffer, error)
- func (p *PaychProtocol) RegisterPublishFunc(hook func(byte, string))
- func (proto *PaychProtocol) Renew(ctx context.Context, currencyID byte, toAddr string, chAddr string) error
- func (p *PaychProtocol) Shutdown()
Constants ¶
const ( QueryAddProtocol = "/fcr-calibr/paynet/paych/query" AddProtocol = "/fcr-calibr/paynet/paych/add" RenewProtocol = "/fcr-calibr/paynet/paych/renew" 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 offer expiry time. OfferExpiry time.Duration // The renew window. RenewWindow uint64 }
Opts is the options for paych protocol.
type PaychProtocol ¶
type PaychProtocol struct {
// contains filtered or unexported fields
}
PaychProtocol manages paych protocol. It handles paych creation and renew.
func NewPaychProtocol ¶
func NewPaychProtocol( h host.Host, addrProto *addrproto.AddrProtocol, signer crypto.Signer, peerMgr peermgr.PeerManager, offerMgr offermgr.OfferManager, settleMgr settlemgr.SettlementManager, renewMgr renewmgr.RenewManager, payMgr paymgr.PaymentManager, monitor paychmon.PaychMonitor, opts Opts, ) *PaychProtocol
NewPaychProtocol creates a new paych protocol.
@input - host, addr protocol, signer, peer manager, offer manager, settlement manager,
renew manager, payment manager, options.
@output - paych protocol.
func (*PaychProtocol) Add ¶
func (proto *PaychProtocol) Add(ctx context.Context, chAddr string, offer fcroffer.PaychOffer) error
Add asks peer to add a created payment channel based on received offer.
@input - context, paych address, paych offer.
@output - error.
func (*PaychProtocol) DeregisterPublishHook ¶
func (p *PaychProtocol) DeregisterPublishHook()
DeregisterPublishHook deregister the hook function.
func (*PaychProtocol) QueryAdd ¶
func (proto *PaychProtocol) QueryAdd(ctx context.Context, currencyID byte, toAddr string) (fcroffer.PaychOffer, error)
QueryAdd queries a peer for a paych offer before creating and adding a payment channel.
@input - context, currency id, recipient address.
@output - paych offer, error.
func (*PaychProtocol) RegisterPublishFunc ¶
func (p *PaychProtocol) RegisterPublishFunc(hook func(byte, string))
RegisterPublishHook adds a hook function to call when a new subscriber presents.
@input - hook function.
func (*PaychProtocol) Renew ¶
func (proto *PaychProtocol) Renew(ctx context.Context, currencyID byte, toAddr string, chAddr string) error
Renew renews a payment channel and ask peer to add it.
@input - context, currency id, to address, channel address.
@output - error.
func (*PaychProtocol) Shutdown ¶
func (p *PaychProtocol) Shutdown()
Shutdown safely shuts down the component.