Last active
April 11, 2019 13:38
-
-
Save mveytsman/55e06c725443fe63cb1e4519ab21520a to your computer and use it in GitHub Desktop.
Localtunnel replacement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#hacky way to get a hosts ip | |
function ipfor() { | |
ping -c 1 $1 | grep -Eo -m 1 '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'; | |
} | |
# localtunnel replacement (note that I default ssh to port 443 because thats how I roll | |
localtunnel() { if [ $# -lt 2 ]; then echo "Usage: localtunnel hostname port [ssh_port]"; else ssh_port=${3-443}; echo "Setting up localtunnel on `ipfor $1`"; ssh -N -R "*:0:localhost:$2" $1 -p $ssh_port; fi;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment