server

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

README

Traceroute HTTP Server

This package provides an HTTP server with a REST API for running traceroutes.

API Endpoint

GET /traceroute

Runs a traceroute to the specified target.

Query Parameters

See parseTracerouteParams() function

Example Requests
# Basic traceroute to google.com
curl 'http://localhost:8080/traceroute?target=google.com'

# TCP traceroute to specific port with reverse DNS
curl 'http://localhost:8080/traceroute?target=example.com&protocol=tcp&port=443&reverse-dns=true'

# UDP traceroute with custom settings
curl 'http://localhost:8080/traceroute?target=8.8.8.8&protocol=udp&max-ttl=20&traceroute-queries=5'
Response

Returns JSON with the traceroute results. Example:

{
  "destination": {
    "hostname": "google.com",
    "port": 33434
  },
  "protocol": "udp",
  "traceroute": {
    "runs": [...]
  },
  "e2e_probe": {
    "rtts": [...]
  },
  "source": {
    "public_ip": ""
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the HTTP server for the traceroute API

func NewServer

func NewServer() *Server

NewServer creates a new HTTP server with an initialized Traceroute instance

func (*Server) Start

func (s *Server) Start(addr string) error

Start starts the HTTP server on the specified address

func (*Server) TracerouteHandler

func (s *Server) TracerouteHandler(w http.ResponseWriter, r *http.Request)

TracerouteHandler handles GET /traceroute requests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL