Skip to content

Instantly share code, notes, and snippets.

@BH1SCW
Forked from sergei-mironov/mosh-nat-server.sh
Created April 28, 2022 07:58
Show Gist options
  • Save BH1SCW/7214b2807a81e9fafae4f19256ed18b0 to your computer and use it in GitHub Desktop.
Save BH1SCW/7214b2807a81e9fafae4f19256ed18b0 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