Giter Site home page Giter Site logo

prof7bit / udp-reverse-tunnel Goto Github PK

View Code? Open in Web Editor NEW
29.0 29.0 12.0 83 KB

Create an UDP-over-UDP reverse tunnel to make a VPN server behind (CG-)NAT accessible from the outside

Makefile 3.78% C 96.22%
cg-nat nat networking reverse-tunnel tunnel udp udp-tunnel vpn wireguard

udp-reverse-tunnel's People

Contributors

prof7bit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

udp-reverse-tunnel's Issues

Reconnects and breaks UDP flow

I have two machines (A and B) behind NATs and one public server (S). A and B had constant bidirectional UDP flow (RTP audio) using port forwarding. Now without port forwarding they exchange UDP flow with help of udp-reverse-tunnel as follows:

A --> 5001:S --> 5001:B
A:5002 <-- S:5002 <-- A

OS on the machines:

A: Linux 5.10.103-v7+ armv7l
B: Linux 4.4.202-1237-rockchip-ayufan-gfd4492386213 aarch64
S: Linux 5.10.0-20-amd64 x86_64

The UDP flow from machine A to B works perfectly with no interruptions. The flow from machine B to A interrupts after one-two seconds and may recover after tens of seconds.

The ssh connections are stable. Seems the problem occurs only with UDP tunnel. Changing ports doesn't help.

The logs for the non stable UDP tunnel:

$ udp-tunnel -o 111.111.111.111:5002 -s 127.0.0.1:5002
<6>UDP tunnel inside agent v1.2
<6>building tunnels to outside agent at 111.111.111.111, port 5002
<6>forwarding incomimg UDP to 127.0.0.1, port 5002
<6>creating initial outgoing tunnel
$ udp-tunnel -l 5002
<6>UDP tunnel outside agent v1.2
<6>listening on port 5002
<6>new incoming reverse tunnel from: 222.222.222.222:27110
<6>Total: 1, active: 0, spare: 1
<6>new incoming reverse tunnel from: 222.222.222.222:29156
<6>Total: 2, active: 0, spare: 2
<6>removing connection
<6>Total: 1, active: 0, spare: 1
<6>new incoming reverse tunnel from: 222.222.222.222:11751
<6>Total: 2, active: 0, spare: 2
<6>removing connection
<6>Total: 1, active: 0, spare: 1

Trying to build for openwrt with musl instead of glibc curious how many changes would be necessary

Hey I was hoping to run this on an openwrt router that is built with musl instead of glibc.
I am getting a build error that seems indicative that glibc be used instead of musl.

mipsel-openwrt-linux-musl-gcc -MMD -O3 -flto -Wall -Wextra -DVERSION=1.2 -c main.c -o main.o
mipsel-openwrt-linux-musl-gcc -MMD -O3 -flto -Wall -Wextra -DVERSION=1.2 -c connlist.c -o connlist.o
mipsel-openwrt-linux-musl-gcc -MMD -O3 -flto -Wall -Wextra -DVERSION=1.2 -c args.c -o args.o
args.c:2:10: fatal error: argp.h: No such file or directory
    2 | #include <argp.h>
      |          ^~~~~~~~
compilation terminated.
make: *** [Makefile:44: args.o] Error 1

Before I potentially attempt to work around this error, I'm curious if you know what other dependencies there are on glibc that may make this a difficult. The alternative I'm considering right now is using zerotier with a custom standalone planet server and a custom planet file. I do however like this nationalistic approach as I think there is less room for future potential security issues.

Any suggestions you have would be appreciate.

Multiple listen to port?

In my gaming server, i would like to need to open several udp port at once. is it possible to do something like:

udp-tunnel -l 1234 -l 1235

?

Prevent log flooding

The outside agent floods the log when receives UDP packets while there is no any inside agent connected:

new client conection from x.x.x.x:40587
could not find tunnel connection for client, dropping package
new client conection from x.x.x.x:40587
could not find tunnel connection for client, dropping package
new client conection from x.x.x.x:40587
could not find tunnel connection for client, dropping package
...

A better approach would be to show such message just once and wait until at least one tunnel is created, e.g.:

new client conection from x.x.x.x:40587
could not find tunnel connection for client, dropping all following packages
waiting for incoming reverse tunnel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.