traas2

package module
v0.0.0-...-43d8f34 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

README

TRAASv2

Install: go get github.com/willscott/traas2/server

Traas provides "traceroute as a service". A webserver that provides information on the path that client packets take in reaching it. Information is provided on the reverse path (the path from the server to the client). The TraceRoute conducted is parasitic, meaning that it will be conducted over the same TCP connection that the client has opened in connecting to the server. This means that the information can sometimes provide information on the network structure near the client. For example, consider the following diagram:

Server ---- NAT --- Client

There are many cases where the client cannot learn about its own local network conditions. Perhaps an HTTP proxy is involved. Perhaps an internal NAT prevents the client from gaining information about anything beyond an immediate LAN. A direct traceroute from a remote server won't help either, as it will only be able to see the network up until the first NAT. TCP traceorutes provide an opportunity to potentially learn information about the active IP addresses and path within carrier grade NATs that would not otherwise be easily visible.


Installation

apt-get install libpcapdev
cd server
go get
go build
sudo setcap cap_net_raw,cap_net_admin,cap_dac_override+eip server

Configuration

By default, a configuration file is expected in ./.config/traas.json. An explicit file can be specified using the --config= command line flag. A new configuration file can be generated using the --init command line flag.

The following configuration parameters are used by Traas:

  • ServePort - Which port the HTTP server is bound to. Default: 8080
  • ListenPort - Incoming packets on this port are listened to by the pcap listener. Default: 8080. this value can differ from the ServePort when Traas is protected by a forward proxy, like Nginx or equivalent. In those cases, the forward proxy would relay requests to Traas, but the listener continues to rely on watching the actual packets from the client.
  • Path - Traas can be prefixed to allow multiple applications to be served on the server. For example, "/traas" would limit its scope. Default: ""
  • Root - Where Traas looks for the demo/ folder. Default: ".." (one folder up from server/)
  • Device - Which ethernet device to bind to. Default: eth0, or the first device on your system.
  • DstMac - The ethernet address of the default gateway. This can be found in the output of
    netstat -rn
    
  • originHeader - If there is a local forwarding web server, request to the http server will be from localhost, and the origin clientIP should be passed in an additional HTTP header. That header can be specified here. Default: ""
  • log - A file that completed traceroutes are logged to when returned to a client. Default: stdout

Documentation

Index

Constants

View Source
const TraceLongestTTL = 32

TraceLongestTTL indicates the largest ttl used

View Source
const TraceMaxReplies = 64

TraceMaxReplies indicates how many hops can be recorded for a trace.

View Source
const TraceShortestTTL = 4

TraceShortestTTL indicates the lowest ttl used

Variables

This section is empty.

Functions

This section is empty.

Types

type Hop

type Hop struct {
	TTL      uint8
	IP       net.IP
	Sent     time.Time `json:"-"`
	Received time.Time
	Latency  time.Duration
	Packet   gopacket.Packet
}

Hop represents the traceroute at a single TTL

type Probe

type Probe struct {
	Payload []byte
}

Probe represents a tcp injection.

type Route

type Route []Hop

Route is a sortable list of hops

func (Route) Len

func (r Route) Len() int

func (Route) Less

func (r Route) Less(i, j int) bool

func (Route) Swap

func (r Route) Swap(i, j int)

type Trace

type Trace struct {
	To       net.IP
	Sent     time.Time
	Recorded uint16 `json:"-"`
	Route    Route
	Hops     [TraceMaxReplies]Hop `json:"-"`
	Cancel   context.CancelFunc   `json:"-"`
}

Trace represents the stored state for an ongoing traceroute

Directories

Path Synopsis
lib

Jump to

Keyboard shortcuts

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