{"id":51274792,"url":"https://github.com/dobyte/closed-source-solution","last_synced_at":"2026-06-29T20:30:29.959Z","repository":{"id":357547925,"uuid":"1237442051","full_name":"dobyte/closed-source-solution","owner":"dobyte","description":"一款用于Go商业项目闭源化的解决方案","archived":false,"fork":false,"pushed_at":"2026-05-13T08:08:37.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-13T09:32:00.904Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dobyte.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-13T07:28:36.000Z","updated_at":"2026-05-13T08:23:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dobyte/closed-source-solution","commit_stats":null,"previous_names":["dobyte/closed-source-solution"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dobyte/closed-source-solution","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobyte%2Fclosed-source-solution","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobyte%2Fclosed-source-solution/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobyte%2Fclosed-source-solution/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobyte%2Fclosed-source-solution/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dobyte","download_url":"https://codeload.github.com/dobyte/closed-source-solution/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobyte%2Fclosed-source-solution/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34942665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-06-29T20:30:28.613Z","updated_at":"2026-06-29T20:30:29.954Z","avatar_url":"https://github.com/dobyte.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# closed-source-solution\n\n### 1.介绍\n\nclosed-source-solution是一款用于Go商业项目闭源化的解决方案。该解决方案分为编译客户端（compile）和编译服务端（remote）两部分组成，主要工作流程如下：\n\n```mermaid\nsequenceDiagram\nparticipant compile as 编译客户端（compile）\nparticipant remote as 编译服务端（remote）\n\ncompile -\u003e\u003e compile: 将本地go.mod、go.sum、*.go、*.sh文件打包成zip压缩包\ncompile -\u003e\u003e remote: 建立连接，发送编译命令和zip源码压缩包到编译服务端\nremote --\u003e\u003e remote: 解析编译命令并解压zip源码\nremote --\u003e\u003e remote: 执行命令中指定的shell脚本（替换核心代码仓库，这一步是闭源的关键）\nremote --\u003e\u003e remote: 通过go build编译项目生成可执行文件\nremote --\u003e\u003e compile: 下发可执行文件到编译客户端，并断开连接\n```\n\n### 2.优势\n\n* 支持商业项目闭源化解决方案。\n\n* 支持自定义shell执行脚本，可根据自身需求做定制化的核心库替换工作。\n\n* 支持编译客户端侧的自动环境检测（GOOS、GOARCH等），根据环境自动选择合适的编译参数。\n\n* 支持文件分块传输，传输效率非常高。\n\n* 支持服务端编译错误的返回，客户端可根据错误信息进行调试。\n\n\n### 3.安装\n\n\u003e 使用go install进行安装需要首先安装go 1.25+环境\n\n```bash\ngo env -w GOSUMDB=off\n\n# 安装编译客户端\ngo install github.com/dobyte/closed-source-solution/compile@latest\n\n# 安装编译服务端\ngo install github.com/dobyte/closed-source-solution/remote@latest\n\ngo env -w GOSUMDB=on\n```\n\n\u003e 安装完成后，将compile和remote分别改为closed-source-solution-compile和closed-source-solution-remote，并添加到环境变量中，即可在任何地方使用。\n\n### 4.remote用法\n\n```bash\nNAME:\n   closed-source-solution-remote - remote compile server\n\nUSAGE:\n   closed-source-solution-remote [global options]\n\nGLOBAL OPTIONS:\n   --addr string  specify the address of the server (default: \":8080\")\n   --help, -h     show help\n```\n\n### 5.compile用法\n\n```bash\nNAME:\n   closed-source-solution-compile - local compile client\n\nUSAGE:\n   closed-source-solution-compile [global options]\n\nGLOBAL OPTIONS:\n   --cgo                       specify whether to enable CGO; it is disabled by default.\n   --goos string               specify the target operating system; default is current operating system. (default: \"windows\")\n   --goarch string             specify the target architecture; default is current architecture. (default: \"amd64\")\n   --output string, -o string  specify the output file name; default is main.exe on Windows, main on other platforms.\n   --packages string           specify the path to the package to compile; default is current directory. (default: \".\")\n   --shell string              specify the shell to execute before compiling; default is empty.\n   --remote string             specify the remote server address\n   --help, -h                  show help\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdobyte%2Fclosed-source-solution","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdobyte%2Fclosed-source-solution","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdobyte%2Fclosed-source-solution/lists"}