Skip to content

Commit 3bc6d8c

Browse files
committed
disentangling conjure and gotapdance, WIP
1 parent 26ee86d commit 3bc6d8c

Some content is hidden

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

90 files changed

+2150
-1395
lines changed

Cargo.lock

Lines changed: 0 additions & 1008 deletions
This file was deleted.

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,38 @@
33
CC = ${CROSS_COMPILE}gcc #--platform=native
44

55
DEBUG_OR_RELEASE = release
6-
RUST_LIB=./target/release/librust_dark_decoy.a
7-
TD_LIB=./libtapdance/libtapdance.a
6+
RUST_LIB=./cmd/detector/target/release/librust_dark_decoy.a
7+
TD_LIB=./cmd/detector/libtapdance/libtapdance.a
88
LIBS=${RUST_LIB} ${TD_LIB} -L/usr/local/lib -lpcap -lpfring -lzmq -lcrypto -lpthread -lrt -lgmp -ldl -lm
99
CFLAGS = -Wall -DENABLE_BPF -DHAVE_PF_RING -DHAVE_PF_RING_ZC -DTAPDANCE_USE_PF_RING_ZERO_COPY -O2 # -g
10-
PROTO_RS_PATH=src/signalling.rs
10+
PROTO_RS_PATH=./cmd/detector/src/signalling.rs
1111
EXE_DIR=./bin
1212

1313
all: rust libtd conjure app registration-server ${PROTO_RS_PATH}
1414

1515
sim: rust libtd conjure-sim app registration-server ${PROTO_RS_PATH}
1616

17-
rust: ./src/*.rs
18-
cargo build --${DEBUG_OR_RELEASE}
17+
rust:
18+
cd ./cmd/detector/ && cargo build --${DEBUG_OR_RELEASE}
1919

2020
test:
21-
cargo test --${DEBUG_OR_RELEASE}
21+
cd ./cmd/detector/ && cargo test --${DEBUG_OR_RELEASE}
2222

2323
app:
2424
[ -d $(EXE_DIR) ] || mkdir -p $(EXE_DIR)
2525
go build -o ${EXE_DIR}/application ./cmd/application
2626

2727
libtd:
28-
cd ./libtapdance/ && make libtapdance.a
28+
cd ./cmd/detector/libtapdance/ && make libtapdance.a
2929

30-
conjure: detect.c loadkey.c rust_util.c rust libtapdance
30+
conjure: rust ./cmd/detector/libtapdance
3131
[ -d $(EXE_DIR) ] || mkdir -p $(EXE_DIR)
32-
${CC} ${CFLAGS} -o ${EXE_DIR}/$@ detect.c loadkey.c rust_util.c ${LIBS}
32+
${CC} ${CFLAGS} -o ${EXE_DIR}/$@ ./cmd/detector/detect.c ./cmd/detector/loadkey.c ./cmd/detector/rust_util.c ${LIBS}
3333

3434

35-
conjure-sim: detect.c loadkey.c rust_util.c rust libtapdance
35+
conjure-sim: rust ./cmd/detector/libtapdance
3636
[ -d $(EXE_DIR) ] || mkdir -p $(EXE_DIR)
37-
${CC} -Wall -O2 -o ${EXE_DIR}/conjure detect.c loadkey.c rust_util.c ${LIBS}
37+
${CC} -Wall -O2 -o ${EXE_DIR}/conjure ./cmd/detector/detect.c ./cmd/detector/loadkey.c ./cmd/detector/rust_util.c ${LIBS}
3838

3939
registration-server:
4040
[ -d $(EXE_DIR) ] || mkdir -p $(EXE_DIR)
@@ -84,7 +84,7 @@ endif
8484
$(RM) -rf backup
8585

8686
clean:
87-
cargo clean
87+
cd ./cmd/detector/ && cargo clean
8888
$(RM) -rf *.o *~ ${EXE_DIR}
8989
cd ./libtapdance/ && make clean
9090

cmd/application/conns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616
"syscall"
1717
"time"
1818

19+
"github.com/refraction-networking/conjure/pkg/log"
1920
cj "github.com/refraction-networking/conjure/pkg/station/lib"
20-
"github.com/refraction-networking/conjure/pkg/station/log"
2121
"github.com/refraction-networking/conjure/pkg/transports"
2222
)
2323

cmd/application/conns_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"time"
1313

1414
"github.com/refraction-networking/conjure/internal/conjurepath"
15+
"github.com/refraction-networking/conjure/pkg/log"
1516
cj "github.com/refraction-networking/conjure/pkg/station/lib"
16-
"github.com/refraction-networking/conjure/pkg/station/log"
1717
)
1818

1919
// MockGeoIP is a mock implementation of the geoip.GeoIP interface.

cmd/application/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"time"
1313

1414
"github.com/refraction-networking/conjure/pkg/dtls/dnat"
15+
"github.com/refraction-networking/conjure/pkg/log"
1516
cj "github.com/refraction-networking/conjure/pkg/station/lib"
16-
"github.com/refraction-networking/conjure/pkg/station/log"
1717
"github.com/refraction-networking/conjure/pkg/transports/connecting/dtls"
1818
"github.com/refraction-networking/conjure/pkg/transports/wrapping/min"
1919
"github.com/refraction-networking/conjure/pkg/transports/wrapping/obfs4"

cmd/cli/README.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Gotapdance CLI version
2+
3+
# Build
4+
After [downloading Golang, TD and dependencies:](../README.md)
5+
6+
```sh
7+
cd ${GOPATH:-~/go}/src/github.com/refraction-networking/gotapdance/cli # works even if GOPATH is not set
8+
go build -a .
9+
```
10+
11+
# Usage
12+
13+
Simply run
14+
15+
```sh
16+
./cli
17+
```
18+
19+
to listen to local connections on default 10500 port.
20+
21+
Then, you'll have a few options:
22+
23+
## Configure HTTP proxy
24+
25+
You will need to ask your particular application(e.g. browser) to use 127.0.0.1:10500 as HTTP proxy.
26+
In Firefox (both mobile and desktop) I prefer to type ```about:config``` into address line and set the following:
27+
28+
```conf
29+
network.proxy.http_port = 10500
30+
network.proxy.http = 127.0.0.1
31+
network.proxy.ssl_port = 10500
32+
network.proxy.ssl = 127.0.0.1
33+
network.proxy.type = 1
34+
```
35+
36+
To disable proxying you may simply set ```network.proxy.type``` back to ```5``` or ```0```.
37+
38+
The same settings are available in Firefox GUI: Preferences->Advanced->Network->Settings
39+
40+
## Configure ssh SOCKS proxy
41+
42+
If you have access to some ssh server, say `socksserver`, you can set up ssh SOCKS tunnel.
43+
First, modify and add the following to `.ssh/config`:
44+
45+
```ssh
46+
Host socksserver-td
47+
Hostname 123.456.789.012
48+
User cookiemonster
49+
ProxyCommand nc -X connect -x 127.0.0.1:10500 %h %p
50+
```
51+
52+
then run `ssh -D1234 socksserver-td -4`
53+
54+
Now in Firefox you could just go to Preferences->Advanced->Network->Settings and set SOCKSv5 host to localhost:1234.
55+
56+
## Some utilities use following enivoronment variables:
57+
58+
```bash
59+
export https_proxy=127.0.0.1:10500
60+
export http_proxy=127.0.0.1:10500
61+
wget https://twitter.com
62+
```
63+
64+
Most of the popular utilities also have a flag to specify a proxy.
65+
66+
## Docker
67+
68+
A simple dockerfile is provided that instantiates a golang environment in which to
69+
run the cli. This is primarily meant to be used with [the GNS3 simulation
70+
environment](https://github.com/refraction-networking/conjure/wiki/GNS3-Simulation).
71+
72+
To build the docker environemnt use:
73+
74+
```sh
75+
# run from repo root
76+
docker build -t gotapdance/cli -f cli/cli.dockerfile .
77+
```
78+
79+
The environemnt can then be attached to using a `docker exec` or using telnet
80+
in the case of gns3. See the [wiki page](https://docs.gns3.com/docs/emulators/create-a-docker-container-for-gns3)
81+
for local docker image builds in gns3 for more details on setting up local
82+
docker appliances in gns3.

cmd/cli/cli.dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM golang:1.20
2+
3+
RUN apt-get update
4+
RUN apt-get install -y -f libzmq3-dev
5+
6+
WORKDIR /go/src/github/refracction-networking/gotapdance
7+
COPY . .
8+
9+
# RUN go get -d -v ./...
10+
RUN go mod download
11+
RUN go mod tidy
12+
RUN go install ./cli
13+
14+
# no run / entrypoint specified. this containter is meant to be run w/
15+
# gns3 and connected to using terminal or telnet.

cmd/cli/go.mod

Whitespace-only changes.

0 commit comments

Comments
 (0)