Traceroute.Sockets.TCP (traceroute v0.2.5)

View Source

A GenServer that sends a TCP traceroute probe and waits for a response.

Opens a TCP socket for sending probe packets and uses the ICMPConn singleton socket for receiving ICMP responses.

The probe can complete in one of several ways:

  • TCP connection succeeds (reached destination)
  • TCP connection refused/reset (reached destination, port closed)
  • ICMP Time Exceeded received (intermediate hop responded)
  • Timeout (no response)

Response Filtering

When multiple TCP probes run in parallel, each probe registers with ICMPConn using its TCP source port. ICMPConn routes incoming ICMP responses to the correct probe process based on the source port in the embedded TCP header.

Summary

Functions

Returns a specification to start this module under a supervisor.

Sends a TCP probe to the given IP address with the specified TTL.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

send(ip, ttl, timeout, ip_protocol, opts \\ [])

Sends a TCP probe to the given IP address with the specified TTL.

Returns {:ok, time_microseconds, result} on success, or {:error, reason} on failure.

Options

  • :dest_port - The destination port (default: 80)

start_link(args)