{"id":20986631,"url":"https://github.com/dpwgc/fraise","last_synced_at":"2025-10-11T00:13:27.908Z","repository":{"id":144485548,"uuid":"497060841","full_name":"dpwgc/fraise","owner":"dpwgc","description":"一个简单的 HTTP/HTTPS 负载均衡器（加权轮询 \u0026 加权随机）","archived":false,"fork":false,"pushed_at":"2022-05-28T08:27:29.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-20T07:33:34.255Z","etag":null,"topics":["cluster","http","https","load-balancer","server"],"latest_commit_sha":null,"homepage":"https://gitee.com/dpwgc/fraise","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/dpwgc.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}},"created_at":"2022-05-27T16:12:50.000Z","updated_at":"2022-05-28T08:30:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"1a221f31-f55c-4456-b307-cffcb9d13ee2","html_url":"https://github.com/dpwgc/fraise","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Ffraise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Ffraise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Ffraise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpwgc%2Ffraise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dpwgc","download_url":"https://codeload.github.com/dpwgc/fraise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243393415,"owners_count":20283791,"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":["cluster","http","https","load-balancer","server"],"created_at":"2024-11-19T06:14:24.461Z","updated_at":"2025-10-11T00:13:22.880Z","avatar_url":"https://github.com/dpwgc.png","language":"Go","readme":"# Fraise \n## 一个简单的 HTTP/HTTPS 负载均衡器（加权轮询 \u0026 加权随机）\n\n***\n\n### 使用方法\n* 填写配置文件 `application.yaml`\n* 填写本地服务节点列表文件 `nodeList.json`\n* 启动项目\n\n***\n\n### 实现功能\n#### 负载均衡转发\n* 将发送至该负载均衡器的HTTP/HTTPS请求按照指定策略，转发给本地服务节点列表 `nodeList.json` 文件中的一个节点。\n* 例：负载均衡器服务地址及端口为 `127.0.0.1:443` ，前端访问 `https://127.0.0.1:443/login` ，该访问请求将被转发到 `http://127.0.0.1:8X/login`。\n* `nodeList.json` 文件说明\n```json\n[\n\t{\n\t\t\"url\": \"http://127.0.0.1:80\",\n\t\t\"weight\": 1\n\t},\n\t{\n\t\t\"url\": \"http://127.0.0.1:81\",\n\t\t\"weight\": 2\n\t},\n\t{\n\t\t\"url\": \"http://127.0.0.1:82\",\n\t\t\"weight\": 3\n\t}\n]\n```\n* url: 节点服务访问路径\n* weight：节点权重（权重越大，分配给该节点的请求就越多）\n\n#### 动态更新负载均衡器的本地节点列表\n* 通过控制台接口更新，见下文\n\n\n***\n\n### 控制台接口\n\n#### 更新负载均衡器的本地服务节点列表\n\n##### 接口URL（接口URL可在配置文件 `application.yaml` 中更改）\n\u003e https://127.0.0.1/console/api/set\n\n##### 请求方式\n\u003e POST\n\n##### Content-Type\n\u003e form-data\n\n##### 请求Body参数\n| 参数名      | 示例值                                                                                                                                      | 参数类型 | 是否必填 | 参数描述              |\n|----------|------------------------------------------------------------------------------------------------------------------------------------------|------|------|-------------------|\n| nodeList | [{\"url\": \"http://127.0.0.1:80\",\"weight\": 1},\t{\"url\": \"http://127.0.0.1:81\",\t\"weight\": 2\t},\t{\"url\": \"http://127.0.0.1:82\",\t\"weight\": 3\t}] | Text | 是    | 服务节点列表（JSON格式字符串） |\n\n#### 获取负载均衡器的本地服务节点列表\n\n##### 接口URL（接口URL可在配置文件 `application.yaml` 中更改）\n\u003e https://127.0.0.1/console/api/get\n\n##### 请求方式\n\u003e POST\n\n##### Content-Type\n\u003e form-data\n\n***\n\n### 打包方式\n* 终端运行 `go build`\n* 打包成Linux可执行文件 \n```\n//终端运行\nset GOARCH=amd64\nset GOOS=linux\ngo build main.go\n```\n\n***\n\n### 部署方式\n\n* 部署文件夹\n  * fraise 或 fraise.exe `打包好的执行文件`\n  * application.yaml `配置文件`\n  * nodeList.json `服务节点列表文件`\n  * xxx.key `SSL证书文件（nginx），开启https时使用`\n  * xxx.pem `SSL证书文件（nginx），开启https时使用`\n\nLinux后台运行项目：cd到部署文件夹，输入 `setsid ./fraise`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpwgc%2Ffraise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdpwgc%2Ffraise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpwgc%2Ffraise/lists"}