core

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Global initial configuration of the forwarder. This configuration is IMMUTABLE. Do not modify it.

View Source
var Log = log.Default()
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.

Functions

func CloseLogger added in v1.4.3

func CloseLogger()

ShutdownLogger shuts down the logger.

func OpenLogger added in v1.4.3

func OpenLogger()

OpenLogger initializes the logger.

Types

type Config

type Config struct {
	Core struct {
		// Logging level
		LogLevel string `json:"log_level"`
		// Output log to file
		LogFile string `json:"log_file"`

		// Config file base dir
		BaseDir string `json:"-"`
		// Enable CPU profiling
		CpuProfile string `json:"-"`
		// Enable memory profiling
		MemProfile string `json:"-"`
		// Enable block profiling
		BlockProfile string `json:"-"`
		// Memory ballast size (in GB)
		MemoryBallastSize int `json:"-"`
	} `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 {
		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"`
}

Config represents the configuration of the forwarder.

func DefaultConfig

func DefaultConfig() *Config

func (*Config) ResolveRelPath added in v1.4.3

func (c *Config) ResolveRelPath(target string) string

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

Jump to

Keyboard shortcuts

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