Skip to content

Instantly share code, notes, and snippets.

@grwlf
Created September 15, 2019 20:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save grwlf/3f054e7f56e9e4c919a4a42e69ca3a93 to your computer and use it in GitHub Desktop.
Save grwlf/3f054e7f56e9e4c919a4a42e69ca3a93 to your computer and use it in GitHub Desktop.
mosh-nat-server.sh
#!/bin/sh
RELAY="$1"
PORT="$2"
echo -n 'nat-hole-punch' | socat STDIN "UDP-SENDTO:$RELAY:$PORT,sourceport=$PORT"
mosh-server new -p "$PORT" | sed -n 's/MOSH CONNECT [0-9]\+ \(.*\)$/\1/g p'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment