Documentation ¶
Index ¶
- Constants
- type AddrProtocol
- func (p *AddrProtocol) ConnectToPeer(ctx context.Context, currencyID byte, toAddr string) (peer.ID, error)
- func (p *AddrProtocol) Publish(ctx context.Context) error
- func (proto *AddrProtocol) QueryAddr(ctx context.Context, currencyID byte, pi peer.AddrInfo) (string, error)
- func (p *AddrProtocol) Shutdown()
- type Opts
Constants ¶
const ( QueryAddrProtocol = "/fcr-calibr/peernet/addr/query" ProtocolVersion = "/0.0.1" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddrProtocol ¶
type AddrProtocol struct {
// contains filtered or unexported fields
}
AddrProtocol manages addr protocol. It handles resolving peer addr.
func NewAddrProtocol ¶
func NewAddrProtocol( h host.Host, dht *dual.DHT, signer crypto.Signer, peerMgr peermgr.PeerManager, opts Opts, ) *AddrProtocol
NewAddrProtocol creates a new addr protocol.
@input - host, dht, signer, peer manager.
func (*AddrProtocol) ConnectToPeer ¶
func (p *AddrProtocol) ConnectToPeer(ctx context.Context, currencyID byte, toAddr string) (peer.ID, error)
ConnectToPeer attempts to establish a connection to peer with given currency id and recipient address pair.
@input - context, operation timeout, io timeout, currency id, to addr.
@output - peer addr id, error.
func (*AddrProtocol) Publish ¶
func (p *AddrProtocol) Publish(ctx context.Context) error
Publish the presence to the network immediately.
@input - context.
@output - error.
func (*AddrProtocol) QueryAddr ¶
func (proto *AddrProtocol) QueryAddr(ctx context.Context, currencyID byte, pi peer.AddrInfo) (string, error)
QueryAddr is used to query the recipient address of given currency id for a given peer address.
@input - context, currency id, peer address.
@output - recipient address, error.
func (*AddrProtocol) Shutdown ¶
func (p *AddrProtocol) Shutdown()
Shutdown safely shuts down the component.