Documentation ¶
Overview ¶
Package nfdmgmt provides access to NFD Management API.
Index ¶
Constants ¶
const ( TtControlParameters = 0x68 TtFaceID = 0x69 TtOrigin = 0x6F TtCost = 0x6A TtFlags = 0x6C TtExpirationPeriod = 0x6D TtControlResponse = 0x65 TtStatusCode = 0x66 TtStatusText = 0x67 )
TLV-TYPE assigned numbers.
const ( RouteOriginApp = 0 RouteOriginStatic = 255 RouteOriginClient = 65 RouteOriginAutoReg = 64 )
RouteOrigin assigned numbers.
Variables ¶
var ( PrefixLocalhost = ndn.ParseName("/localhost/nfd") PrefixLocalhop = ndn.ParseName("/localhop/nfd") )
Command prefixes.
Functions ¶
func MakeCommandInterest ¶
func MakeCommandInterest(commandPrefix ndn.Name, cmd ControlCommand) ndn.Interest
MakeCommandInterest constructs a control command Interest without signing.
Types ¶
type Client ¶
Client provides access to NFD Management API.
func (*Client) Invoke ¶
func (c *Client) Invoke(ctx context.Context, cmd ControlCommand) (cr ControlResponse, e error)
Invoke invokes a control command.
func (*Client) OpenFace ¶
OpenFace creates a socket face toward NFD.
Transport type and socket path are read from NDN_CLIENT_TRANSPORT environment variable. However, this does not support client.conf file. https://docs.named-data.net/ndn-cxx/0.8.1/manpages/ndn-client.conf.html
NFD uses in-band management where the prefix registration commands are sent over the same face. To use prefix registration feature, calling code need to: 1. Add the l3.Face to an l3.Forwarder, and set the l3.Forwarder into c.ConsumerOpts if it's not the default. 2. Add a route toward the face for c.Prefix (default is /localhost/nfd). 3. Set c.Signer to a key accepted by NFD (default is digest signing).
type ControlCommand ¶
type ControlCommand interface { Verb() []ndn.NameComponent Parameters() []tlv.Fielder }
ControlCommand represents a NFD control command.
type ControlResponse ¶
ControlResponse represents a NFD control response.
func (*ControlResponse) UnmarshalTLV ¶
func (cr *ControlResponse) UnmarshalTLV(typ uint32, value []byte) error
type RibRegisterCommand ¶
type RibRegisterCommand struct { Name ndn.Name `json:"name"` FaceID int `json:"faceID,omitempty"` Origin int `json:"origin"` Cost int `json:"cost"` NoInherit bool `json:"noInherit"` Capture bool `json:"capture"` Expires nnduration.Milliseconds `json:"expires,omitempty"` }
RibRegisterCommand is a NFD command to register a route.
func (RibRegisterCommand) Parameters ¶
func (cmd RibRegisterCommand) Parameters() (a []tlv.Fielder)
Parameters encodes ControlParameters.
func (RibRegisterCommand) Verb ¶
func (RibRegisterCommand) Verb() []ndn.NameComponent
Verb returns "rib/register".
type RibUnregisterCommand ¶
type RibUnregisterCommand struct { Name ndn.Name `json:"name"` FaceID int `json:"faceID,omitempty"` Origin int `json:"origin"` }
RibUnregisterCommand is a NFD command to unregister a route.
func (RibUnregisterCommand) Parameters ¶
func (cmd RibUnregisterCommand) Parameters() (a []tlv.Fielder)
Parameters encodes ControlParameters.
func (RibUnregisterCommand) Verb ¶
func (RibUnregisterCommand) Verb() []ndn.NameComponent
Verb returns "rib/unregister".