dhcp.json-pool-server
json-pool-init
(json-pool-init {:keys [log-msg leases-file pool save-pool load-pool server-info], :as cfg})
Initialize the in-memory pool
(see pool for format) either from a leases-file
if it exists or with an empty pool using server-info
to specify the pool network ranges.
load-json-pool
(load-json-pool {:keys [leases-file], :as cfg})
Read JSON pool data from leases-file
. See format of pool.
main
(main if-name & [config-file args])
Start a JSON pool DHCP server listening on if-name
and storing the JSON lease data in ‘dhcp-leases.json’
pool
In-memory cache of JSON pool. Format:
{:ranges [{:start <START-IP>
:end <END-IP>}...]
:ip-to-mac {<IP> <MAC>...}
:mac-to-ip {<MAC> <IP>}}
pool-handler
(pool-handler {:keys [log-msg pool save-pool server-info], :as cfg} msg-map)
Takes a parsed DHCP client message msg-map
and allocates an address from pool
and responds to the client with that address. If the client MAC was already assigned an address then respond with the same address.
save-json-pool
(save-json-pool {:keys [leases-file], :as cfg} data)
Write JSON pool data to leases-file