{"id":37223135,"url":"https://github.com/jonenine/ferry","last_synced_at":"2026-01-15T01:34:24.283Z","repository":{"id":53284911,"uuid":"213531214","full_name":"jonenine/ferry","owner":"jonenine","description":"将内网服务开放（摆渡、代理）到公网","archived":false,"fork":false,"pushed_at":"2021-03-31T21:27:21.000Z","size":562,"stargazers_count":16,"open_issues_count":2,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T18:55:41.872Z","etag":null,"topics":["golang","java","proxy"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonenine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-08T02:29:23.000Z","updated_at":"2024-06-21T18:55:41.873Z","dependencies_parsed_at":"2022-08-28T17:30:34.734Z","dependency_job_id":null,"html_url":"https://github.com/jonenine/ferry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonenine/ferry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonenine%2Fferry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonenine%2Fferry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonenine%2Fferry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonenine%2Fferry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonenine","download_url":"https://codeload.github.com/jonenine/ferry/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonenine%2Fferry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"ssl_error","status_checked_at":"2026-01-15T00:55:20.945Z","response_time":107,"last_error":"SSL_read: 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":["golang","java","proxy"],"created_at":"2026-01-15T01:34:23.530Z","updated_at":"2026-01-15T01:34:24.267Z","avatar_url":"https://github.com/jonenine.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 公网反向摆渡（代理）到内网\n\n golang java proxy ferry\n\n---\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;业务系统一般部署在内网，内网和公网之间一般是物理隔离或是防火墙隔离的，但有的时候也需要将内网网段的服务开放到公网上，用来进行调试、确认等临时工作。\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;公网访问内网，一般要具备两个条件（1）到运营商申请固定IP （2）通过路由器，代理服务器等将内网端口映射到固定IP上。 这种方式成本较高，不适合小公司，小团队操作。\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;有的时候公网资源有限。比如：还是因为成本限制，不可能在阿里云上租用大量的服务器；或者因为licence限制，也不可能将很多非开源中间件（比如oracle）部署在阿里云上。那么就需要出现一个工具，可以方便的将内网的资源开放到公网。（注意，这样做同样不要违反中间件版权涉及的法律约束）\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;工具的实质就是将客户端请求从公网代理（反向摆渡）给内网的服务中，再将内网服务的响应返回到外网的客户端。\u003cbr/\u003e\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;…想到便要做到…\u003cbr/\u003e\n\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;于是这样一款反向摆渡工具就诞生了。\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;(1)\t内网摆渡程序需要登录到云端代理程序，保证安全性\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;(2)\t云端代理程序按照内网请求动态监听端口\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;(3)\t代理程序就一个可执行文件，拷贝到云端执行即可。内网摆渡是一个spring boot程序，配置极简。一共就两个进程，不依赖数据库及其他组件\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;(4)\t一旦内网程序关闭web socket客户端，云端代理便会关闭socket监听。收放自如\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;(5)\t云端程序采用golang编写，性能消耗极小（测试时性能消耗在1%左右），占内存也只占用几十M。租一个阿里的低配虚拟机可以同时将很多内网服务开放到公网。\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;(6)\t这是个开源程序（而且是用java和go这两种低成本的语言编写），你可以改成任何你需要的样子，这才是最大的优点。\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;如图所示：\u003cbr/\u003e\n![此处输入图片的描述][1]\n类图:\n![此处输入图片的描述][2]\n配置使用说明:\n![此处输入图片的描述][3]\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;摆渡程序分两部分组成，在内网的部分做web socket客户端和tcp客户端，使用java编写。公网云端的程序做web socket服务端和tcp服务端，使用go编写 。\u003cbr/\u003e\n\n注:readme中图片不能显示的请翻墙查看\n\n  [1]: https://github.com/jonenine/ferry/blob/master/docs/1.jpg\n  [2]: https://github.com/jonenine/ferry/blob/master/docs/2.jpg\n  [3]: https://github.com/jonenine/ferry/blob/master/docs/3.jpg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonenine%2Fferry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonenine%2Fferry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonenine%2Fferry/lists"}