https://github.com/getlantern/packetforward
Packet forwarding on top of gotun
https://github.com/getlantern/packetforward
Last synced: 8 months ago
JSON representation
Packet forwarding on top of gotun
- Host: GitHub
- URL: https://github.com/getlantern/packetforward
- Owner: getlantern
- License: apache-2.0
- Created: 2019-02-20T21:45:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-11-10T18:13:49.000Z (over 5 years ago)
- Last Synced: 2024-06-21T00:15:17.749Z (almost 2 years ago)
- Language: Go
- Size: 31.7 MB
- Stars: 6
- Watchers: 9
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
packetforward [](http://godoc.org/github.com/getlantern/packetforward) [](https://drone.lantern.io/getlantern/packetforward) [](https://coveralls.io/github/getlantern/packetforward)
==========
A library for forwarding packets.
## Dependencies
This library uses Go modules. When running commands like `go test` in this repository, make sure the GO111MODULE environment variable is set to 'on'. See the [go command documentation](https://golang.org/cmd/go/#hdr-Preliminary_module_support) for more details. If you are running Go 1.13 or later, this should not be necessary as the Go tool will support modules by default.
## Testing
Tests in this package require root access. The easiest way to test is to compile the tests with `go test -c` and run the output binary using the `sudo` command.
Be careful if you choose to run the Go tool with the sudo command (e.g. `sudo go test`). This can cause issues if the tool attempts to download missing dependencies. Namely, the Go tool may not be able to download anything as Git will likely be using a different SSH keypair (or no keypair at all). Worse, the Go tool may create folders in $GOPATH/pkg/mod/cache owned by the root user. This can disrupt future use of the Go tool, even outside of this repository.
## Demo
This repository includes a demo client and server in `demo/client` and `demo/server`.
The server forwards TCP and UDP packets to hardcoded IP addresses configured with the `-tcpdest` and `-udpdest` flags.
The client opens a TUN device.
For example:
```
sudo iptables -d OUTPUT -p tcp -m conntrack --ctstate ESTABLISHED --ctdir ORIGINAL --tcp-flags RST RST -j DROP
cd demo/server
go build && sudo ./server
```
```
cd demo/client
go build && sudo ./client
```
```
curl http://10.0.0.1/1GB.zip > /dev/null
```