traceroute

package
v0.0.0-...-13731ec Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package traceroute adds traceroute functionality to the agent

Index

Constants

View Source
const (
	DefaultSourcePort   = 12345
	DefaultDestPort     = 33434
	DefaultNumPaths     = 1
	DefaultMinTTL       = 1
	DefaultMaxTTL       = 30
	DefaultDelay        = 50 //msec
	DefaultReadTimeout  = 10 * time.Second
	DefaultOutputFormat = "json"
)

TODO: are these good defaults?

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// TODO: add common configuration
	// Destination Hostname
	DestHostname string
	// Destination Port number
	DestPort uint16
	// Max number of hops to try
	MaxTTL uint8
	// TODO: do we want to expose this?
	TimeoutMs uint
}

Config specifies the configuration of an instance of Traceroute

type LinuxTraceroute

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

LinuxTraceroute defines a structure for running traceroute from an agent running on Linux

func New

func New(cfg Config) (*LinuxTraceroute, error)

New creates a new instance of LinuxTraceroute based on an input configuration

func (*LinuxTraceroute) Run

Run executes a traceroute

type NetworkPath

type NetworkPath struct {
	Timestamp   int64                  `json:"timestamp"`
	PathID      string                 `json:"path_id"`
	Source      NetworkPathSource      `json:"source"`
	Destination NetworkPathDestination `json:"destination"`
	Hops        []NetworkPathHop       `json:"hops"`
	Tags        []string               `json:"tags"`
}

NetworkPath encapsulates data that defines a path between two hosts as mapped by the agent

type NetworkPathDestination

type NetworkPathDestination struct {
	Hostname  string `json:"hostname"`
	IPAddress string `json:"ip_address"`
}

NetworkPathDestination encapsulates information about the destination of a path

type NetworkPathHop

type NetworkPathHop struct {
	TTL       int     `json:"ttl"`
	IPAddress string  `json:"ip_address"`
	Hostname  string  `json:"hostname"`
	RTT       float64 `json:"rtt"`
	Success   bool    `json:"success"`
}

NetworkPathHop encapsulates the data for a single hop within a path

type NetworkPathSource

type NetworkPathSource struct {
	Hostname  string       `json:"hostname"`
	Via       *network.Via `json:"via"`
	NetworkID string       `json:"network_id"` // Today this will be a VPC ID since we only resolve AWS resources
}

NetworkPathSource encapsulates information about the source of a path

type Runner

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

Runner executes traceroutes

func NewRunner

func NewRunner() (*Runner, error)

NewRunner initializes a new traceroute runner

func (*Runner) RunTraceroute

func (r *Runner) RunTraceroute(ctx context.Context, cfg Config) (NetworkPath, error)

RunTraceroute wraps the implementation of traceroute so it can be called from the different OS implementations

This code is experimental and will be replaced with a more complete implementation.

type Traceroute

type Traceroute interface {
	Run(context.Context) (NetworkPath, error)
}

Traceroute defines an interface for running traceroutes for the Network Path integration

Jump to

Keyboard shortcuts

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