Skip to content

Instantly share code, notes, and snippets.

@artyom-poptsov
Created May 23, 2015 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artyom-poptsov/8e131ed3997df712c9e3 to your computer and use it in GitHub Desktop.
Save artyom-poptsov/8e131ed3997df712c9e3 to your computer and use it in GitHub Desktop.
guile-ssh-tunnel-example
#!/usr/bin/guile \
-e main
!#
(use-modules (ssh session)
(ssh auth)
(ssh key)
(ssh tunnel))
(define (main args)
(let ((s (make-session #:user "alice"
#:host "localhost"
#:port 22
#:log-verbosity 'nolog))
(k (private-key-from-file "/home/alice/.ssh/id_rsa")))
(connect! s)
(userauth-public-key! s k)
(let ((t (make-tunnel s
#:local-port 8080
#:remote-host "www.example.org"
#:remote-port 80)))
(start-forward t))))
@artyom-poptsov
Copy link
Author

Although the port forwarding functionality is still under development (see the branch wip-port-forwarding -- https://github.com/artyom-poptsov/guile-ssh/tree/wip-port-forwarding), it is already possible to do something like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment