Liking cljdoc? Tell your friends :D

lb.core

Core API for the eBPF load balancer. Provides high-level functions for initialization, configuration, and management.

Core API for the eBPF load balancer.
Provides high-level functions for initialization, configuration, and management.
raw docstring

-mainclj

(-main & args)

Main entry point.

Main entry point.
sourceraw docstring

add-proxy!clj

(add-proxy! proxy-config)

Add a new proxy configuration at runtime. Now supports weighted load balancing with TargetGroup records.

Add a new proxy configuration at runtime.
Now supports weighted load balancing with TargetGroup records.
sourceraw docstring

add-sni-route!clj

(add-sni-route! proxy-name hostname target)

Add an SNI route to a proxy for TLS hostname-based routing. hostname: TLS SNI hostname to match (e.g., "api.example.com") target can be:

  • Single target: {:ip "10.0.0.1" :port 8443}
  • Weighted targets: [{:ip "10.0.0.1" :port 8443 :weight 50} {:ip "10.0.0.2" :port 8443 :weight 50}]
Add an SNI route to a proxy for TLS hostname-based routing.
hostname: TLS SNI hostname to match (e.g., "api.example.com")
target can be:
- Single target: {:ip "10.0.0.1" :port 8443}
- Weighted targets: [{:ip "10.0.0.1" :port 8443 :weight 50}
                     {:ip "10.0.0.2" :port 8443 :weight 50}]
sourceraw docstring

add-source-route!clj

(add-source-route! proxy-name source target)

Add a source route to a proxy. target can be:

  • Single target: {:ip "10.0.0.1" :port 8080}
  • Weighted targets: [{:ip "10.0.0.1" :port 8080 :weight 50} {:ip "10.0.0.2" :port 8080 :weight 50}]
Add a source route to a proxy.
target can be:
- Single target: {:ip "10.0.0.1" :port 8080}
- Weighted targets: [{:ip "10.0.0.1" :port 8080 :weight 50}
                     {:ip "10.0.0.2" :port 8080 :weight 50}]
sourceraw docstring

attach-interfaces!clj

(attach-interfaces! interfaces)

Attach proxy programs to network interfaces.

Attach proxy programs to network interfaces.
sourceraw docstring

circuit-breaker-enabled?clj

(circuit-breaker-enabled?)

Check if circuit breaker is enabled.

Check if circuit breaker is enabled.
sourceraw docstring

clear-connections!clj

(clear-connections!)

Clear all tracked connections.

Clear all tracked connections.
sourceraw docstring

clear-rate-limits!clj

(clear-rate-limits!)

Disable all rate limiting.

Disable all rate limiting.
sourceraw docstring

cli-optionsclj

source

detach-interfaces!clj

(detach-interfaces! interfaces)

Detach proxy programs from network interfaces.

Detach proxy programs from network interfaces.
sourceraw docstring

disable-backend-rate-limit!clj

(disable-backend-rate-limit!)

Disable per-backend rate limiting.

Disable per-backend rate limiting.
sourceraw docstring

disable-hot-reload!clj

(disable-hot-reload!)

Disable hot configuration reload.

Disable hot configuration reload.
sourceraw docstring

disable-source-rate-limit!clj

(disable-source-rate-limit!)

Disable per-source rate limiting.

Disable per-source rate limiting.
sourceraw docstring

disable-stats!clj

(disable-stats!)

Disable statistics collection.

Disable statistics collection.
sourceraw docstring

drain-backend!clj

(drain-backend! proxy-name target & {:keys [timeout-ms on-complete]})

Start draining a backend. Stops new connections while existing ones complete.

proxy-name: Name of the proxy (e.g., "web") target: Target specification - "ip:port" string or {:ip :port} map

Options: :timeout-ms - Drain timeout in ms (default from config or 30000) :on-complete - Callback fn called with status (:completed, :timeout, :cancelled)

Returns DrainState or throws if target not found/already draining.

Start draining a backend. Stops new connections while existing ones complete.

proxy-name: Name of the proxy (e.g., "web")
target: Target specification - "ip:port" string or {:ip :port} map

Options:
  :timeout-ms - Drain timeout in ms (default from config or 30000)
  :on-complete - Callback fn called with status (:completed, :timeout, :cancelled)

Returns DrainState or throws if target not found/already draining.
sourceraw docstring

draining?clj

(draining? target)

Check if a target is currently draining.

Check if a target is currently draining.
sourceraw docstring

enable-hot-reload!clj

(enable-hot-reload! config-path & opts)

Enable hot configuration reload for the specified config file.

Options: :watch-file? - Enable file watching (default true) :sighup? - Enable SIGHUP handling (default true) :debounce-ms - File change debounce period (default 500ms)

Returns true if enabled successfully.

Enable hot configuration reload for the specified config file.

Options:
  :watch-file? - Enable file watching (default true)
  :sighup? - Enable SIGHUP handling (default true)
  :debounce-ms - File change debounce period (default 500ms)

Returns true if enabled successfully.
sourceraw docstring

enable-stats!clj

(enable-stats!)

Enable statistics collection.

Enable statistics collection.
sourceraw docstring

error-msgclj

(error-msg errors)
source

force-circuit-close!clj

(force-circuit-close! target-id)

Manually force a circuit to CLOSED state (resume traffic).

Manually force a circuit to CLOSED state (resume traffic).
sourceraw docstring

force-circuit-open!clj

(force-circuit-open! target-id)

Manually force a circuit to OPEN state (stop all traffic).

Manually force a circuit to OPEN state (stop all traffic).
sourceraw docstring

force-dns-resolve!clj

(force-dns-resolve! proxy-name hostname)

Force immediate DNS re-resolution for a hostname.

Force immediate DNS re-resolution for a hostname.
sourceraw docstring

force-lb-update!clj

(force-lb-update!)

Force an immediate weight update for least-connections.

Force an immediate weight update for least-connections.
sourceraw docstring

get-all-circuit-breaker-statusclj

(get-all-circuit-breaker-status)

Get circuit breaker status for all targets.

Get circuit breaker status for all targets.
sourceraw docstring

get-all-dns-statusclj

(get-all-dns-status)

Get DNS resolution status for all proxies.

Get DNS resolution status for all proxies.
sourceraw docstring

get-all-drainingclj

(get-all-draining)

Get all currently draining backends.

Returns seq of drain status maps.

Get all currently draining backends.

Returns seq of drain status maps.
sourceraw docstring

get-all-health-statusclj

(get-all-health-status)

Get health status for all proxies.

Get health status for all proxies.
sourceraw docstring

get-circuit-breaker-statusclj

(get-circuit-breaker-status target-id)

Get circuit breaker status for a specific target.

Get circuit breaker status for a specific target.
sourceraw docstring

get-connection-countclj

(get-connection-count)

Get the number of active connections.

Get the number of active connections.
sourceraw docstring

get-connection-statsclj

(get-connection-stats)

Get aggregated connection statistics.

Get aggregated connection statistics.
sourceraw docstring

get-connectionsclj

(get-connections)

Get all active connections.

Get all active connections.
sourceraw docstring

get-dns-statusclj

(get-dns-status proxy-name)

Get DNS resolution status for a specific proxy.

Get DNS resolution status for a specific proxy.
sourceraw docstring

get-drain-statusclj

(get-drain-status target)

Get drain status for a backend.

target: Target specification - "ip:port" string or {:ip :port} map

Returns map with :target-id :status :elapsed-ms :current-connections or nil if not draining.

Get drain status for a backend.

target: Target specification - "ip:port" string or {:ip :port} map

Returns map with :target-id :status :elapsed-ms :current-connections
or nil if not draining.
sourceraw docstring

get-health-statusclj

(get-health-status proxy-name)

Get health status for a specific proxy.

Get health status for a specific proxy.
sourceraw docstring

get-lb-algorithmclj

(get-lb-algorithm)

Get the current load balancing algorithm (:weighted-random or :least-connections).

Get the current load balancing algorithm (:weighted-random or :least-connections).
sourceraw docstring

get-lb-statusclj

(get-lb-status)

Get current load balancing status.

Get current load balancing status.
sourceraw docstring

get-rate-limit-configclj

(get-rate-limit-config)

Get all rate limit configuration. Returns {:per-source {...} :per-backend {...}} or nils for disabled limits.

Get all rate limit configuration.
Returns {:per-source {...} :per-backend {...}} or nils for disabled limits.
sourceraw docstring

get-reload-stateclj

(get-reload-state)

Get current reload state for debugging.

Get current reload state for debugging.
sourceraw docstring

get-stateclj

(get-state)

Get the current proxy state.

Get the current proxy state.
sourceraw docstring

get-statusclj

(get-status)

Get current proxy status.

Get current proxy status.
sourceraw docstring

health-check-enabled?clj

(health-check-enabled?)

Check if health checking is enabled.

Check if health checking is enabled.
sourceraw docstring

hot-reload-enabled?clj

(hot-reload-enabled?)

Check if hot reload is currently enabled.

Check if hot reload is currently enabled.
sourceraw docstring

init!clj

(init! config
       &
       {:keys [max-routes max-connections ringbuf-size]
        :or
          {max-routes 10000 max-connections 100000 ringbuf-size (* 256 1024)}})

Initialize the eBPF reverse proxy.

Parameters: config - Configuration object (from config/parse-config or config/load-config-file)

Options: :max-routes - Maximum number of source routes :max-connections - Maximum concurrent connections :ringbuf-size - Ring buffer size for stats

Returns the proxy state map.

Initialize the eBPF reverse proxy.

Parameters:
  config - Configuration object (from config/parse-config or config/load-config-file)

Options:
  :max-routes - Maximum number of source routes
  :max-connections - Maximum concurrent connections
  :ringbuf-size - Ring buffer size for stats

Returns the proxy state map.
sourceraw docstring

lb-least-connections?clj

(lb-least-connections?)

Check if least-connections load balancing is enabled.

Check if least-connections load balancing is enabled.
sourceraw docstring

list-all-sni-routesclj

(list-all-sni-routes)

List all SNI routes from BPF map. Note: Returns hostname hashes since original hostnames aren't stored in BPF.

List all SNI routes from BPF map.
Note: Returns hostname hashes since original hostnames aren't stored in BPF.
sourceraw docstring

list-attached-interfacesclj

(list-attached-interfaces)

List currently attached interfaces.

List currently attached interfaces.
sourceraw docstring

list-sni-routesclj

(list-sni-routes proxy-name)

List all SNI routes for a proxy. Returns a sequence of {:hostname :target-group} maps.

List all SNI routes for a proxy.
Returns a sequence of {:hostname :target-group} maps.
sourceraw docstring

(print-circuit-breaker-status)

Print circuit breaker status for all targets.

Print circuit breaker status for all targets.
sourceraw docstring

(print-config)

Print current configuration.

Print current configuration.
sourceraw docstring

(print-connections)

Print active connections.

Print active connections.
sourceraw docstring

(print-drain-status)

Print all draining backends.

Print all draining backends.
sourceraw docstring

(print-health-status)

Print health status for all proxies.

Print health status for all proxies.
sourceraw docstring

(print-rate-limit-status)

Print current rate limit status.

Print current rate limit status.
sourceraw docstring

(print-status)

Print current load balancer status.

Print current load balancer status.
sourceraw docstring

rate-limiting-enabled?clj

(rate-limiting-enabled?)

Check if any rate limiting is enabled.

Check if any rate limiting is enabled.
sourceraw docstring

reload-config!clj

(reload-config!)
(reload-config! config-path)

Reload configuration from file or provided source.

Without arguments, reloads from the last known config path (if hot reload is enabled). With a path argument, loads and applies that configuration file.

Returns {:success? bool :changes {...} :error ...}

Reload configuration from file or provided source.

Without arguments, reloads from the last known config path (if hot reload is enabled).
With a path argument, loads and applies that configuration file.

Returns {:success? bool :changes {...} :error ...}
sourceraw docstring

reload-config-from-map!clj

(reload-config-from-map! config-map)

Reload configuration from an in-memory config map. Useful for programmatic config changes.

Returns {:success? bool :changes {...} :error ...}

Reload configuration from an in-memory config map.
Useful for programmatic config changes.

Returns {:success? bool :changes {...} :error ...}
sourceraw docstring

remove-proxy!clj

(remove-proxy! proxy-name)

Remove a proxy configuration at runtime.

Remove a proxy configuration at runtime.
sourceraw docstring

remove-sni-route!clj

(remove-sni-route! proxy-name hostname)

Remove an SNI route from a proxy.

Remove an SNI route from a proxy.
sourceraw docstring

remove-source-route!clj

(remove-source-route! proxy-name source)

Remove a source route from a proxy.

Remove a source route from a proxy.
sourceraw docstring

reset-circuit!clj

(reset-circuit! target-id)

Reset a circuit to initial CLOSED state with zero counts.

Reset a circuit to initial CLOSED state with zero counts.
sourceraw docstring

running?clj

(running?)

Check if the proxy is currently running.

Check if the proxy is currently running.
sourceraw docstring

set-backend-rate-limit!clj

(set-backend-rate-limit! rate & {:keys [burst]})

Set per-backend rate limit.

rate: requests per second allowed to each backend burst: maximum burst size (defaults to 2x rate)

Returns true if successful.

Set per-backend rate limit.

rate: requests per second allowed to each backend
burst: maximum burst size (defaults to 2x rate)

Returns true if successful.
sourceraw docstring

set-source-rate-limit!clj

(set-source-rate-limit! rate & {:keys [burst]})

Set per-source IP rate limit.

rate: requests per second allowed from each source IP burst: maximum burst size (defaults to 2x rate)

Returns true if successful.

Set per-source IP rate limit.

rate: requests per second allowed from each source IP
burst: maximum burst size (defaults to 2x rate)

Returns true if successful.
sourceraw docstring

shutdown!clj

(shutdown!)

Shutdown the reverse proxy and release all resources.

Shutdown the reverse proxy and release all resources.
sourceraw docstring

start-stats-stream!clj

(start-stats-stream!)

Start streaming statistics events.

Start streaming statistics events.
sourceraw docstring

stats-enabled?clj

(stats-enabled?)

Check if statistics collection is enabled.

Check if statistics collection is enabled.
sourceraw docstring

stop-stats-stream!clj

(stop-stats-stream!)

Stop streaming statistics events.

Stop streaming statistics events.
sourceraw docstring

subscribe-to-statsclj

(subscribe-to-stats)

Subscribe to the stats stream. Returns a channel.

Subscribe to the stats stream. Returns a channel.
sourceraw docstring

undrain-backend!clj

(undrain-backend! proxy-name target)

Cancel draining and restore traffic to a backend.

proxy-name: Name of the proxy target: Target specification - "ip:port" string or {:ip :port} map

Returns true if undrain succeeded, false if target wasn't draining.

Cancel draining and restore traffic to a backend.

proxy-name: Name of the proxy
target: Target specification - "ip:port" string or {:ip :port} map

Returns true if undrain succeeded, false if target wasn't draining.
sourceraw docstring

usageclj

(usage options-summary)
source

validate-argsclj

(validate-args args)
source

wait-for-drain!clj

(wait-for-drain! target)

Block until drain completes or times out.

target: Target specification - "ip:port" string or {:ip :port} map

Returns :completed, :timeout, or :cancelled.

Block until drain completes or times out.

target: Target specification - "ip:port" string or {:ip :port} map

Returns :completed, :timeout, or :cancelled.
sourceraw docstring

with-lb-statecljmacro

(with-lb-state [binding] & body)

Execute body with load balancer state bound to the specified binding. Returns nil if the load balancer is not running.

Example: (with-lb-state [state] (let [{:keys [maps config]} state] ;; work with state ))

Execute body with load balancer state bound to the specified binding.
Returns nil if the load balancer is not running.

Example:
  (with-lb-state [state]
    (let [{:keys [maps config]} state]
      ;; work with state
      ))
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