{"id":25668477,"url":"https://github.com/borud/tunnel","last_synced_at":"2026-03-05T23:03:45.711Z","repository":{"id":205295456,"uuid":"713896771","full_name":"borud/tunnel","owner":"borud","description":"Simple library for tunneling network connections over SSH","archived":false,"fork":false,"pushed_at":"2025-09-25T15:39:34.000Z","size":28,"stargazers_count":10,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-25T17:35:17.945Z","etag":null,"topics":["go","golang","ssh","tunnel","tunnel-client","tunnel-server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/borud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-11-03T13:21:43.000Z","updated_at":"2025-09-25T15:37:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec426f83-9107-4f57-bb7a-e4bd1121e221","html_url":"https://github.com/borud/tunnel","commit_stats":null,"previous_names":["borud/tunnel"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/borud/tunnel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Ftunnel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Ftunnel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Ftunnel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Ftunnel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borud","download_url":"https://codeload.github.com/borud/tunnel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Ftunnel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30154293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"ssl_error","status_checked_at":"2026-03-05T22:39:24.771Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","ssh","tunnel","tunnel-client","tunnel-server"],"created_at":"2025-02-24T10:34:11.927Z","updated_at":"2026-03-05T23:03:45.706Z","avatar_url":"https://github.com/borud.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tunnel\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/borud/tunnel.svg)](https://pkg.go.dev/github.com/borud/tunnel)\n\n`tunnel` is a very simple library that allows you to create multi-hop SSH\ntunnels. From the endpointof the tunnel you can then `Dial()` to create network\nconnections, or you can `Listen()` for incoming connections.\n\nThis library supports both using the SSH Agent to load any keys you might need as well as loading keys from files or from `[]byte` slices in PEM format.\n\nPer default the implementation will keep track of any connections or listeners you make.  If you shut this off you have to manage the connections yourself. I recommend using the default behavior (library tracks connections).\n\nYou can create multiple connections through the same tunnel.\n\n## Usage Examples\n\nPlease have a look in the [examples](examples) directory for some usage examples.\n\n## Typical use\n\n### Import\n\nAdd the following import and run `go mod tidy` to add tunnel to your project.\n\n```go\nimport \"github.com/borud/tunnel\"\n```\n\n### Creating the tunnel\n\nThis example just creates a tunnel with two hops\n\n```go\ntun, err := tunnel.Create(\n  tunnel.WithHop(\"user@first.example.com\"), \n  tunnel.WithHop(\"user@second.example.com\"), \n  tunnel.WithAgent(), \n  tunnel.WithHostKeyCallback(ssh.InsecureIgnoreHostKey()),\n)\n```\n\n### Dial\n\nYou can `Dial` to create a new connection over the tunnel like so:\n\n```go\n  conn, err := tun.Dial(\"tcp\", \"service.example.com:4711\")\n```\n\nIf everything went according to plan you now have a tunnel that terminates at\nsecond.example.com (since it is the last hop) and connects from there to port\n4711 on service.example.com\n\n### Listen\n\nYou can also listen on the remote endpoint.\n\n```go\nlistener, err := tunnel.Listen(\"tcp\", \":80\")\n```\n\n## A note on Listen ports\n\nWhen you want to `Listen` to remote ports that should be externally available,\nyou have to make sure that the SSH daemon is configured to allow this.  Please\nreview the `GatewayPorts` and `AllowTcpForwarding` configuration options in\n`sshd_config`.  If you were too lazy to read this paragraph and are just\nlooking for a cut and paste, the config is:\n\n```text\nGatewayPorts yes\nAllowTcpForwarding yes\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborud%2Ftunnel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborud%2Ftunnel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborud%2Ftunnel/lists"}