diff --git a/.gitignore b/.gitignore index daf913b1..a1d4e4c3 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ _testmain.go *.exe *.test *.prof +sshpiperd/example/sshpiperd_key* diff --git a/sshpiperd/example/showme.sh b/sshpiperd/example/showme.sh new file mode 100755 index 00000000..90873b9f --- /dev/null +++ b/sshpiperd/example/showme.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +if [ -z $GOPATH ]; then + echo "set go path first" + exit 1 +fi + +echo "Using go path $GOPATH" + + +if [ ! -f $GOPATH/bin/sshpiperd ];then + go get github.com/tg123/sshpiper/sshpiperd + go install github.com/tg123/sshpiper/sshpiperd +fi + +SSHPIPERD_BIN="$GOPATH/bin/sshpiperd" +BASEDIR="$GOPATH/src/github.com/tg123/sshpiper/sshpiperd/example" + +if [ ! -f $BASEDIR/sshpiperd_key ];then + ssh-keygen -N '' -f $BASEDIR/sshpiperd_key +fi + +for u in `find $BASEDIR/workingdir/ -name sshpiper_upstream`; do + upstream=`cat $u` + + username=`dirname $u` + username=`basename $username` + + echo "ssh 127.0.0.1 -p 2222 -l $username # connect to $upstream" +done + +$SSHPIPERD_BIN -i $BASEDIR/sshpiperd_key -w $BASEDIR/workingdir diff --git a/sshpiperd/example/workingdir/github/sshpiper_upstream b/sshpiperd/example/workingdir/github/sshpiper_upstream new file mode 100644 index 00000000..f1755e4c --- /dev/null +++ b/sshpiperd/example/workingdir/github/sshpiper_upstream @@ -0,0 +1 @@ +github.com:22 diff --git a/sshpiperd/example/workingdir/linode/sshpiper_upstream b/sshpiperd/example/workingdir/linode/sshpiper_upstream new file mode 100644 index 00000000..b0392a05 --- /dev/null +++ b/sshpiperd/example/workingdir/linode/sshpiper_upstream @@ -0,0 +1 @@ +lish-atlanta.linode.com:22