mirror of
https://github.com/srid/nixos-config.git
synced 2026-07-16 22:01:33 +08:00
portfwd
This commit is contained in:
parent
080f04b4ab
commit
87d306bb33
1 changed files with 20 additions and 0 deletions
20
packages/portfwd.nix
Normal file
20
packages/portfwd.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{ writeShellApplication, openssh, ... }:
|
||||
|
||||
writeShellApplication {
|
||||
name = "portfwd";
|
||||
meta.description = ''
|
||||
Forward a local port to the same port on a remote host over SSH.
|
||||
Usage: portfwd <port> [host] (host defaults to pureintent)
|
||||
e.g. `portfwd 7721` or `portfwd 7721 sincereintent`
|
||||
'';
|
||||
runtimeInputs = [ openssh ];
|
||||
text = ''
|
||||
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
|
||||
echo "usage: portfwd <port> [host]" >&2
|
||||
exit 1
|
||||
fi
|
||||
port="$1"
|
||||
host="''${2:-pureintent}"
|
||||
ssh -L "$port:localhost:$port" "$host"
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue