core

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotCanonical = errors.New("URI could not be canonized")
)

Error definitions

View Source
var ShouldQuit = false

ShouldQuit indicates whether threads should quit

View Source
var StartTimestamp time.Time

StartTimestamp is the time the forwarder was started.

View Source
var Version string

Version of YaNFD.

Functions

func InitializeLogger

func InitializeLogger(logFile string)

InitializeLogger initializes the logger.

func LoadConfig

func LoadConfig(cfg *Config, basedir string)

func LogDebug

func LogDebug(module interface{}, components ...interface{})

LogDebug logs a message at the DEBUG level.

func LogError

func LogError(module interface{}, components ...interface{})

LogError logs a message at the ERROR level.

func LogFatal

func LogFatal(module interface{}, components ...interface{})

LogFatal logs a message at the FATAL level. Note: Fatal will let the program exit

func LogInfo

func LogInfo(module interface{}, components ...interface{})

LogInfo logs a message at the INFO level.

func LogTrace

func LogTrace(module interface{}, components ...interface{})

LogTrace logs a message at the TRACE level (really just additional DEBUG messages).

func LogWarn

func LogWarn(module interface{}, components ...interface{})

LogWarn logs a message at the WARN level.

func ResolveConfigFileRelPath

func ResolveConfigFileRelPath(target string) (abs string)

ResolveConfigFileRelPath resolves a possibly relative path based on config file path.

func ShutdownLogger

func ShutdownLogger()

ShutdownLogger shuts down the logger.

Types

type Config

type Config struct {
	Core struct {
		// Logging level
		LogLevel string `json:"log_level"`
	} `json:"core"`

	Faces struct {
		// Size of queues in the face system
		QueueSize int `json:"queue_size"`
		// Enables or disables congestion marking
		CongestionMarking bool `json:"congestion_marking"`
		// If true, face threads will be locked to processor cores
		LockThreadsToCores bool `json:"lock_threads_to_cores"`

		Udp struct {
			// Whether to enable unicast UDP listener
			EnabledUnicast bool `json:"enabled_unicast"`
			// Whether to enable multicast UDP listener
			EnabledMulticast bool `json:"enabled_multicast"`
			// Port used for unicast UDP faces
			PortUnicast uint16 `json:"port_unicast"`
			// Port used for multicast UDP faces
			PortMulticast uint16 `json:"port_multicast"`
			// IPv4 address used for multicast UDP faces
			MulticastAddressIpv4 string `json:"multicast_address_ipv4"`
			// IPv6 address used for multicast UDP faces
			MulticastAddressIpv6 string `json:"multicast_address_ipv6"`
			// Lifetime of on-demand faces (in seconds)
			Lifetime uint64 `json:"lifetime"`
		} `json:"udp"`

		Tcp struct {
			// Whether to enable TCP listener
			Enabled bool `json:"enabled"`
			// Port used for unicast TCP faces
			PortUnicast uint16 `json:"port_unicast"`
			// Lifetime of on-demand faces (in seconds)
			Lifetime uint64 `json:"lifetime"`
		} `json:"tcp"`

		Unix struct {
			// Whether to enable Unix stream transports
			Enabled bool `json:"enabled"`
			// Location of the socket file
			SocketPath string `json:"socket_path"`
		} `json:"unix"`

		WebSocket struct {
			// Whether to enable WebSocket listener
			Enabled bool `json:"enabled"`
			// Bind address for WebSocket listener
			Bind string `json:"bind"`
			// Port for WebSocket listener
			Port uint16 `json:"port"`
			// Whether to enable TLS
			TlsEnabled bool `json:"tls_enabled"`
			// TLS certificate path (relative to the config file)
			TlsCert string `json:"tls_cert"`
			// TLS private key (relative to the config file)
			TlsKey string `json:"tls_key"`
		} `json:"websocket"`
	} `json:"faces"`

	Fw struct {
		// Number of forwarding threads
		Threads int `json:"threads"`
		// Size of queues in the forwarding system
		QueueSize int `json:"queue_size"`
		// If true, face threads will be locked to processor cores
		LockThreadsToCores bool `json:"lock_threads_to_cores"`
	} `json:"fw"`

	Mgmt struct {
		// Controls whether management over /localhop is enabled or disabled
		AllowLocalhop bool `json:"allow_localhop"`
	} `json:"mgmt"`

	Tables struct {
		// Size of queues in the table system
		QueueSize int `json:"queue_size"`

		ContentStore struct {
			// Capacity of each forwarding thread's content store (in number of Data packets). Note that the
			// total capacity of all content stores in the forwarder will be the number of threads
			// multiplied by this value. This is the startup configuration value and can be changed at
			// runtime via management.
			Capacity uint16 `json:"capacity"`
			// Whether contents will be admitted to the Content Store.
			Admit bool `json:"admit"`
			// Whether contents will be served from the Content Store.
			Serve bool `json:"serve"`
			// Cache replacement policy to use in each thread's content store.
			ReplacementPolicy string `json:"replacement_policy"`
		} `json:"content_store"`

		DeadNonceList struct {
			// Lifetime of entries in the Dead Nonce List (milliseconds)
			Lifetime int `json:"lifetime"`
		} `json:"dead_nonce_list"`

		NetworkRegion struct {
			// List of prefixes that the forwarder is in the producer region for
			Regions []string `json:"regions"`
		} `json:"network_region"`

		Rib struct {
			// Enables or disables readvertising to the routing daemon
			ReadvertiseNlsr bool `json:"readvertise_nlsr"`
		} `json:"rib"`

		Fib struct {
			// Selects the algorithm used to implement the FIB
			// Allowed options: nametree, hashtable
			Algorithm string `json:"algorithm"`

			Hashtable struct {
				// Specifies the virtual node depth. Must be a positive number.
				M uint16 `json:"m"`
			} `json:"hashtable"`
		} `json:"fib"`
	} `json:"tables"`
}

func DefaultConfig

func DefaultConfig() *Config

func GetConfig

func GetConfig() *Config

Jump to

Keyboard shortcuts

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