diff options
Diffstat (limited to 'go/internal/sshenv/sshenv.go')
-rw-r--r-- | go/internal/sshenv/sshenv.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/go/internal/sshenv/sshenv.go b/go/internal/sshenv/sshenv.go new file mode 100644 index 0000000..387feb2 --- /dev/null +++ b/go/internal/sshenv/sshenv.go @@ -0,0 +1,15 @@ +package sshenv + +import ( + "os" + "strings" +) + +func LocalAddr() string { + address := os.Getenv("SSH_CONNECTION") + + if address != "" { + return strings.Fields(address)[0] + } + return "" +} |