mirror of
https://github.com/DictXiong/dotfiles.git
synced 2024-11-24 11:56:59 +08:00
riot: dynamic port forwarding
This commit is contained in:
parent
ce657c8300
commit
35c302a445
15
scripts/riot
15
scripts/riot
|
@ -163,6 +163,18 @@ run_sshl()
|
|||
eval_or_echo $cmd
|
||||
}
|
||||
|
||||
# sshd
|
||||
run_sshd()
|
||||
{
|
||||
local port=$(get_free_port)
|
||||
|
||||
SSH_OPTIONS="$SSH_OPTIONS -NC -D $port"
|
||||
local cmd="$(prepare_ssh_cmd ssh)"
|
||||
fmt_note "-->" $cmd
|
||||
fmt_note " > please access localhost:$port"
|
||||
eval_or_echo $cmd
|
||||
}
|
||||
|
||||
# scp
|
||||
run_scp() {
|
||||
local src="$1"
|
||||
|
@ -228,6 +240,9 @@ router() {
|
|||
test -n "$3" || fmt_fatal "no target address provided"
|
||||
run_sshl "$3"
|
||||
;;
|
||||
sshd )
|
||||
run_sshd
|
||||
;;
|
||||
scp )
|
||||
test -n "$3" || fmt_fatal "no source path specified"
|
||||
test -n "$4" || fmt_fatal "no destination path specified"
|
||||
|
|
Loading…
Reference in New Issue
Block a user