{"id":19874461,"url":"https://github.com/strongloop/strong-tunnel","last_synced_at":"2025-06-24T15:35:46.195Z","repository":{"id":27565893,"uuid":"31048046","full_name":"strongloop/strong-tunnel","owner":"strongloop","description":"Disposable ssh proxy for TCP connections via URL","archived":false,"fork":false,"pushed_at":"2016-08-19T22:53:02.000Z","size":47,"stargazers_count":6,"open_issues_count":1,"forks_count":5,"subscribers_count":46,"default_branch":"master","last_synced_at":"2024-10-30T22:54:53.943Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dalavanmanphonsy/safepath","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/strongloop.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-20T02:27:51.000Z","updated_at":"2020-07-01T17:08:36.000Z","dependencies_parsed_at":"2022-09-01T20:51:29.618Z","dependency_job_id":null,"html_url":"https://github.com/strongloop/strong-tunnel","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fstrong-tunnel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fstrong-tunnel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fstrong-tunnel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strongloop%2Fstrong-tunnel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strongloop","download_url":"https://codeload.github.com/strongloop/strong-tunnel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224307051,"owners_count":17289739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-12T16:23:26.214Z","updated_at":"2024-11-12T16:23:28.333Z","avatar_url":"https://github.com/strongloop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# strong-tunnel\n\nEasy tunnelling over ssh2.\n\n## Usage\n\nThere is nothing to configure, but some environment variables are used to\nset defaults if no options are given.\n\n```\nvar st = require('strong-tunnel');\n\nst(someUrl, sshOpts, function(err, url) {\n  // if someUrl was plain http, url will be someUrl\n  // if someUrl was http+ssh://, url points to a local ephemeral tunnel\n  // sshOpts is optional with defaults described below.\n  http.get(url, onResponse);\n});\n```\n\n### Username\n\nYour current local username is assumed to be the username used for ssh. To\noverride this you can set the `LOGNAME` environment variable to the desired\nusername before the tunnel URL is created.\n\n### Credentials\n\nTo keep the API simple, it is assumed that an ssh agent is already running,\nthat the path to its domain socket is in the `SSH_AUTH_SOCK` environment\nvariable, and that an appropriate private key has been loaded into that agent.\n\nThis is usually done for you in modern \\*nix environments as part of your\nlogin shell/session. See\n[ssh-agent(1)](http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/ssh-agent.1)\nfor more information about ssh agents.\n\n### Longer Example\n\n```js\nvar fmt = require('util').format;\nvar fs = require('fs');\nvar http = require('http');\nvar st = require('strong-tunnel');\n\nvar server = http.createServer(function(req, res) {\n  res.end(JSON.stringify(req.headers));\n});\n\nvar sshOpts = {\n  host: '127.0.0.1',\n};\n\n// The following are not required and if they aren't set here or in the ENV,\n// strong-tunnel will use logical default values.\nsshOpts.port = process.env.SSH_PORT;\nsshOpts.username = process.env.SSH_USERNAME;\nif (process.env.SSH_PRIVATE_KEY) {\n  sshOpts.privateKey = fs.readFileSync(process.env.SSH_PRIVATE_KEY, 'utf8');\n}\n\nserver.listen(0, '127.0.0.1', function() {\n  var httpPort = this.address().port;\n  var direct = fmt('http://127.0.0.1:%d/', httpPort);\n  var tunneled = fmt('http+ssh://127.0.0.1:%d/', httpPort);\n\n  // Standard request using URL string\n  http.get(direct, resLog('%s using %s:', direct, direct));\n\n  // URL is only modified if a tunneling URL was given\n  st(direct, function(err, url) {\n    if (err) throw err;\n    // url == direct, unmodified\n    http.get(url, resLog('%s using %s:', direct, url));\n  });\n\n  // optional second argument containing ssh config\n  st(tunneled, sshOpts, function(err, url) {\n    if (err) throw err;\n    // url != tunneled, is modified\n    http.get(url, resLog('%s using %s:', tunneled, url));\n  });\n\n  server.unref();\n});\n\nfunction resLog(prefix) {\n  prefix = fmt.apply(null, arguments);\n  return function onResponse(res) {\n    res.on('data', function(d) {\n      console.log('%s -\u003e %s', prefix, d);\n    });\n  };\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrongloop%2Fstrong-tunnel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrongloop%2Fstrong-tunnel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrongloop%2Fstrong-tunnel/lists"}