Network operations: TCP port checks and ICMP ping.
TCP operations (port_open?/3, scan_ports/3) use :gen_tcp directly.
ICMP ping uses Trebejo.Util.run_cmd/3 with arg lists — never
interpolated into shell strings — to prevent shell injection.
For DNS resolution use Apero.Network.resolve/1 directly.
Summary
Functions
Sends ICMP ping to a host.
Checks if a TCP port is open on a host.
Scans a list of TCP ports on a host.
Types
Functions
Sends ICMP ping to a host.
Returns :ok on success or {:error, reason} on failure.
Options
:count— number of echo requests (default: 3):timeout— timeout in ms (default: 5_000)
Checks if a TCP port is open on a host.
Options
:timeout— connection timeout in ms (default: 5_000)
@spec scan_ports(String.t(), [tcp_port()], keyword()) :: %{ required(tcp_port()) => :open | :closed }
Scans a list of TCP ports on a host.
Returns a map of port → :open | :closed.