aboutsummaryrefslogtreecommitdiff
path: root/pkgs/yossh/examples/home_wifi.lua
diff options
context:
space:
mode:
authorCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-03-03 16:45:26 -0600
committerCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-03-03 16:45:26 -0600
commitc29a14135736c2516bb5d951e6e97dc8143598db (patch)
tree925628abfe934e3ea2cfd4a70357f8f9b5acb474 /pkgs/yossh/examples/home_wifi.lua
parentce2cc260710f801c10302847796b931f7ed19709 (diff)
changes
Diffstat (limited to 'pkgs/yossh/examples/home_wifi.lua')
-rwxr-xr-xpkgs/yossh/examples/home_wifi.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/pkgs/yossh/examples/home_wifi.lua b/pkgs/yossh/examples/home_wifi.lua
new file mode 100755
index 0000000..8df2aad
--- /dev/null
+++ b/pkgs/yossh/examples/home_wifi.lua
@@ -0,0 +1,33 @@
+#!/bin/sh
+yoshi = dofile'yoshi.lua'
+
+local function isHome()
+ local ok, reason, code = os.execute("nc -z -w1 192.168.50.2 2222")
+ return code == 0
+end
+
+yoshi.hosts["ganymede"] = function()
+ if isHome() then
+ return yoshi.ssh{
+ HostName = "192.168.50.2",
+ Port = 2222,
+ LocalForward = 8010
+ }
+ else
+ return yoshi.ssh{
+ HostName = "williamsfam.us.com",
+ LocalForward = 8010,
+ DynamicForward = 9090
+ }
+ end
+end
+
+yoshi.hosts["io"] = function()
+ return yoshi.ssh{
+ HostName = "192.168.50.3",
+ User = "admin",
+ ProxyJump = isHome() or "collin@ganymede",
+ }
+end
+
+yoshi.run(arg, {dry_run = true})