Documentation ¶
Overview ¶
Package endpoint implements basic consumer and producer functionality.
Endpoint is the basic abstraction through which an application can communicate with the NDN network. It is similar to "client face" in other NDN libraries, with the enhancement that it handles these details automatically:
- Outgoing packets are signed and incoming packets are verified, if keys are provided.
- Outgoing Interests are transmitted periodically, if retransmission policy is specified.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrExpire = errors.New("Interest expired")
)
Error conditions.
View Source
var (
ErrNoHandler = errors.New("Handler is missing")
)
Error conditions.
Functions ¶
Types ¶
type ConsumerOptions ¶
type ConsumerOptions struct { // Fw specifies the L3 Forwarder. // Default is the default Forwarder. Fw l3.Forwarder // Retx specifies retransmission policy. // Default is disabling retransmission. Retx RetxPolicy // Verifier specifies a Data verifier. // Default is no verification. Verifier ndn.Verifier }
ConsumerOptions contains arguments to Consume function.
type ProducerHandler ¶
ProducerHandler is a producer handler function.
- If it returns an error created with ReplyNack(), a Nack is sent in reply to the Interest.
- If it returns a Data that satisfies the Interest, the Data is sent in reply to the Interest.
- Otherwise, nothing is sent.
type ProducerOptions ¶
type ProducerOptions struct { // Prefix is the name prefix of the producer. Prefix ndn.Name // NoAdvertise disables prefix announcement. // Default is announcing the prefix. NoAdvertise bool // Handler is a function to handle Interests under the prefix. // This may be invoked concurrently. Handler ProducerHandler // Fw specifies the L3 Forwarder. // Default is the default Forwarder. Fw l3.Forwarder // DataSigner automatically signs Data packets unless already signed. // Default is keeping the Null signature. DataSigner ndn.Signer }
ProducerOptions contains arguments to Produce function.
type RetxOptions ¶
type RetxOptions struct { // Limit is the maximum number of retransmissions, excluding initial Interest. // Default is 0, which disables retransmissions. Limit int // Interval is the initial retransmission interval. // Default is 50% of InterestLifetime. Interval time.Duration // Randomize causes retransmission interval to be randomized within [1-r, 1+r] range. // Suppose this is set to 0.1, an interval of 100ms would become [90ms, 110ms]. // Default is 0.1. Set a negative value to disable randomization. Randomize float64 // Backoff is the multiplication factor on the interval after each retransmission. // Valid range is [1.0, 2.0]. Default is 1.0. Backoff float64 // Max is the maximum retransmission interval. // Default is 90% of InterestLifetime. Max time.Duration }
RetxOptions specifies how to retransmit an Interest.
func (RetxOptions) IntervalIterable ¶
func (retx RetxOptions) IntervalIterable(lifetime time.Duration) func() time.Duration
IntervalIterable implements RetxPolicy.
Click to show internal directories.
Click to hide internal directories.