Traceroute.Utils (traceroute v0.2.5)
View SourceImplements various helper functions.
Summary
Functions
Returns the any address for a given socket domain.
Returns the domain for a given IP.
Returns the domain or a string representation of an IP address
Returns the host OS (linux or macOS)
Returns an ICMP packet's protocol + identifier combination.
Returns the IPv4 or IPv6 address as Tuple for a given IP Protocol and Domain.
Returns {:ok, ip_protocol} with ip_protocol = :ipv4|:ipv6 for an IP tuple
or {:error, :invalid_ip_address} if the IP tuple is invalid.
Returns the IPv4 as Tuple for a given Domain.
Returns the IPv6 as Tuple for a given Domain.
Returns the socket domain, protocol, and ttl option for an IP protocol.
Returns the correct socket type (raw, dgram, stream) for a given protocol depending on the current host OS
Converts an integer to an IPv4 tuple
Converts an integer to an IPv6 tuple
Calls a GenServer with a timeout and handles the timeout error gracefully.
Splits an ICMP reply packet into IP header and payload.
Functions
Returns the any address for a given socket domain.
Returns the domain for a given IP.
Returns the domain or a string representation of an IP address
Returns the host OS (linux or macOS)
Returns an ICMP packet's protocol + identifier combination.
This is used to send ICMP responses to the correct process when multiple sockets run in parallel, ensuring each socket only processes responses intended for its own request.
Parameters
ip_protocol- Whether the packet was sent through:ipv4or:ipv6reply_packet- The raw ICMP response packet
Returns the IPv4 or IPv6 address as Tuple for a given IP Protocol and Domain.
Returns {:ok, ip_protocol} with ip_protocol = :ipv4|:ipv6 for an IP tuple
or {:error, :invalid_ip_address} if the IP tuple is invalid.
Returns the IPv4 as Tuple for a given Domain.
Returns the IPv6 as Tuple for a given Domain.
Returns the socket domain, protocol, and ttl option for an IP protocol.
Returns the correct socket type (raw, dgram, stream) for a given protocol depending on the current host OS
Converts an integer to an IPv4 tuple
Converts an integer to an IPv6 tuple
Calls a GenServer with a timeout and handles the timeout error gracefully.
Splits an ICMP reply packet into IP header and payload.
For IPv6, an optional source address can be provided (from the socket's recvfrom result) since ICMPv6 DGRAM sockets strip the IPv6 header.