demo

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Basic custom nodes for test and demo use. Not secure for production.

Basic policies for test and demo use. Not secure for production. The TODO points listed here are all design questions we need to decide before production-ready code.

Generated by the generator, DO NOT modify manually

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFixedKeyIntSigner

func NewFixedKeyIntSigner(key []byte) schema.NTPolicy

func NewFixedKeySigner

func NewFixedKeySigner(key []byte) schema.NTPolicy

func NewLocalOnlyPolicy

func NewLocalOnlyPolicy() schema.NTPolicy

func NewMemStoragePolicy

func NewMemStoragePolicy() schema.NTPolicy

func NewRegisterPolicy

func NewRegisterPolicy() schema.NTPolicy

func NewRegisterPolicy2

func NewRegisterPolicy2(matching enc.Matching) schema.NTPolicy

Types

type CacheEntry

type CacheEntry struct {
	RawData  enc.Wire
	Validity time.Time
}

type ContentKeyNode

type ContentKeyNode struct {
	schema.BaseNode
	// contains filtered or unexported fields
}

ContentKeyNode is a proof-of-concept demo to show how NTSchema can support NAC For simplicity we don't use KEK and KDK here.

func (*ContentKeyNode) Decrypt

func (n *ContentKeyNode) Decrypt(matching enc.Matching, content enc.Wire) (enc.Wire, error)

func (*ContentKeyNode) Encrypt

func (n *ContentKeyNode) Encrypt(matching enc.Matching, ckid []byte, content enc.Wire) (enc.Wire, error)

func (*ContentKeyNode) GenKey

func (n *ContentKeyNode) GenKey(matching enc.Matching) []byte

func (*ContentKeyNode) Init

func (n *ContentKeyNode) Init(parent schema.NTNode, edge enc.ComponentPattern)

type FixedKeyIntSigner

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

FixedKeyIntSigner is a demo policy that signs Interests using provided HMAC key.

func (*FixedKeyIntSigner) Apply

func (p *FixedKeyIntSigner) Apply(node schema.NTNode) error

func (*FixedKeyIntSigner) ComputeSigValue

func (p *FixedKeyIntSigner) ComputeSigValue(covered enc.Wire) ([]byte, error)

func (*FixedKeyIntSigner) EstimateSize

func (*FixedKeyIntSigner) EstimateSize() uint

func (*FixedKeyIntSigner) PolicyTrait

func (p *FixedKeyIntSigner) PolicyTrait() schema.NTPolicy

func (*FixedKeyIntSigner) SigInfo

func (p *FixedKeyIntSigner) SigInfo() (*ndn.SigConfig, error)

type FixedKeySigner

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

FixedKeySigner is a demo policy that signs data using provided HMAC key. TODO: This has a problem with group signature node: The group signature node (subtree) has two leaves: the segmented data, and meta data. The segmented data has its own validation (SHA256 sig), but how to validate the meta data is specified by the trust schema (i.e. user). Then, is it still a good idea to make group sig node a blackbox? If yes, what is the best way to let the user specify how the packet is signed/validated? (#BLACKBOX)

func (*FixedKeySigner) Apply

func (p *FixedKeySigner) Apply(node schema.NTNode) error

func (*FixedKeySigner) ComputeSigValue

func (p *FixedKeySigner) ComputeSigValue(covered enc.Wire) ([]byte, error)

func (*FixedKeySigner) EstimateSize

func (*FixedKeySigner) EstimateSize() uint

func (*FixedKeySigner) PolicyTrait

func (p *FixedKeySigner) PolicyTrait() schema.NTPolicy

func (*FixedKeySigner) SigInfo

func (*FixedKeySigner) SigInfo() (*ndn.SigConfig, error)

type GroupSigNode

type GroupSigNode struct {
	schema.BaseNode
	// contains filtered or unexported fields
}

GroupSigNode represents a subtree that supports group signature on a segmented node. TODO: Is it a better idea to let the user specify what `seg` is, instead of using fixed LeafNode? That may be way more complicated, and I'm not sure about the use case. (#BLACKBOX)

func (*GroupSigNode) Get

func (n *GroupSigNode) Get(propName schema.PropKey) any

Get a property or callback event

func (*GroupSigNode) Init

func (n *GroupSigNode) Init(parent schema.NTNode, edge enc.ComponentPattern)

func (*GroupSigNode) Need

func (n *GroupSigNode) Need(matching enc.Matching, context schema.Context) chan schema.NeedResult

func (*GroupSigNode) OnAttach

func (n *GroupSigNode) OnAttach(path enc.NamePattern, engine ndn.Engine) error

func (*GroupSigNode) Provide

func (n *GroupSigNode) Provide(matching enc.Matching, content enc.Wire, context schema.Context)

func (*GroupSigNode) Set

func (n *GroupSigNode) Set(propName schema.PropKey, value any) error

Set a property. Use Get() to update callback events.

type LocalOnlyPolicy

type LocalOnlyPolicy struct{}

LocalOnlyPolicy surpress Interest expression. TODO: Is this secure? Do we need to consider the case where PropSuppressInt is overwritten by another policy?

func (*LocalOnlyPolicy) Apply

func (p *LocalOnlyPolicy) Apply(node schema.NTNode) error

func (*LocalOnlyPolicy) PolicyTrait

func (p *LocalOnlyPolicy) PolicyTrait() schema.NTPolicy

type MemStoragePolicy

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

MemStoragePolicy is a policy that stored data in a memory storage. TODO: If we use on-disk storage, how to specify the path (#ENV)

func (*MemStoragePolicy) Apply

func (p *MemStoragePolicy) Apply(node schema.NTNode) error

func (*MemStoragePolicy) Get

func (p *MemStoragePolicy) Get(name enc.Name, canBePrefix bool, mustBeFresh bool) enc.Wire

func (*MemStoragePolicy) PolicyTrait

func (p *MemStoragePolicy) PolicyTrait() schema.NTPolicy

func (*MemStoragePolicy) Put

func (p *MemStoragePolicy) Put(name enc.Name, rawData enc.Wire, validity time.Time)

type MissingData

type MissingData struct {
	NodeId   []byte
	StartSeq uint64
	EndSeq   uint64
}

type RegisterPolicy

type RegisterPolicy struct{}

RegisterPolicy marks the current node as the prefix to be registered. The current one can only handle fixed prefix. TODO: Handle the path "/prefix/<node-id>" with a given <node-id>. (#ENV)

func (*RegisterPolicy) Apply

func (p *RegisterPolicy) Apply(node schema.NTNode) error

func (*RegisterPolicy) PolicyTrait

func (p *RegisterPolicy) PolicyTrait() schema.NTPolicy

type RegisterPolicy2

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

RegisterPolicy2 is a quick patch to RegisterPolicy so that it can be applied to a path with nodeID.

func (*RegisterPolicy2) Apply

func (p *RegisterPolicy2) Apply(node schema.NTNode) error

func (*RegisterPolicy2) PolicyTrait

func (p *RegisterPolicy2) PolicyTrait() schema.NTPolicy

type StateVec

type StateVec struct {
	//+field:sequence:*StateVecEntry:struct:StateVecEntry
	Entries []*StateVecEntry `tlv:"0xca"`
}

func ParseStateVec

func ParseStateVec(reader enc.ParseReader, ignoreCritical bool) (*StateVec, error)

func (*StateVec) Bytes

func (value *StateVec) Bytes() []byte

func (*StateVec) Encode

func (value *StateVec) Encode() enc.Wire

type StateVecEncoder

type StateVecEncoder struct {
	Entries_subencoder []struct {
		Entries_encoder StateVecEntryEncoder
	}
	// contains filtered or unexported fields
}

func (*StateVecEncoder) Encode

func (encoder *StateVecEncoder) Encode(value *StateVec) enc.Wire

func (*StateVecEncoder) EncodeInto

func (encoder *StateVecEncoder) EncodeInto(value *StateVec, buf []byte)

func (*StateVecEncoder) Init

func (encoder *StateVecEncoder) Init(value *StateVec)

type StateVecEntry

type StateVecEntry struct {
	//+field:binary
	NodeId []byte `tlv:"0x07"`
	//+field:natural
	SeqNo uint64 `tlv:"0xcc"`
}

func ParseStateVecEntry

func ParseStateVecEntry(reader enc.ParseReader, ignoreCritical bool) (*StateVecEntry, error)

func (*StateVecEntry) Bytes

func (value *StateVecEntry) Bytes() []byte

func (*StateVecEntry) Encode

func (value *StateVecEntry) Encode() enc.Wire

type StateVecEntryEncoder

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

func (*StateVecEntryEncoder) Encode

func (encoder *StateVecEntryEncoder) Encode(value *StateVecEntry) enc.Wire

func (*StateVecEntryEncoder) EncodeInto

func (encoder *StateVecEntryEncoder) EncodeInto(value *StateVecEntry, buf []byte)

func (*StateVecEntryEncoder) Init

func (encoder *StateVecEntryEncoder) Init(value *StateVecEntry)

type StateVecEntryParsingContext

type StateVecEntryParsingContext struct {
}

func (*StateVecEntryParsingContext) Init

func (context *StateVecEntryParsingContext) Init()

func (*StateVecEntryParsingContext) Parse

func (context *StateVecEntryParsingContext) Parse(reader enc.ParseReader, ignoreCritical bool) (*StateVecEntry, error)

type StateVecParsingContext

type StateVecParsingContext struct {
	Entries_context StateVecEntryParsingContext
}

func (*StateVecParsingContext) Init

func (context *StateVecParsingContext) Init()

func (*StateVecParsingContext) Parse

func (context *StateVecParsingContext) Parse(reader enc.ParseReader, ignoreCritical bool) (*StateVec, error)

type SvsNode

type SvsNode struct {
	schema.BaseNode
	// contains filtered or unexported fields
}

SvsNode represents a subtree supports a simplified state-vector-sync protocol. TODO: How to return the missing data to the user? Channel or callback? TODO: How can the user express the trust schema here? The `notif` node mat have different requirements as the `leaf` node. (#BLACKBOX)

func (*SvsNode) Get

func (n *SvsNode) Get(propName schema.PropKey) any

Get a property or callback event

func (*SvsNode) Init

func (n *SvsNode) Init(parent schema.NTNode, edge enc.ComponentPattern)

func (*SvsNode) MissingDataChannel

func (n *SvsNode) MissingDataChannel() chan MissingData

func (*SvsNode) MySequence

func (n *SvsNode) MySequence() uint64

func (*SvsNode) Need

func (n *SvsNode) Need(
	nodeId []byte, seq uint64, matching enc.Matching, context schema.Context,
) chan schema.NeedResult

func (*SvsNode) NewData

func (n *SvsNode) NewData(content enc.Wire, context schema.Context) enc.Wire

func (*SvsNode) Set

func (n *SvsNode) Set(propName schema.PropKey, value any) error

Set a property. Use Get() to update callback events.

type SvsOnMissingEvent

type SvsOnMissingEvent = func([]byte, uint64, uint64)

type SyncState

type SyncState int
const (
	SyncSteady SyncState = iota
	SyncSupression
)

Jump to

Keyboard shortcuts

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