Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

Commit d5fd0a0

Browse files
committed
Initial commit
0 parents  commit d5fd0a0

File tree

217 files changed

+79780
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+79780
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Dockerfile
2+
.git

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2+
*.o
3+
*.a
4+
*.so
5+
6+
# Folders
7+
_obj
8+
_test
9+
10+
# Architecture specific extensions/prefixes
11+
*.[568vq]
12+
[568vq].out
13+
14+
*.cgo1.go
15+
*.cgo2.c
16+
_cgo_defun.c
17+
_cgo_gotypes.go
18+
_cgo_export.*
19+
20+
_testmain.go
21+
22+
*.exe
23+
*.test
24+
*.prof

.gometalinter.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"Enable": ["vet", "golint", "gotype"],
3+
"Exclude": ["exported \\S+ \\S+ should have comment or be unexported"]
4+
}

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["ms-vscode.go"]
3+
}

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"go.vetOnSave": "off",
4+
"go.buildOnSave": "off",
5+
"go.lintTool": "gometalinter"
6+
}

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM golang:1.10 as builder
2+
RUN apt-get -y update \
3+
&& apt-get -y install libnetfilter-queue-dev
4+
WORKDIR /go/src/github.com/hownetworks/tracetrout
5+
COPY . .
6+
RUN go build -o /tracetrout -ldflags="-s -w"
7+
8+
FROM debian:stretch-slim
9+
RUN apt-get -y update \
10+
&& apt-get -y install iptables libnetfilter-queue1 \
11+
&& rm -rf /var/lib/apt/lists/*
12+
WORKDIR /go/src/app
13+
COPY entrypoint.sh .
14+
COPY --from=builder /tracetrout .
15+
ENTRYPOINT ["sh", "entrypoint.sh"]
16+
CMD ["./tracetrout"]

Gopkg.lock

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
# Gopkg.toml example
3+
#
4+
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
5+
# for detailed Gopkg.toml documentation.
6+
#
7+
# required = ["github.com/user/thing/cmd/thing"]
8+
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
9+
#
10+
# [[constraint]]
11+
# name = "github.com/user/project"
12+
# version = "1.0.0"
13+
#
14+
# [[constraint]]
15+
# name = "github.com/user/project2"
16+
# branch = "dev"
17+
# source = "github.com/myfork/project2"
18+
#
19+
# [[override]]
20+
# name = "github.com/x/y"
21+
# version = "2.4.0"
22+
23+
24+
[[constraint]]
25+
name = "github.com/google/gopacket"
26+
version = "1.1.14"
27+
28+
[[constraint]]
29+
name = "github.com/kelseyhightower/envconfig"
30+
version = "1.3.0"
31+
32+
[[constraint]]
33+
name = "github.com/rs/cors"
34+
version = "1.3.0"
35+
36+
[[constraint]]
37+
name = "github.com/hownetworks/nfq-go"
38+
version = "1.0.0"

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# TraceTrout
2+
3+
<img src="trout.jpg">A dramatization of [a rainbot trout](https://en.wikipedia.org/wiki/File:Rainbow_trout_transparent.png) swimming against [the data stream](https://pixabay.com/en/background-bits-bit-network-blue-213649/).</img>
4+
5+
## Prerequisites
6+
7+
The code is designed to run on Linux. Also ensure that `iptables` and `libnetfilter-queue1` packages are installed:
8+
9+
```sh
10+
$ apt-get install iptables libnetfilter-queue1
11+
```
12+
13+
Modify your iptables:
14+
15+
```sh
16+
$ iptables -A OUTPUT -p tcp --sport 8080 -j NFQUEUE --queue-num 0
17+
$ iptables -A INPUT -p tcp --dport 8080 -j NFQUEUE --queue-num 0
18+
$ iptables -A INPUT -p icmp --icmp-type time-exceeded -j NFQUEUE --queue-num 0
19+
```
20+
21+
```sh
22+
$ iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
23+
```
24+
25+
## Compiling
26+
27+
Compilation requires the `netfilter-queue-dev` package and Go 1.8 or later.
28+
29+
```sh
30+
$ apt-get install netfilter-queue-dev
31+
$ go build
32+
```
33+
34+
## Running
35+
36+
To start listening on port 8080:
37+
38+
```sh
39+
$ ./tracetrout
40+
```
41+
42+
## Prior Art
43+
44+
* https://dankaminsky.com/2002/11/18/77/, the section about `paratrace`.
45+
* https://lwn.net/Articles/217023/
46+
* https://github.com/david415/ParasiticTraceroute

entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
iptables -A OUTPUT -p tcp --sport 8080 -j NFQUEUE --queue-num 0
2+
iptables -A INPUT -p tcp --dport 8080 -j NFQUEUE --queue-num 0
3+
iptables -A INPUT -p icmp --icmp-type time-exceeded -j NFQUEUE --queue-num 0
4+
5+
ip6tables -A OUTPUT -p tcp --sport 8080 -j NFQUEUE --queue-num 0
6+
ip6tables -A INPUT -p tcp --dport 8080 -j NFQUEUE --queue-num 0
7+
ip6tables -A INPUT -p icmpv6 --icmpv6-type time-exceeded -j NFQUEUE --queue-num 0
8+
9+
$@

0 commit comments

Comments
 (0)