ndn

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 23 Imported by: 4

README

Go Forwarder Library for YaNFD

This library implements the Named Data Networking packet format for with with the YaNFD forwarder.

Features Implemented and Planned

TLV
  • TLV encoding and decoding
Network Packets
  • Congestion marking
  • Data
  • Interest
  • Link Object (planned)
  • Names
  • Signatures
    • Data signatures
    • Signed Interests (planned)
  • NDNLPv2
    • Encoding and decoding
Security (tentative)
  • Certificates (planned)
  • Encryption and Decryption (not currently planned)
  • Signing/Validation (in progress)
    • SHA256
    • SHA256-RSA (planned)
    • SHA256-ECDSA (planned)
    • HMAC-SHA256 (planned)
  • Trust schemas (not currently planned)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseNameComponent

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

BaseNameComponent represents a name component without a specialized type.

func NewBaseNameComponent

func NewBaseNameComponent(tlvType uint16, value []byte) *BaseNameComponent

NewBaseNameComponent creates a name component of an arbitrary type.

func (*BaseNameComponent) DeepCopy

func (n *BaseNameComponent) DeepCopy() NameComponent

DeepCopy makes a deep copy of the name component.

func (*BaseNameComponent) Encode

func (n *BaseNameComponent) Encode() *tlv.Block

Encode encodes the name component into a block.

func (*BaseNameComponent) Equals

func (n *BaseNameComponent) Equals(other NameComponent) bool

Equals returns whether the two name components match.

func (*BaseNameComponent) String

func (n *BaseNameComponent) String() string

func (*BaseNameComponent) Type

func (n *BaseNameComponent) Type() uint16

Type returns the TLV type of the name component.

func (*BaseNameComponent) Value

func (n *BaseNameComponent) Value() []byte

Value returns the TLV value of the name component.

type ByteOffsetNameComponent

type ByteOffsetNameComponent struct {
	BaseNameComponent
	// contains filtered or unexported fields
}

ByteOffsetNameComponent is a component containing a byte offset.

func DecodeByteOffsetNameComponent

func DecodeByteOffsetNameComponent(value []byte) *ByteOffsetNameComponent

DecodeByteOffsetNameComponent decodes a ByteOffsetNameComponent from a TLV wire value.

func NewByteOffsetNameComponent

func NewByteOffsetNameComponent(value uint64) *ByteOffsetNameComponent

NewByteOffsetNameComponent creates a new ByteOffsetNameComponent.

func (*ByteOffsetNameComponent) DeepCopy

func (n *ByteOffsetNameComponent) DeepCopy() NameComponent

DeepCopy creates a deep copy of the name component.

func (*ByteOffsetNameComponent) SetValue

func (n *ByteOffsetNameComponent) SetValue(value uint64)

SetValue sets the value of a ByteOffsetNameComponent.

func (*ByteOffsetNameComponent) String

func (n *ByteOffsetNameComponent) String() string

type Data

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

Data represents an NDN Data packet.

func DecodeData

func DecodeData(wire *tlv.Block, shouldValidateSignature bool) (*Data, error)

DecodeData decodes a Data packet from the wire.

func NewData

func NewData(name *Name, content []byte) *Data

NewData creates a new Data packet with the given name and content.

func (*Data) Content

func (d *Data) Content() []byte

Content returns a copy of the content in the Data packet.

func (*Data) Encode

func (d *Data) Encode() (*tlv.Block, error)

Encode encodes the Data into a block.

func (*Data) HasWire

func (d *Data) HasWire() bool

HasWire returns whether the Data packet has an existing valid wire encoding.

func (*Data) MetaInfo

func (d *Data) MetaInfo() *MetaInfo

MetaInfo returns the MetaInfo of the Data packet.

func (*Data) Name

func (d *Data) Name() *Name

Name returns the name of the Data packet.

func (*Data) PitToken

func (d *Data) PitToken() int

PitToken returns the PIT token attached to the Data (if any).

func (*Data) SetContent

func (d *Data) SetContent(content []byte)

SetContent sets the content of the Data packet.

func (*Data) SetMetaInfo

func (d *Data) SetMetaInfo(metaInfo *MetaInfo)

SetMetaInfo sets the MetaInfo of the Data packet.

func (*Data) SetName

func (d *Data) SetName(name *Name)

SetName sets the name of the Data packet.

func (*Data) SetPitToken

func (d *Data) SetPitToken(pitToken int)

SetPitToken sets the PIT token attached to the Data.

func (*Data) SetSignatureInfo

func (d *Data) SetSignatureInfo(sigInfo *SignatureInfo)

SetSignatureInfo sets the SignatureInfo in the Data packet.

func (*Data) ShouldValidateSignature

func (d *Data) ShouldValidateSignature() bool

ShouldValidateSignature returns whether signature validation is enabled for this Data.

func (*Data) SignatureInfo

func (d *Data) SignatureInfo() *SignatureInfo

SignatureInfo returns a copy of the SignatureInfo in the Data packet.

func (*Data) SignatureValue

func (d *Data) SignatureValue() []byte

SignatureValue returns a copy of the SignatureValue in the Data packet. If the signature has not yet been calculated,

func (*Data) String

func (d *Data) String() string

type Delegation

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

Delegation contains a Link Object delegation.

func DecodeDelegation

func DecodeDelegation(wire *tlv.Block) (*Delegation, error)

DecodeDelegation decodes a delegation from the wire.

func NewDelegation

func NewDelegation(preference uint64, name *Name) (*Delegation, error)

NewDelegation creates a new delegation.

func (*Delegation) Encode

func (d *Delegation) Encode() *tlv.Block

Encode encodes the delegation into a block.

func (*Delegation) Name

func (d *Delegation) Name() *Name

Name returns a copy of the name set in the delegation.

func (*Delegation) Preference

func (d *Delegation) Preference() uint64

Preference returns the preference set in the delegation.

func (*Delegation) SetName

func (d *Delegation) SetName(name *Name)

SetName sets the name in the delegation.

func (*Delegation) SetPreference

func (d *Delegation) SetPreference(preference uint64)

SetPreference sets the preference in the delegation.

func (*Delegation) String

func (d *Delegation) String() string

type GenericNameComponent

type GenericNameComponent struct {
	BaseNameComponent
}

GenericNameComponent represents a generic NDN name component.

func NewGenericNameComponent

func NewGenericNameComponent(value []byte) *GenericNameComponent

NewGenericNameComponent creates a new GenericNameComponent.

func (*GenericNameComponent) DeepCopy

func (n *GenericNameComponent) DeepCopy() NameComponent

DeepCopy creates a deep copy of the name component.

func (*GenericNameComponent) SetValue

func (n *GenericNameComponent) SetValue(value []byte)

SetValue sets the value of a GenericNameComponent.

func (*GenericNameComponent) String

func (n *GenericNameComponent) String() string

type ImplicitSha256DigestComponent

type ImplicitSha256DigestComponent struct {
	BaseNameComponent
}

ImplicitSha256DigestComponent represents an implicit SHA-256 digest component.

func NewImplicitSha256DigestComponent

func NewImplicitSha256DigestComponent(value []byte) *ImplicitSha256DigestComponent

NewImplicitSha256DigestComponent creates a new ImplicitSha256DigestComponent.

func (*ImplicitSha256DigestComponent) DeepCopy

DeepCopy creates a deep copy of the name component.

func (*ImplicitSha256DigestComponent) SetValue

func (n *ImplicitSha256DigestComponent) SetValue(value []byte) error

SetValue sets the value of an ImplicitSha256DigestComponent.

func (*ImplicitSha256DigestComponent) String

type Interest

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

Interest represents an NDN Interest packet.

func DecodeInterest

func DecodeInterest(wire *tlv.Block) (*Interest, error)

DecodeInterest decodes an Interest from the wire.

func NewInterest

func NewInterest(name *Name) *Interest

NewInterest creates a new Interest with the specified name and default values.

func (*Interest) AppendApplicationParameter

func (i *Interest) AppendApplicationParameter(block *tlv.Block)

AppendApplicationParameter appends an application parameter to the Interest. If not already present (or the type of the parameter block specified), it adds an empty ApplicationParameters block before appending this block.

func (*Interest) ApplicationParameters

func (i *Interest) ApplicationParameters() []tlv.Block

ApplicationParameters returns a copy of the application parameters of the Interest.

func (*Interest) CanBePrefix

func (i *Interest) CanBePrefix() bool

CanBePrefix returns whether the Interest can be satisfied by a Data packet whos name the Interest name is a prefix of.

func (*Interest) ClearApplicationParameters

func (i *Interest) ClearApplicationParameters()

ClearApplicationParameters clears all ApplicationParameters from the Interest.

func (*Interest) Encode

func (i *Interest) Encode() (*tlv.Block, error)

Encode encodes the data into a block.

func (*Interest) ForwardingHint

func (i *Interest) ForwardingHint() []*Name

ForwardingHint returns the ForwardingHint. The return value should not be modified.

func (*Interest) HasWire

func (i *Interest) HasWire() bool

HasWire returns whether a wire encoding exists for the Interest.

func (*Interest) HopLimit

func (i *Interest) HopLimit() *uint8

HopLimit returns the hop limit of the Interest or nil if no hop limit is set.

func (*Interest) Lifetime

func (i *Interest) Lifetime() time.Duration

Lifetime returns the lifetime of the Interest.

func (*Interest) MustBeFresh

func (i *Interest) MustBeFresh() bool

MustBeFresh returns whether the Interest can only be satisfied by "fresh" Data packets.

func (*Interest) Name

func (i *Interest) Name() *Name

Name returns the name of the Interest.

func (*Interest) Nonce

func (i *Interest) Nonce() []byte

Nonce gets the nonce of the Interest.

func (*Interest) ResetNonce

func (i *Interest) ResetNonce()

ResetNonce regenerates the value of the nonce.

func (*Interest) SetCanBePrefix

func (i *Interest) SetCanBePrefix(canBePrefix bool)

SetCanBePrefix sets whether the Interest can be satisfied by a Data packet whos name the Interest name is a prefix of.

func (*Interest) SetForwardingHint

func (i *Interest) SetForwardingHint(fh []*Name)

SetForwardingHint replaces the ForwardingHint.

func (*Interest) SetHopLimit

func (i *Interest) SetHopLimit(hopLimit uint8)

SetHopLimit sets the hop limit of the Interest.

func (*Interest) SetLifetime

func (i *Interest) SetLifetime(lifetime time.Duration)

SetLifetime set the lifetime of the Interest.

func (*Interest) SetMustBeFresh

func (i *Interest) SetMustBeFresh(mustBeFresh bool)

SetMustBeFresh sets whether the Interest can only be satisfied by "fresh" Data packets.

func (*Interest) SetName

func (i *Interest) SetName(name *Name)

SetName sets the name of the Interest.

func (*Interest) SetNonce

func (i *Interest) SetNonce(nonce []byte) error

SetNonce sets the nonce to the specified value. If not exactly 4 bytes, an error is returned.

func (*Interest) String

func (i *Interest) String() string

func (*Interest) UnsetHopLimit

func (i *Interest) UnsetHopLimit()

UnsetHopLimit unsets the hop limit of the Interest.

type KeywordNameComponent

type KeywordNameComponent struct {
	BaseNameComponent
}

KeywordNameComponent is a component containing a well-known keyword.

func NewKeywordNameComponent

func NewKeywordNameComponent(value []byte) *KeywordNameComponent

NewKeywordNameComponent creates a new KeywordNameComponent.

func (*KeywordNameComponent) DeepCopy

func (n *KeywordNameComponent) DeepCopy() NameComponent

DeepCopy creates a deep copy of the name component.

func (*KeywordNameComponent) SetValue

func (n *KeywordNameComponent) SetValue(value []byte)

SetValue sets the value of a KeywordNameComponent.

func (*KeywordNameComponent) String

func (n *KeywordNameComponent) String() string

type LinkObject

type LinkObject struct {
	Data
}

LinkObject is a specialized Data packet containing delegation information.

type LinkType

type LinkType int

LinkType indicates what type of link a face is.

const (
	// PointToPoint is a face with one remote endpoint.
	PointToPoint LinkType = 0
	// MultiAccess is a face that communicates with a multicast group.
	MultiAccess LinkType = 1
	// AdHoc communicates on a wireless ad-hoc network.
	AdHoc LinkType = 2
)

type MetaInfo

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

MetaInfo represents the MetaInfo in a Data packet.

func DecodeMetaInfo

func DecodeMetaInfo(wire *tlv.Block) (*MetaInfo, error)

DecodeMetaInfo decodes a MetaInfo from a block.

func NewMetaInfo

func NewMetaInfo() *MetaInfo

NewMetaInfo creates a new MetaInfo structure.

func (*MetaInfo) ContentType

func (m *MetaInfo) ContentType() *uint64

ContentType returns the ContentType set in the MetaInfo.

func (*MetaInfo) Encode

func (m *MetaInfo) Encode() (*tlv.Block, error)

Encode encodes the MetaInfo into a block.

func (*MetaInfo) FinalBlockID

func (m *MetaInfo) FinalBlockID() NameComponent

FinalBlockID returns the FinalBlockId set in the MetaInfo.

func (*MetaInfo) FreshnessPeriod

func (m *MetaInfo) FreshnessPeriod() *time.Duration

FreshnessPeriod returns the FreshnessPeriod set in the MetaInfo.

func (*MetaInfo) HasWire

func (m *MetaInfo) HasWire() bool

HasWire returns whether the MetaInfo has an existing valid wire encoding.

func (*MetaInfo) SetContentType

func (m *MetaInfo) SetContentType(contentType uint64)

SetContentType sets the ContentType in the MetaInfo.

func (*MetaInfo) SetFinalBlockID

func (m *MetaInfo) SetFinalBlockID(finalBlockID NameComponent)

SetFinalBlockID sets the FinalBlockId in the MetaInfo.

func (*MetaInfo) SetFreshnessPeriod

func (m *MetaInfo) SetFreshnessPeriod(freshnessPeriod time.Duration)

SetFreshnessPeriod sets the FreshnessPeriod in the MetaInfo.

func (*MetaInfo) String

func (m *MetaInfo) String() string

func (*MetaInfo) UnsetContentType

func (m *MetaInfo) UnsetContentType()

UnsetContentType unsets the ContentType in the MetaInfo.

func (*MetaInfo) UnsetFinalBlockID

func (m *MetaInfo) UnsetFinalBlockID()

UnsetFinalBlockID unsets the FinalBlockId in the MetaInfo.

func (*MetaInfo) UnsetFreshnessPeriod

func (m *MetaInfo) UnsetFreshnessPeriod()

UnsetFreshnessPeriod unsets the FreshnessPeriod in the MetaInfo.

type Name

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

Name represents an NDN name.

func DecodeName

func DecodeName(b *tlv.Block) (*Name, error)

DecodeName decodes a name from wire encoding.,

func NameFromString

func NameFromString(str string) (*Name, error)

NameFromString decodes a name from a string.

func NewName

func NewName() *Name

NewName constructs an empty name.

func (*Name) Append

func (n *Name) Append(component NameComponent) *Name

Append adds the specified name component to the end of the name.

func (*Name) At

func (n *Name) At(index int) NameComponent

At returns the name component at the specified index. If out of range, nil is returned.

func (*Name) Clear

func (n *Name) Clear()

Clear erases all components from the name.

func (*Name) Compare

func (n *Name) Compare(other *Name) int

Compare returns the canonical order of this name against the the specified other name.

func (*Name) DeepCopy

func (n *Name) DeepCopy() *Name

DeepCopy returns a deep copy of the name.

func (*Name) Encode

func (n *Name) Encode() *tlv.Block

Encode encodes the name into a bock.

func (*Name) Equals

func (n *Name) Equals(other *Name) bool

Equals returns whether the specified name is equal to this name.

func (*Name) Erase

func (n *Name) Erase(index int) error

Erase erases the specified name component. If out of range, no action is taken.

func (*Name) Find

func (n *Name) Find(tlvType uint16) (int, NameComponent)

Find returns the first name component with the specified type, as well as its index.

func (*Name) HasWire

func (n *Name) HasWire() bool

HasWire returns whether the name has a wire encoding.

func (*Name) Insert

func (n *Name) Insert(index int, component NameComponent) error

Insert inserts a name component at the specified index.

func (*Name) Prefix

func (n *Name) Prefix(size int) *Name

Prefix returns a name prefix of the specified number of components. If greater than or equal to the size of the name, this returns a copy of the name.

func (*Name) PrefixOf

func (n *Name) PrefixOf(other *Name) bool

PrefixOf returns whether this name is a prefix of the specified name.

func (*Name) Set

func (n *Name) Set(index int, component NameComponent) error

Set replaces the component at the specified index with the specified component.

func (*Name) Size

func (n *Name) Size() int

Size returns the number of components in the name.

func (*Name) String

func (n *Name) String() string

type NameComponent

type NameComponent interface {
	String() string
	DeepCopy() NameComponent
	Type() uint16
	Value() []byte
	Equals(other NameComponent) bool
	Encode() *tlv.Block
}

NameComponent represents an NDN name component.

func DecodeNameComponent

func DecodeNameComponent(wire *tlv.Block) (NameComponent, error)

DecodeNameComponent decodes a name component from the wire.

type ParametersSha256DigestComponent

type ParametersSha256DigestComponent struct {
	BaseNameComponent
}

ParametersSha256DigestComponent represents a component containing the SHA-256 digest of the Interest parameters.

func NewParametersSha256DigestComponent

func NewParametersSha256DigestComponent(value []byte) *ParametersSha256DigestComponent

NewParametersSha256DigestComponent creates a new ParametersSha256DigestComponent.

func (*ParametersSha256DigestComponent) DeepCopy

DeepCopy creates a deep copy of the name component.

func (*ParametersSha256DigestComponent) SetValue

func (n *ParametersSha256DigestComponent) SetValue(value []byte) error

SetValue sets the value of an ParametersSha256DigestComponent.

func (*ParametersSha256DigestComponent) String

type PendingPacket

type PendingPacket struct {
	PitToken       []byte
	CongestionMark *uint64
	IncomingFaceID *uint64
	NextHopFaceID  *uint64
	CachePolicy    *uint64
	EncPacket      *spec.Packet
	RawBytes       enc.Wire
	NameCache      string
}

PendingPacket represents a pending network-layer packet to be sent or recently received on the link, plus any associated metadata.

type PrefixAnnouncement

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

PrefixAnnouncement is a specially-formatted Data packet used by applications to announce prefixes they produce.

func DecodePrefixAnnouncement

func DecodePrefixAnnouncement(wire *tlv.Block) (*PrefixAnnouncement, error)

DecodePrefixAnnouncement decodes a prefix announcement from the wire.

func NewPrefixAnnouncement

func NewPrefixAnnouncement(data *Data) (*PrefixAnnouncement, error)

NewPrefixAnnouncement creates a prefix announcement from a data packet.

func (*PrefixAnnouncement) ExpirationPeriod

func (p *PrefixAnnouncement) ExpirationPeriod() uint64

ExpirationPeriod returns the expiration period contained in the prefix announcement.

func (*PrefixAnnouncement) Prefix

func (p *PrefixAnnouncement) Prefix() *Name

Prefix returns the prefix announced by the the prefix announcement.

func (*PrefixAnnouncement) Valid

func (p *PrefixAnnouncement) Valid() bool

Valid returns whether the PrefixAnnouncement is validly formatted.

func (*PrefixAnnouncement) ValidityPeriod

func (p *PrefixAnnouncement) ValidityPeriod() (time.Time, time.Time)

ValidityPeriod returns the validity period contained in the prefix announcement. If unset, returns 0 time for both values.

type Scope

type Scope int

Scope indicates the scope of a face

const (
	// Unknown indicates that the scope is unknown.
	Unknown Scope = -1
	// NonLocal indicates the face is non-local (to another forwarder).
	NonLocal Scope = 0
	// Local indicates the face is local (to an application).
	Local Scope = 1
)

type SegmentNameComponent

type SegmentNameComponent struct {
	BaseNameComponent
	// contains filtered or unexported fields
}

SegmentNameComponent is a component containing a segment number.

func DecodeSegmentNameComponent

func DecodeSegmentNameComponent(value []byte) *SegmentNameComponent

DecodeSegmentNameComponent decodes a SegmentNameComponent from a TLV wire value.

func NewSegmentNameComponent

func NewSegmentNameComponent(value uint64) *SegmentNameComponent

NewSegmentNameComponent creates a new SegmentNameComponent.

func (*SegmentNameComponent) DeepCopy

func (n *SegmentNameComponent) DeepCopy() NameComponent

DeepCopy creates a deep copy of the name component.

func (*SegmentNameComponent) SetValue

func (n *SegmentNameComponent) SetValue(value uint64)

SetValue sets the value of a KeywordNameComponent.

func (*SegmentNameComponent) String

func (n *SegmentNameComponent) String() string

type SequenceNumNameComponent

type SequenceNumNameComponent struct {
	BaseNameComponent
	// contains filtered or unexported fields
}

SequenceNumNameComponent is a component containing a sequence number.

func DecodeSequenceNumNameComponent

func DecodeSequenceNumNameComponent(value []byte) *SequenceNumNameComponent

DecodeSequenceNumNameComponent decodes a SequenceNumNameComponent from a TLV wire value.

func NewSequenceNumNameComponent

func NewSequenceNumNameComponent(value uint64) *SequenceNumNameComponent

NewSequenceNumNameComponent creates a new SequenceNumNameComponent.

func (*SequenceNumNameComponent) DeepCopy

DeepCopy creates a deep copy of the name component.

func (*SequenceNumNameComponent) SetValue

func (n *SequenceNumNameComponent) SetValue(value uint64)

SetValue sets the value of a SequenceNumNameComponent.

func (*SequenceNumNameComponent) String

func (n *SequenceNumNameComponent) String() string

type SignatureInfo

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

SignatureInfo represents either the SignatureInfo (for Data packets) or InterestSignatureInfo blocks.

func DecodeSignatureInfo

func DecodeSignatureInfo(wire *tlv.Block) (*SignatureInfo, error)

DecodeSignatureInfo decodes a SignatureInfo or InterestSignatureInfo from the wire.

func NewInterestSignatureInfo

func NewInterestSignatureInfo(signatureType security.SignatureType) *SignatureInfo

NewInterestSignatureInfo creates a new InterestSignatureInfo.

func NewSignatureInfo

func NewSignatureInfo(signatureType security.SignatureType) *SignatureInfo

NewSignatureInfo creates a new SignatureInfo for a Data packet.

func (*SignatureInfo) Encode

func (s *SignatureInfo) Encode() (*tlv.Block, error)

Encode encodes the SignatureInfo (or InterestSignatureInfo) into a block.

func (*SignatureInfo) HasWire

func (s *SignatureInfo) HasWire() bool

HasWire returns whether a valid up-to-date wire encoding exists for the SignatureInfo.

func (*SignatureInfo) Interest

func (s *SignatureInfo) Interest() bool

Interest returns true if this is an InterestSignatureInfo and false if it is a SignatureInfo (for Data packets).

func (*SignatureInfo) KeyLocator

func (s *SignatureInfo) KeyLocator() *tlv.Block

KeyLocator returns the KeyLocator of the signature.

func (*SignatureInfo) Nonce

func (s *SignatureInfo) Nonce() []byte

Nonce returns the SignatureNonce of the signature.

func (*SignatureInfo) SeqNum

func (s *SignatureInfo) SeqNum() *uint64

SeqNum returns the SignatureSeqNum of the signature.

func (*SignatureInfo) SetKeyLocator

func (s *SignatureInfo) SetKeyLocator(keyLocator *tlv.Block)

SetKeyLocator sets the KeyLocator of the signature.

func (*SignatureInfo) SetNonce

func (s *SignatureInfo) SetNonce(nonce []byte)

SetNonce sets the SignatureNonce of the signature.

func (*SignatureInfo) SetSeqNum

func (s *SignatureInfo) SetSeqNum(seqNum uint64)

SetSeqNum sets the SignatureSeqNum of the signature.

func (*SignatureInfo) SetTime

func (s *SignatureInfo) SetTime(newTime *time.Time)

SetTime sets the SignatureTime of the signature.

func (*SignatureInfo) SetType

func (s *SignatureInfo) SetType(signatureType security.SignatureType)

SetType sets the type of the signature.

func (*SignatureInfo) String

func (s *SignatureInfo) String() string

func (*SignatureInfo) Time

func (s *SignatureInfo) Time() *time.Time

Time returns the SignatureTime of the signature.

func (*SignatureInfo) Type

Type returns the type of the signature.

func (*SignatureInfo) UnsetKeyLocator

func (s *SignatureInfo) UnsetKeyLocator()

UnsetKeyLocator unsets the KeyLocator of the signature.

func (*SignatureInfo) UnsetNonce

func (s *SignatureInfo) UnsetNonce()

UnsetNonce unsets the SignatureNonce of the signature.

func (*SignatureInfo) UnsetSeqNum

func (s *SignatureInfo) UnsetSeqNum()

UnsetSeqNum unsets the SignatureSeqNum of the signature.

func (*SignatureInfo) UnsetTime

func (s *SignatureInfo) UnsetTime()

UnsetTime unsets the SignatureTime of the signature.

type State

type State int

State indicates the state of a face

const (
	// Up indicates the face is up
	Up State = iota
	// Down indicates the face is down
	Down State = iota
	// AdminDown indicates the face is administratively down
	AdminDown State = iota
)

func (State) String

func (s State) String() string

type TimestampNameComponent

type TimestampNameComponent struct {
	BaseNameComponent
	// contains filtered or unexported fields
}

TimestampNameComponent is a component containing a Unix timestamp (in microseconds).

func DecodeTimestampNameComponent

func DecodeTimestampNameComponent(value []byte) *TimestampNameComponent

DecodeTimestampNameComponent decodes a TimestampNameComponent from a TLV wire value.

func NewTimestampNameComponent

func NewTimestampNameComponent(value uint64) *TimestampNameComponent

NewTimestampNameComponent creates a new TimestampNameComponent.

func (*TimestampNameComponent) DeepCopy

func (n *TimestampNameComponent) DeepCopy() NameComponent

DeepCopy creates a deep copy of the name component.

func (*TimestampNameComponent) SetValue

func (n *TimestampNameComponent) SetValue(value uint64)

SetValue sets the value of a TimestampNameComponent.

func (*TimestampNameComponent) String

func (n *TimestampNameComponent) String() string

type URI

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

URI represents a URI for a face.

func DecodeURIString

func DecodeURIString(str string) *URI

DecodeURIString decodes a URI from a string.

func MakeDevFaceURI

func MakeDevFaceURI(ifname string) *URI

MakeDevFaceURI constucts a URI for a network interface.

func MakeEthernetFaceURI

func MakeEthernetFaceURI(mac net.HardwareAddr) *URI

MakeEthernetFaceURI constructs a URI for an Ethernet face.

func MakeFDFaceURI

func MakeFDFaceURI(fd int) *URI

MakeFDFaceURI constructs a file descriptor URI.

func MakeInternalFaceURI

func MakeInternalFaceURI() *URI

MakeInternalFaceURI constructs an internal face URI.

func MakeNullFaceURI

func MakeNullFaceURI() *URI

MakeNullFaceURI constructs a null face URI.

func MakeTCPFaceURI

func MakeTCPFaceURI(ipVersion int, host string, port uint16) *URI

MakeTCPFaceURI constructs a URI for a TCP face.

func MakeUDPFaceURI

func MakeUDPFaceURI(ipVersion int, host string, port uint16) *URI

MakeUDPFaceURI constructs a URI for a UDP face.

func MakeUnixFaceURI

func MakeUnixFaceURI(path string) *URI

MakeUnixFaceURI constructs a URI for a Unix face.

func MakeWebSocketClientFaceURI

func MakeWebSocketClientFaceURI(addr net.Addr) *URI

MakeWebSocketClientFaceURI constructs a URI for a WebSocket server.

func MakeWebSocketServerFaceURI

func MakeWebSocketServerFaceURI(u *url.URL) *URI

MakeWebSocketServerFaceURI constructs a URI for a WebSocket server.

func (*URI) Canonize

func (u *URI) Canonize() error

Canonize attempts to canonize the URI, if not already canonical.

func (*URI) IsCanonical

func (u *URI) IsCanonical() bool

IsCanonical returns whether the face URI is canonical.

func (*URI) Path

func (u *URI) Path() string

Path returns the path of the face URI.

func (*URI) PathHost

func (u *URI) PathHost() string

PathHost returns the host component of the path of the face URI.

func (*URI) PathZone

func (u *URI) PathZone() string

PathZone returns the zone component of the path of the face URI.

func (*URI) Port

func (u *URI) Port() uint16

Port returns the port of the face URI.

func (*URI) Scheme

func (u *URI) Scheme() string

Scheme returns the scheme of the face URI.

func (*URI) Scope

func (u *URI) Scope() Scope

Scope returns the scope of the URI.

func (*URI) String

func (u *URI) String() string

func (*URI) URIType

func (u *URI) URIType() URIType

URIType returns the type of the face URI.

type URIType

type URIType int

URIType represents the type of the URI.

type VersionNameComponent

type VersionNameComponent struct {
	BaseNameComponent
	// contains filtered or unexported fields
}

VersionNameComponent is a component containing a version number.

func DecodeVersionNameComponent

func DecodeVersionNameComponent(value []byte) *VersionNameComponent

DecodeVersionNameComponent decodes a VersionNameComponent from a TLV wire value.

func NewVersionNameComponent

func NewVersionNameComponent(value uint64) *VersionNameComponent

NewVersionNameComponent creates a new VersionNameComponent.

func (*VersionNameComponent) DeepCopy

func (n *VersionNameComponent) DeepCopy() NameComponent

DeepCopy creates a deep copy of the name component.

func (*VersionNameComponent) SetValue

func (n *VersionNameComponent) SetValue(value uint64)

SetValue sets the value of a VersionNameComponent.

func (*VersionNameComponent) String

func (n *VersionNameComponent) String() string

func (*VersionNameComponent) Version

func (n *VersionNameComponent) Version() uint64

Version returns the version contained in the name component.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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