Coder Social home page Coder Social logo

wireguard-port-test's Introduction

wireguard-port-test

util for testing forwarded ports through wireguard vpn

this script creates a temporary linuxserver/wireguard container, installs socat, and then listens on a specified port. you can then connect remotely to test if your vpn is actually forwarding the port.

i use this to test bittorrent connectability โ€“ you get way more peers if your bt client can listen. note that your vpn provider needs to actually support port forwarding, and you have to set that up first for your specific port. i suggest choosing a random port between 10000 and 65353. you want this port to be unique to you for your vpn endpoint.

installation

git clone https://github.com/ftc2/wireguard-port-test.git

usage

wg_listen.sh CONF PORT [FILTER]
    listen inside of wireguard to test if a forwarded port is working
  args:
    CONF: path to wireguard config file (prepend with './' for relative path)
    PORT: listening port
    FILTER: optional IP range to filter (e.g. 'your_real_ip/32')
            useful if you're getting a lot of spammy traffic on the port,
            and you can't see your test connection

example

i've seen problems with using the same wireguard conf multiple times simultaneously, so i suggest shutting down wireguard elsewhere during testing

pretend your real ip is 142.250.190.110

$ ./wg_listen.sh ./torguard.sanfrancisco.conf 12345 142.250.190.110/32
...
**************************************************
LISTENING ON VPN: 167.99.163.123:12345/tcp
**************************************************
 try connecting remotely with a command like:
nc -v 167.99.163.123 12345
 or better yet (socat is a superior tool!):
socat TCP:167.99.163.123:12345 -
 and then on either end, you can type stuff in and
  hit enter. you should see it echoed on both ends
  like a chat.
**************************************************
+ eval socat TCP-LISTEN:12345,reuseaddr,keepalive,fork,range=142.250.190.110/32 -
++ socat TCP-LISTEN:12345,reuseaddr,keepalive,fork,range=142.250.190.110/32 -
hey
hows it going

then, in another term:

$ socat TCP:167.99.163.123:12345 -
hey
hows it going

tips

kill the container if it hangs:

docker kill wireguard-port-test

wireguard-port-test's People

Contributors

ftc2 avatar

Watchers

 avatar

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.