SnmpKit.SnmpMgr.Target (snmpkit v0.6.4)
Target parsing and validation for SNMP requests.
Handles parsing of various target formats and resolves hostnames to IP addresses.
Summary
Functions
Parses a target string into a structured format.
Resolves a hostname to an IP address if needed.
Validates that a target is reachable (basic connectivity check).
Functions
Parses a target string into a structured format.
Examples
iex> SnmpKit.SnmpMgr.Target.parse("192.168.1.1:161")
{:ok, %{host: {192, 168, 1, 1}, port: 161}}
iex> SnmpKit.SnmpMgr.Target.parse("device.local")
{:ok, %{host: "device.local", port: 161}}
iex> SnmpKit.SnmpMgr.Target.parse("192.168.1.1")
{:ok, %{host: {192, 168, 1, 1}, port: 161}}
Resolves a hostname to an IP address if needed.
If the host is already an IP tuple, returns it unchanged.
Validates that a target is reachable (basic connectivity check).