SnmpKit.SnmpMgr.Target (snmpkit v0.6.6)

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

parse(target)

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}}

resolve_hostname(target)

Resolves a hostname to an IP address if needed.

If the host is already an IP tuple, returns it unchanged.

validate_connectivity(map, timeout \\ 5000)

Validates that a target is reachable (basic connectivity check).