clj-artnet.impl.shell.net
Utilities for Art-Net network I/O, including address coercion and channel configuration.
Provides helpers for java.net.InetAddress and java.nio.channels.DatagramChannel setup, isolated from protocol logic.
->socket-address
(->socket-address {:keys [host port]})Coerces {:host … :port …} map to InetSocketAddress. Defaults port to 6454 (0x1936) if nil.
as-inet-address
(as-inet-address host)Coerces host representation to InetAddress.
Accepts InetAddress, String, or nil (defaults to 0.0.0.0).
detect-local-ip
(detect-local-ip)Detects the primary non-loopback IPv4 address.
Returns a b c d vector or nil. Prefers Art-Net IP address ranges (2.x.x.x, 10.x.x.x) per spec.
detect-mac-address
(detect-mac-address ip-octets)Detects MAC address for a given IP address.
Returns m1 m2 m3 m4 m5 m6 vector or nil if not found. Looks up the network interface associated with the IP address. Returns nil for nil input or invalid IP format.
limited-broadcast-address?
(limited-broadcast-address? addr)Returns true if addr is the limited broadcast address 255.255.255.255.
open-channel
(open-channel {:keys [bind broadcast? reuse-address?], :or {broadcast? true, reuse-address? true}})Opens and configures a DatagramChannel for Art-Net I/O.
Options: - :bind -> Bind address map {:host … :port …} - :broadcast? -> Enable SO_BROADCAST (default true) - :reuse-address? -> Enable SO_REUSEADDR (default true)
parse-host
(parse-host host)Parses host to a b c d vector.
Accepts: IP address string, vector, or nil. Returns nil for nil input.
sender-from-socket
(sender-from-socket addr)Extracts sender info {:host … :port …} from a SocketAddress. Returns nil if the address is not an InetSocketAddress.
wildcard?
(wildcard? host)Returns true if the host represents any IP address (0.0.0.0 or nil).