Liking cljdoc? Tell your friends :D

lb.dns.resolver

DNS resolution logic with multiple A record support.

Provides:

  • Resolution of hostnames to all A records
  • Conversion of resolved IPs to weighted targets
  • Result types for success/failure handling
DNS resolution logic with multiple A record support.

Provides:
- Resolution of hostnames to all A records
- Conversion of resolved IPs to weighted targets
- Result types for success/failure handling
raw docstring

distribute-weightclj

(distribute-weight total-weight n)

Distribute a total weight among n targets. Returns a vector of weights that sum to the original weight.

Uses floor division with remainder distributed to first targets. Example: (distribute-weight 100 3) => [34 33 33]

Distribute a total weight among n targets.
Returns a vector of weights that sum to the original weight.

Uses floor division with remainder distributed to first targets.
Example: (distribute-weight 100 3) => [34 33 33]
sourceraw docstring

expand-to-weighted-targetsclj

(expand-to-weighted-targets resolved-ips port total-weight health-check)

Expand resolved IPs to weighted targets with distributed weights.

Parameters: resolved-ips - vector of u32 IPs from DNS resolution port - target port number total-weight - total weight to distribute (1-100) health-check - optional health check config

Returns vector of maps suitable for creating WeightedTargets: [{:ip <u32> :port <int> :weight <int> :health-check <config>} ...]

Expand resolved IPs to weighted targets with distributed weights.

Parameters:
  resolved-ips - vector of u32 IPs from DNS resolution
  port - target port number
  total-weight - total weight to distribute (1-100)
  health-check - optional health check config

Returns vector of maps suitable for creating WeightedTargets:
  [{:ip <u32> :port <int> :weight <int> :health-check <config>} ...]
sourceraw docstring

failure-resultclj

(failure-result error-type message)

Create a failed resolution result.

Create a failed resolution result.
sourceraw docstring

format-ipsclj

(format-ips ips)

Format vector of u32 IPs as readable string.

Format vector of u32 IPs as readable string.
sourceraw docstring

ips-changed?clj

(ips-changed? old-ips new-ips)

Check if resolved IPs have changed. Order-independent comparison.

Check if resolved IPs have changed.
Order-independent comparison.
sourceraw docstring

resolve-hostname-allclj

(resolve-hostname-all hostname timeout-ms)

Resolve hostname to all A records.

Parameters: hostname - DNS hostname to resolve timeout-ms - Resolution timeout in milliseconds (not directly supported by Java InetAddress, but sets a reasonable expectation)

Returns ResolveResult with either:

  • success? true, ips as vector of u32
  • success? false, error-type and message
Resolve hostname to all A records.

Parameters:
  hostname - DNS hostname to resolve
  timeout-ms - Resolution timeout in milliseconds (not directly supported
               by Java InetAddress, but sets a reasonable expectation)

Returns ResolveResult with either:
  - success? true, ips as vector of u32
  - success? false, error-type and message
sourceraw docstring

resolve-hostname-singleclj

(resolve-hostname-single hostname timeout-ms)

Resolve hostname to first A record only. Simpler wrapper when only one IP is needed.

Returns ResolveResult.

Resolve hostname to first A record only.
Simpler wrapper when only one IP is needed.

Returns ResolveResult.
sourceraw docstring

success-resultclj

(success-result ips)
(success-result ips ttl)

Create a successful resolution result.

Create a successful resolution result.
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