Liking cljdoc? Tell your friends :D

lb.maps

eBPF map management for the load balancer. Provides functions to create, operate on, and close all required maps.

eBPF map management for the load balancer.
Provides functions to create, operate on, and close all required maps.
raw docstring

add-listen-portclj

(add-listen-port listen-map
                 ifindex
                 listen-port
                 {:keys [ip port] :as target}
                 &
                 {:keys [flags] :or {flags 0}})

Configure a listen interface/port with its default target. DEPRECATED: Use add-listen-port-weighted for weighted load balancing. ifindex: network interface index listen-port: listen port number target: {:ip <u32> :port <int>} flags: bit flags (bit 0 = stats enabled)

Configure a listen interface/port with its default target.
DEPRECATED: Use add-listen-port-weighted for weighted load balancing.
ifindex: network interface index
listen-port: listen port number
target: {:ip <u32> :port <int>}
flags: bit flags (bit 0 = stats enabled)
sourceraw docstring

add-listen-port-weightedclj

(add-listen-port-weighted listen-map
                          ifindex
                          listen-port
                          target-group
                          &
                          {:keys [flags] :or {flags 0}})

Configure a listen interface/port with weighted targets. ifindex: network interface index listen-port: listen port number target-group: TargetGroup record with :targets and :cumulative-weights flags: bit flags (bit 0 = stats enabled)

Configure a listen interface/port with weighted targets.
ifindex: network interface index
listen-port: listen port number
target-group: TargetGroup record with :targets and :cumulative-weights
flags: bit flags (bit 0 = stats enabled)
sourceraw docstring

add-source-routeclj

(add-source-route config-map
                  {:keys [ip prefix-len]}
                  {:keys [ip port] :as target}
                  &
                  {:keys [flags] :or {flags 1}})

Add a source IP/CIDR route to the config map. DEPRECATED: Use add-source-route-weighted for weighted load balancing. source: {:ip <u32> :prefix-len <int>} target: {:ip <u32> :port <int>} flags: optional flags (default 1 = enabled)

Add a source IP/CIDR route to the config map.
DEPRECATED: Use add-source-route-weighted for weighted load balancing.
source: {:ip <u32> :prefix-len <int>}
target: {:ip <u32> :port <int>}
flags: optional flags (default 1 = enabled)
sourceraw docstring

add-source-route-weightedclj

(add-source-route-weighted config-map
                           {:keys [ip prefix-len]}
                           target-group
                           &
                           {:keys [flags] :or {flags 1}})

Add a source IP/CIDR route with weighted targets to the config map. source: {:ip <u32> :prefix-len <int>} target-group: TargetGroup record with :targets and :cumulative-weights flags: optional flags (default 1 = enabled)

Add a source IP/CIDR route with weighted targets to the config map.
source: {:ip <u32> :prefix-len <int>}
target-group: TargetGroup record with :targets and :cumulative-weights
flags: optional flags (default 1 = enabled)
sourceraw docstring

clear-stale-connectionsclj

(clear-stale-connections conntrack-map current-time-ns timeout-ns)

Remove connections that haven't been seen within the timeout period. timeout-ns: timeout in nanoseconds

Remove connections that haven't been seen within the timeout period.
timeout-ns: timeout in nanoseconds
sourceraw docstring

close-all-mapsclj

(close-all-maps {:keys [config-map listen-map conntrack-map settings-map
                        stats-ringbuf]})

Close all maps and release resources.

Close all maps and release resources.
sourceraw docstring

create-all-mapsclj

(create-all-maps)
(create-all-maps opts)

Create all maps required for the reverse proxy. Returns a map of {:config-map :listen-map :conntrack-map :settings-map :stats-ringbuf}

Create all maps required for the reverse proxy.
Returns a map of {:config-map :listen-map :conntrack-map :settings-map :stats-ringbuf}
sourceraw docstring

create-config-mapclj

(create-config-map {:keys [max-routes]
                    :or {max-routes (:max-routes default-config)}})

Create LPM trie map for source IP -> target routing with weighted load balancing. Key: {prefix_len (4 bytes) + ip (4 bytes)} = 8 bytes Value: Weighted route format (72 bytes): Header (8 bytes): target_count(1) + reserved(3) + flags(2) + reserved(2) Per target (8 bytes each, max 8): ip(4) + port(2) + cumulative_weight(2)

Create LPM trie map for source IP -> target routing with weighted load balancing.
Key: {prefix_len (4 bytes) + ip (4 bytes)} = 8 bytes
Value: Weighted route format (72 bytes):
  Header (8 bytes): target_count(1) + reserved(3) + flags(2) + reserved(2)
  Per target (8 bytes each, max 8): ip(4) + port(2) + cumulative_weight(2)
sourceraw docstring

create-conntrack-mapclj

(create-conntrack-map {:keys [max-connections]
                       :or {max-connections (:max-connections default-config)}})

Create per-CPU hash map for connection tracking. Using per-CPU variant for lock-free concurrent access. Key: 5-tuple (16 bytes aligned) Value: conntrack state (64 bytes): orig_dst_ip(4) + orig_dst_port(2) + pad(2) + nat_dst_ip(4) + nat_dst_port(2) + pad(2) + created_ns(8) + last_seen_ns(8) + packets_fwd(8) + packets_rev(8) + bytes_fwd(8) + bytes_rev(8)

Create per-CPU hash map for connection tracking.
Using per-CPU variant for lock-free concurrent access.
Key: 5-tuple (16 bytes aligned)
Value: conntrack state (64 bytes):
  orig_dst_ip(4) + orig_dst_port(2) + pad(2) + nat_dst_ip(4) + nat_dst_port(2) + pad(2) +
  created_ns(8) + last_seen_ns(8) + packets_fwd(8) + packets_rev(8) + bytes_fwd(8) + bytes_rev(8)
sourceraw docstring

create-listen-mapclj

(create-listen-map {:keys [max-listen-ports]
                    :or {max-listen-ports (:max-listen-ports default-config)}})

Create hash map for listen interface/port -> default target with weighted load balancing. Key: {ifindex (4 bytes) + port (2 bytes) + padding (2 bytes)} = 8 bytes Value: Weighted route format (72 bytes): Header (8 bytes): target_count(1) + reserved(3) + flags(2) + reserved(2) Per target (8 bytes each, max 8): ip(4) + port(2) + cumulative_weight(2)

Create hash map for listen interface/port -> default target with weighted load balancing.
Key: {ifindex (4 bytes) + port (2 bytes) + padding (2 bytes)} = 8 bytes
Value: Weighted route format (72 bytes):
  Header (8 bytes): target_count(1) + reserved(3) + flags(2) + reserved(2)
  Per target (8 bytes each, max 8): ip(4) + port(2) + cumulative_weight(2)
sourceraw docstring

create-settings-mapclj

(create-settings-map {:keys [settings-entries]
                      :or {settings-entries (:settings-entries
                                              default-config)}})

Create array map for global settings. Index 0: stats enabled (0/1) Index 1: connection timeout (seconds) Index 2: reserved ... Note: Using default 4-byte values since clj-ebpf array maps use integer serializers.

Create array map for global settings.
Index 0: stats enabled (0/1)
Index 1: connection timeout (seconds)
Index 2: reserved
...
Note: Using default 4-byte values since clj-ebpf array maps
use integer serializers.
sourceraw docstring

create-stats-ringbufclj

(create-stats-ringbuf {:keys [ringbuf-size]
                       :or {ringbuf-size (:ringbuf-size default-config)}})

Create ring buffer for streaming statistics events. Size must be a power of 2.

Create ring buffer for streaming statistics events.
Size must be a power of 2.
sourceraw docstring

default-configclj

Default configuration for map creation.

Default configuration for map creation.
sourceraw docstring

delete-connectionclj

(delete-connection conntrack-map five-tuple)

Delete a connection from the tracking map.

Delete a connection from the tracking map.
sourceraw docstring

disable-statsclj

(disable-stats settings-map)

Disable statistics collection in eBPF program.

Disable statistics collection in eBPF program.
sourceraw docstring

enable-statsclj

(enable-stats settings-map)

Enable statistics collection in eBPF program.

Enable statistics collection in eBPF program.
sourceraw docstring

get-connection-timeoutclj

(get-connection-timeout settings-map)

Get connection timeout in seconds.

Get connection timeout in seconds.
sourceraw docstring

get-settingclj

(get-setting settings-map index)

Get a global setting by index.

Get a global setting by index.
sourceraw docstring

list-connectionsclj

(list-connections conntrack-map)

List all active connections.

List all active connections.
sourceraw docstring

list-listen-portsclj

(list-listen-ports listen-map)

List all configured listen ports. Returns a sequence of {:listen {...} :route {...}} maps with weighted target data.

List all configured listen ports.
Returns a sequence of {:listen {...} :route {...}} maps with weighted target data.
sourceraw docstring

list-source-routesclj

(list-source-routes config-map)

List all source routes in the config map. Returns a sequence of {:source {...} :route {...}} maps with weighted target data.

List all source routes in the config map.
Returns a sequence of {:source {...} :route {...}} maps with weighted target data.
sourceraw docstring

lookup-connectionclj

(lookup-connection conntrack-map five-tuple)

Look up a connection by its 5-tuple.

Look up a connection by its 5-tuple.
sourceraw docstring

lookup-listen-portclj

(lookup-listen-port listen-map ifindex port)

Look up configuration for a listen interface/port. Returns weighted route data with :target-count, :flags, and :targets.

Look up configuration for a listen interface/port.
Returns weighted route data with :target-count, :flags, and :targets.
sourceraw docstring

lookup-source-routeclj

(lookup-source-route config-map {:keys [ip prefix-len]})

Look up a source IP in the config map (exact match on prefix-len + IP). Returns weighted route data with :target-count, :flags, and :targets.

Look up a source IP in the config map (exact match on prefix-len + IP).
Returns weighted route data with :target-count, :flags, and :targets.
sourceraw docstring

map-fdclj

(map-fd m)

Get the raw file descriptor for a map. This is needed when building eBPF programs that reference maps.

Get the raw file descriptor for a map.
This is needed when building eBPF programs that reference maps.
sourceraw docstring

remove-listen-portclj

(remove-listen-port listen-map ifindex port)

Remove a listen interface/port configuration.

Remove a listen interface/port configuration.
sourceraw docstring

remove-source-routeclj

(remove-source-route config-map {:keys [ip prefix-len]})

Remove a source IP/CIDR route from the config map.

Remove a source IP/CIDR route from the config map.
sourceraw docstring

set-connection-timeoutclj

(set-connection-timeout settings-map timeout-seconds)

Set connection timeout in seconds.

Set connection timeout in seconds.
sourceraw docstring

set-settingclj

(set-setting settings-map index value)

Set a global setting by index.

Set a global setting by index.
sourceraw docstring

SETTING-CONN-TIMEOUTclj

source

SETTING-MAX-CONNSclj

source

SETTING-STATS-ENABLEDclj

source

stats-enabled?clj

(stats-enabled? settings-map)

Check if statistics collection is enabled.

Check if statistics collection is enabled.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close