diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 774416a..75b967b 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -17,6 +17,8 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: prepare-dockerfile + run: cp docker/client/Dockerfile ./Dockerfile - uses: docker/build-push-action@v3 with: push: true @@ -29,4 +31,31 @@ jobs: dvkunion/seamoon-client:${{github.ref_name}} build-args: | VERSION=${{github.ref_name}} + context: ./ + package-docker-server: + name: package-docker-server + runs-on: ubuntu-20.04 + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@v3 + - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-buildx-action@v2 + - uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: prepare-dockerfile + run: cp docker/server/Dockerfile ./Dockerfile + - uses: docker/build-push-action@v3 + with: + push: true + platforms: | + linux/amd64 + linux/arm64 + linux/386 + tags: | + dvkunion/seamoon-server:latest + dvkunion/seamoon-server:${{github.ref_name}} + build-args: | + VERSION=${{github.ref_name}} context: ./ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6d986a6..7037cc5 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,5 @@ dist/ .secret node_modules bootstrap -.s/ \ No newline at end of file +.s/ +.seamoom \ No newline at end of file diff --git a/README.md b/README.md index 5414f2f..f256981 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@

Sea Moon

- stars downloads @@ -18,11 +17,6 @@

月海之名取自于苏轼的《西江月·顷在黄州》,寓意月海取自于传统安全工具,用之于云,最终达到隐匿于海的效果。

-

-目前工具正处于开发中,版本迭代变动会比较大,可能会存在各种bug和问题,欢迎各位提交 Issue | Pr -

- -
## ☁️ 什么是月海 @@ -30,18 +24,24 @@ 月海(Sea Moon) 是一款使用 FaaS/BaaS 实现的的 Serverless 渗透工具,致力于开启云原生的渗透模式。 -说人话的总结,月海其实就是一款利用云函数来隐匿攻击行踪以及分布式处理扫描任务的集成工具, +说人话的总结,月海其实就是一款利用云函数来隐匿攻击行踪以及分布式处理扫描任务的集成工具。 + +基于 Serverless 的动态特性、分别从网络层、应用层实现对应的安全能力,并利用serverless-devs工具来实现快捷的部署/跨厂商操作。 + +真正的实现渗透上云,赋能安全云原生红利。 ## 🔥 使用展示 ![](https://cdn.dvkunion.cn/seamoon/bf0f8d2fc5084c329f9638d5c3f0bf46.png) ## 🕹 快速开始 -1. fork本仓库到自己的github -2. 将代码部署到云厂商,参考 https://seamoon.dvkunion.cn/guide/deploy/aliyun/ -3. 在release页面下载对应的最新版本client, 运行 `./client`, 可以看到控制端启动。 +[快速开始](https://seamoon.dvkunion.cn/guide/start) + +[🔥新增Sealos部署, 价格更低更实惠!](https://seamoon.dvkunion.cn/guide/deploy/sealos) + +## 💻 技术文档 -更多使用方式请查看: [使用手册](https://seamoon.dvkunion.cn) +[技术文档](https://seamoon.dvkunion.cn/tech/feature) ## ❗ 免责声明 @@ -49,7 +49,7 @@ 如您在使用本工具的过程中存在任何非法行为,您需自行承担相应后果,我们将不承担任何法律及连带责任。 -## ✨ 联系方式 +## ☎️ 联系方式 Serverless in Cybersecurity 讨论微信群: diff --git a/Dockerfile b/docker/client/Dockerfile similarity index 96% rename from Dockerfile rename to docker/client/Dockerfile index 98b993a..b2dbf01 100644 --- a/Dockerfile +++ b/docker/client/Dockerfile @@ -1,7 +1,7 @@ # build stage FROM golang:alpine AS build ARG VERSION -COPY . /src +COPY ../.. /src WORKDIR /src ENV CGO_ENABLED 0 ENV VERSION=${VERSION} diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile new file mode 100644 index 0000000..fdf330f --- /dev/null +++ b/docker/server/Dockerfile @@ -0,0 +1,16 @@ +# build stage +FROM golang:alpine AS build +ARG VERSION +COPY ../.. /src +WORKDIR /src +ENV CGO_ENABLED 0 +ENV VERSION=${VERSION} +RUN go build -ldflags "-X github.com/DVKunion/SeaMoon/pkg/consts.Version=${VERSION}" -o /tmp/server cmd/aliyun_server.go +RUN chmod +x /tmp/server +# run stage +FROM scratch +LABEL maintainer="dvkunion@gamil.com" +WORKDIR /app +COPY --from=build /tmp/server /app/server +EXPOSE 9000 +ENTRYPOINT ["/app/server"] \ No newline at end of file diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 272141a..7168c84 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -6,6 +6,7 @@ module.exports = { head: [ // 注入到页面 中的标签,格式[tagName, { attrName: attrValue }, innerHTML?] ['link', {rel: 'icon', href: '/img/favicon.ico'}], //favicons,资源放在public文件夹 ['meta', {name: 'keywords', content: 'serverless,proxy,pentest,seamoon'}], + ['meta', {name: 'baidu-site-verification', content: 'codeva-vXPumeNBPL'}], ['script', {}, ` var _hmt = _hmt || []; (function() { diff --git "a/docs/guide/00.\346\246\202\350\277\260/00.introduce.md" "b/docs/guide/00.\346\246\202\350\277\260/00.introduce.md" index 8c238b6..9395d10 100644 --- "a/docs/guide/00.\346\246\202\350\277\260/00.introduce.md" +++ "b/docs/guide/00.\346\246\202\350\277\260/00.introduce.md" @@ -1,6 +1,6 @@ --- title: 简介 -titleTag: 1.1.0 +titleTag: 1.1.2 date: 2022-09-28 22:39:36 permalink: /guide/introduce article: false @@ -36,13 +36,19 @@ article: false 目前网络层功能支持如下: -| 代理类型 | 技术文档 | 服务端支持 | 客户端支持 | -|---------|--------------------------------|:-----:|:-----:| -| HTTP(S) | [HTTP.md](/tech/net/http/) | ✅ | ✅ | -| Socks5 | [Socks5.md](/tech/net/socks5/) | ✅ | ✅ | -| SS/SSR | [SS.md](/tech/net/socks5/) | 🐷待开发 | 🐷待开发 | -| VMess | [VMESS.md](/tech/net/socks5/) | 🐷待开发 | 🐷待开发 | -| 链式代理 | | ❌暂无计划 | ❌暂无计划 | +**网络代理** + +| 代理类型 | 技术文档 | 服务端支持 | 客户端支持 | +|---------|-----------------------------------------------------------|:-----:|:-----:| +| HTTP(S) | [HTTP.md](https://seamoon.dvkunion.cn/tech/net/http/) | ✅ | ✅ | +| Socks5 | [Socks5.md](https://seamoon.dvkunion.cn/tech/net/socks5/) | ✅ | ✅ | +| SS/SSR | [SS.md]() | 🐷待开发 | 🐷待开发 | +| VMess | [VMESS.md]() | 🐷待开发 | 🐷待开发 | +| 链式代理 | | ❌暂无计划 | ❌暂无计划 | + +**端口转发** + +**NAT穿透** ### 应用层 @@ -53,12 +59,12 @@ article: false 目前应用层功能如下: -| 能力名称 | 原理文档 | 服务端支持 | 客户端支持 | -|--------------|------------------------------------|:-----:|:-----:| -| 动态WebShell隐匿 | [WebShell.md](/tech/app/webshell/) | 🐷待开发 | 🐷待开发 | -| 分布式扫描 | | 🐷待开发 | 🐷待开发 | -| 反弹Shell代理 | | 🐷待开发 | 🐷待开发 | -| CI容器云扫描利用 | | 🐷待开发 | 🐷待开发 | +| 能力名称 | 原理文档 | 服务端支持 | 客户端支持 | +|--------------|---------------------------------------------------------------|:-----:|:-----:| +| 动态WebShell隐匿 | [WebShell.md](https://seamoon.dvkunion.cn/tech/app/webshell/) | 🐷待开发 | 🐷待开发 | +| 分布式扫描 | | 🐷待开发 | 🐷待开发 | +| 反弹Shell代理 | | 🐷待开发 | 🐷待开发 | +| CI容器云扫描利用 | | 🐷待开发 | 🐷待开发 | ### 其他特性 @@ -97,7 +103,7 @@ article: false > 很多代理支持根据不同的规则来进行转发或选择不走代理。月海的定位其实更偏重于利用云原生基础设施来廉价的进行渗透测试工作。 > 因此在当前版本,并不打算支持规则代理,(因为很多代理客户端其实也有这个功能了,走客户端即可实现。) -更多发展方向的说明和讨论请移步: [技术文档]() +更多发展方向的说明和讨论请移步: [技术文档](https://seamoon.dvkunion.cn/tech/) ## 🕹 ️开始使用 diff --git "a/docs/guide/00.\346\246\202\350\277\260/01.structure.md" "b/docs/guide/00.\346\246\202\350\277\260/01.structure.md" index 8ef41e0..62df9c4 100644 --- "a/docs/guide/00.\346\246\202\350\277\260/01.structure.md" +++ "b/docs/guide/00.\346\246\202\350\277\260/01.structure.md" @@ -12,7 +12,4 @@ article: false + 部署在云端的服务端 + 客户端 - -## 服务端 - -服务端形式主要为云函数(FC)模式,主要用于实际运行各项 \ No newline at end of file +服务端负责实际的业务功能,客户端用于转化用户意图和编排FC调度。 \ No newline at end of file diff --git "a/docs/guide/01.\345\274\200\345\247\213\344\275\277\347\224\250/01.start.md" "b/docs/guide/01.\345\274\200\345\247\213\344\275\277\347\224\250/01.start.md" index c20d001..9f16104 100644 --- "a/docs/guide/01.\345\274\200\345\247\213\344\275\277\347\224\250/01.start.md" +++ "b/docs/guide/01.\345\274\200\345\247\213\344\275\277\347\224\250/01.start.md" @@ -5,7 +5,125 @@ permalink: /guide/start article: false --- -## z +## 🕹 快速开始 + +通过该页面,您可以通过推荐的部署方式快速开始使用 SeaMoon。 + +> 🔥 如果您的钱包和预算有限,并且代理IP需求并不是特别高,这里推荐使用[sealos部署服务端](https://seamoon.dvkunion.cn/guide/deploy/sealos) +> 本页面按照阿里云标准云函数服务进行部署,如果您希望获取到更多自定义的配置和使用方式,[请跳转](https://seamoon.dvkunion.cn/guide/deploy) + +### 事前准备 + ++ 云厂商账户(以阿里云为例),并开通对应的serverless服务(阿里云serverless服务名为:函数计算) ++ 云厂商账户AK/SK,并拥有操作FC的全部权限。 ++ 一台存在docker、Nodejs >= 12 的客户端的机器,同时保证 7777、1080、9999端口未被占用,该机器将作为使用的客户端。 + +### Step.1 安装serverless-devs工具 + +```shell +$ npm install @serverless-devs/s -g +``` + +国内加速: + +```shell +$ cnpm install @serverless-devs/s -g +``` + +如果不存在npm包管理器,请先通过node安装npm/cnpm + +安装后运行 + +```shell +$ s -v +``` + +将可以看到serverless-devs版本,表示安装成功。 + +然后通过如下命令开始配置云厂商认证 + +```shell +$ s config add +``` + +按提示即可选择即可,本次我们以 `Alibaba Cloud` 为例,输入对应的账户`AccessKeyID`、`AccessKeySecret` + +最后一步填写`alias`时,请确保值为`default`(一般初次安装与认证该字段都默认为default,回车即可)。 + +如果AK/SK无误,那么你将会看到认证成功的提示。 + +### Step.2 部署服务端 + +```shell +$ git clone https://github.com/DVKunion/SeaMoon.git +``` + +进入到项目目录 + +```shell +$ cd SeaMoon +$ s deploy +``` + +如果你不是第一次部署,那么将会提示你选择冲突的配置:remote/local,一般选择local即可。 + +稍等片刻,你将会得到部署好的两个地址: + +```shell +SeaMoon-FC-HTTP-Proxy: +..... + url: + system_url: https://http-proxy-seamoon-xxxxxxxxx.run + system_intranet_url: https://http-proxy-seamoon-xxxxxxxxx.fcapp.run + custom_domain: + - + domain: http://http-proxy.seamoon-service.xxxxxxxxx.fc.devsapp.net + triggers: + - + type: http + name: httpTrigger +... + url: + system_url: https://socks-proxy-seamoon-xxxxxxxxx.fcapp.run + system_intranet_url: https://socks-proxy-seamoon-xxxxxxxxx.fcapp.run + custom_domain: + - + domain: http://socks-proxy.seamoon-service.xxxxxxxxx.fc.devsapp.net + triggers: + - + type: http + name: httpTrigger +``` + +这里是用的都是默认配置,如果你需要更多高级可选项,请继续阅读:https://seamoon.dvkunion.cn/guide/deploy + +同样,如果你不想使用阿里云,或者想寻求更廉价的计费方式,请继续阅读:https://seamoon.dvkunion.cn/guide/deploy + +服务端部署完成 + +### Step.3 开启客户端使用 + +```shell +$ docker run -it -d --net=host dvkunion/seamoon-client +``` + +默认使用`--net=host`模式,然后浏览器打开: + +`localhost:7777` + +即可开启客户端, 点击配置管理 + +![](https://cdn.dvkunion.cn/seamoon/04f8a842b0c24c5e93c37c7c20f91d72.png) + +添加云端配置 + +![](https://cdn.dvkunion.cn/seamoon/dfcc22b01c4a4f358bdee59acc5c563b.png) + +> 注意,此处填写的值为 Step.2 中输出的 domain字段,并去除 http:// 协议头,属于对应域名即可。 > -在阅读客户端使用手册之前,请确保您已经阅读并部署好了[云端服务](https://github.com/DVKunion/SeaMoon/blob/main/docs/DEPLOY.md) +开启socks5代理,并保持默认`:1080`不改变。 + +此时,你已经可以通过云函数启动socks5代理访问了。 + +![speed.png](https://cdn.dvkunion.cn/SeaMoon/speed2.png) \ No newline at end of file diff --git "a/docs/guide/02.\345\277\253\351\200\237\351\203\250\347\275\262/00.deploy.md" "b/docs/guide/02.\345\277\253\351\200\237\351\203\250\347\275\262/00.deploy.md" deleted file mode 100644 index 9ec0b14..0000000 --- "a/docs/guide/02.\345\277\253\351\200\237\351\203\250\347\275\262/00.deploy.md" +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: 如何部署 -date: 2022-09-30 00:25:17 -permalink: /pages/b07687/ -article: false ---- diff --git "a/docs/guide/02.\345\277\253\351\200\237\351\203\250\347\275\262/02.serverless.md" "b/docs/guide/02.\345\277\253\351\200\237\351\203\250\347\275\262/02.serverless.md" deleted file mode 100644 index ed22031..0000000 --- "a/docs/guide/02.\345\277\253\351\200\237\351\203\250\347\275\262/02.serverless.md" +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Serverless-Devs -date: 2022-09-29 23:43:29 -permalink: /guide/deploy/serverlessDevs -article: false ---- - -## serverless devs - -http://www.serverless-devs.com - -通过serverless devs可实现快速部署到各个云平台 \ No newline at end of file diff --git "a/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/00.deploy.md" "b/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/00.deploy.md" new file mode 100644 index 0000000..61811d6 --- /dev/null +++ "b/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/00.deploy.md" @@ -0,0 +1,13 @@ +--- +title: 服务端部署 +date: 2023-07-18 00:27:13 +permalink: /guide/deploy +article: false +--- + +## 服务端部署 +SeaMoon 提供了多种多样的部署方式。 + ++ [阿里云手动部署](https://seamoon.dvkunion.cn/guide/deploy/aliyun/) ++ [🔥 sealos:更便宜更舒服的选择](https://seamoon.dvkunion.cn/guide/deploy/sealos/) ++ [serverless-devs快捷部署](https://seamoon.dvkunion.cn/guide/deploy/serverlessDevs/) diff --git "a/docs/guide/02.\345\277\253\351\200\237\351\203\250\347\275\262/01.aliyun.md" "b/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/01.aliyun.md" similarity index 90% rename from "docs/guide/02.\345\277\253\351\200\237\351\203\250\347\275\262/01.aliyun.md" rename to "docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/01.aliyun.md" index a4778e0..dfbf821 100644 --- "a/docs/guide/02.\345\277\253\351\200\237\351\203\250\347\275\262/01.aliyun.md" +++ "b/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/01.aliyun.md" @@ -8,7 +8,7 @@ article: false ## 阿里云 0. 阿里云首先要开通函数计算服务。 -1. fork 该仓库到您自己的 github 账户下 +1. fork 该仓库(https://github.com/DVKunion/SeaMoon.git)到您自己的 github 账户下 2. 进入阿里云控制台,点击应用 -> 创建应用 ![创建应用](https://cdn.dvkunion.cn/SeaMoon/deploy-aliyun-1.png) @@ -32,6 +32,6 @@ article: false > > 目前阿里云支持的字段有: cn-hangzhou, cn-beijing, cn-beijing, cn-hangzhou, cn-shanghai, cn-qingdao, cn-zhangjiakou, cn-huhehaote, cn-shenzhen, cn-chengdu, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, eu-west-1, us-west-1, us-east-1, ap-south-1 -5. [开启客户端](https://github.com/DVKunion/SeaMoon/blob/main/docs/START.md), 尽情享用 +5. [开启客户端](https://seamoon.dvkunion.cn/guide/client/), 尽情享用 ![speed.png](https://cdn.dvkunion.cn/SeaMoon/speed.png) \ No newline at end of file diff --git "a/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/02.sealos.md" "b/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/02.sealos.md" new file mode 100644 index 0000000..945b994 --- /dev/null +++ "b/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/02.sealos.md" @@ -0,0 +1,89 @@ +--- +title: 部署到Sealos +date: 2023-07-21 18:29 +permalink: /guide/deploy/sealos +article: false +--- + +## 部署到Sealos: 拥抱更便宜、更舒适、更优美可控的云服务平台 + +[Sealos公有云地址](https://cloud.sealos.io/) + +### 选择Sealos的原因 + +先说下我喜欢Sealos的原因: + +简单的页面,适合新手小白,无需了解过多的云服务相关知识 + +操作起来和操作一个os一样,点击、配置、部署,一气呵成。 +对比各大厂的balabala一堆限制,sealos的门槛更低,更适合小白上手。 + +![](https://cdn.dvkunion.cn/seamoon/df79a91e03a3499198e83e7b2f8c5495.png) + +简单易懂的计费方式:花费更低,效果不变 + +对比各大厂花里胡哨的各项计费指标(尤其是流量也要收费), +sealos的计费方式真正的做到按照计算量计费,费用透明,整体使用下来价格更低。 + +![](https://cdn.dvkunion.cn/seamoon/6d631335801f424cb522a949ed0fbfe6.png) + +配置更加灵活:不用了pause、用的时候start、想要多少的IP自行可控 + +sealos支持快速弹性扩容,当需求高时,可以调低扩容触发点,获取到更多IP +当不需要使用时,可以快速的pause停止;下次使用时又能快速的恢复。 + +![](https://cdn.dvkunion.cn/seamoon/4cfd4e22aa954bc7a19d22a4e9b21035.png) + +### 如何部署 + +sealos上部署seamoon服务将更加简单,只需要鼠标点击操作: + +#### STEP.1 + +注册并登陆[cloud.sealos.io](https://cloud.sealos.io/), 点击`App Launchpad` + +![](https://cdn.dvkunion.cn/seamoon/d17d6c38e3e2418db9a1545161ebdaca.png) + +#### STEP.2 + +点击右上角`create application`, 如下填写参数: + +![](https://cdn.dvkunion.cn/seamoon/d03c4da3524d4fbd9acdeae09496d81c.png) + +![](https://cdn.dvkunion.cn/seamoon/107d1b99193a4d67aa5a1e5d3c8b3339.png) + + +主要注意以下参数 +```shell +name: "函数名,填写SeaMoon即可" +image: "dvkunion/seamoon-server:latest", # 不要修改 +Instance: # 两种模式,fixed/Scaling; 如果固定需要几个实例,可以选择fixed; 如果想要动态扩散,可以选择Scaling,然后通过配置内存指标来控制 +# 当前截图配置的意思为,动态扩容,当内存使用超过10%时,自动创建新的副本(最大副本数为5) +Network: #此项不要动任何字段,完全按照截图填写 +Advance: 配置环境变量: serverMod=socks5 # 如果需要http代理,填写serverMod=http +``` + +#### STEP.3 + +填写完成后,点击右上角 `Deploy`, 等待部署完成,状态success后,获取到服务地址 + + +将此地址填入客户端即可(注意将https:// 换为 wss://) + +![](https://cdn.dvkunion.cn/seamoon/444615d4be064ca980e92e2d120beaf3.png) + +### 效果 + +[旺柴] 谷歌云的IP访问谷歌简直不能再丝滑 + +![](https://cdn.dvkunion.cn/seamoon/a7d0567cb29140fc8243a68894323aef.png) + +整体带宽在10-30左右,可能和我客户端出口带宽也有关系,应该是普通的带宽。(不过价格也在这里了要啥自行车,反正够用) + +![](https://cdn.dvkunion.cn/seamoon/9269f06bdce44056afa1c198af19e583.png) + +如果不需要多IP,实例副本数目固定为1即可;如果需要多IP,副本越多,获取到的IP就越多。(理性使用) + + + + diff --git "a/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/09.serverless.md" "b/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/09.serverless.md" new file mode 100644 index 0000000..3f3a60e --- /dev/null +++ "b/docs/guide/02.\346\234\215\345\212\241\351\203\250\347\275\262/09.serverless.md" @@ -0,0 +1,148 @@ +--- +title: Serverless-Devs +date: 2022-09-29 23:43:29 +permalink: /guide/deploy/serverlessDevs +article: false +--- + +## serverless-devs + +通过[serverless-devs](http://www.serverless-devs.com)可实现快速部署到各个云平台。 + + +### 安装 serverless-devs 工具 +```shell +$ npm install @serverless-devs/s -g +``` + +国内加速: + +```shell +$ cnpm install @serverless-devs/s -g +``` + +如果不存在npm包管理器,请先通过node安装npm/cnpm + +安装后运行 + +```shell +$ s -v +``` + +将可以看到serverless-devs版本,表示安装成功。 + +然后通过如下命令开始配置云厂商认证 + +```shell +$ s config add +``` + +按提示即可选择即可,本次我们以 `Alibaba Cloud` 为例,输入对应的账户`AccessKeyID`、`AccessKeySecret` + +最后一步填写`alias`时,请确保值为`default`(一般初次安装与认证该字段都默认为default,回车即可)。 + +如果AK/SK无误,那么你将会看到认证成功的提示。 + +### 部署 + +```shell +$ git clone https://github.com/DVKunion/SeaMoon.git +``` + +进入到项目目录 +```shell +$ cd SeaMoon +$ s deploy +``` + +如果你不是第一次部署,那么将会提示你选择冲突的配置:remote/local,一般选择local即可。 + +稍等片刻,你将会得到部署好的两个地址: +```shell +SeaMoon-FC-HTTP-Proxy: +..... + url: + system_url: https://http-proxy-seamoon-xxxxxxxxx.run + system_intranet_url: https://http-proxy-seamoon-xxxxxxxxx.fcapp.run + custom_domain: + - + domain: http://http-proxy.seamoon-service.xxxxxxxxx.fc.devsapp.net + triggers: + - + type: http + name: httpTrigger +... + url: + system_url: https://socks-proxy-seamoon-xxxxxxxxx.fcapp.run + system_intranet_url: https://socks-proxy-seamoon-xxxxxxxxx.fcapp.run + custom_domain: + - + domain: http://socks-proxy.seamoon-service.xxxxxxxxx.fc.devsapp.net + triggers: + - + type: http + name: httpTrigger +``` + +服务端部署完成。 + +### 高级选项 + +#### 地域 + +如果你想要修改部署的地域,请修改 `s.yaml` 中的 `region` 字段。 + +目前支持的 `region` : +``` +cn-hangzhou, +cn-beijing, +cn-shanghai, +cn-qingdao, +cn-zhangjiakou, +cn-huhehaote, +cn-shenzhen, +cn-chengdu, +cn-hongkong, +ap-southeast-1, +ap-southeast-2, +ap-southeast-3, +ap-southeast-5, +ap-northeast-1, +eu-central-1, +eu-west-1, +us-west-1, +us-east-1, +ap-south-1 +``` + +#### 花费 vs 更多的IP + +阿里云的FC计费模式与实例数、vCPU消耗息息相关。 + +由于我们的流量中转单例,cpu消耗并不会打满,而仍然会依照0.33计费。 + +因此,控制多个请求到一个实例,即可控制消费;对应的能够获取到的IP也会随之减少。 + +10线程、每个线程100个用例打满ip查询测试的结果为: + ++ 实例数目不设限、最高超时时间为600s、每个实例只处理一个请求: 70 IP ++ 实例数目不设限、最高超时时间为300s、每个实例处理10请求: 45IP (目前默认配置) + +如果你需要自行调整,可修改s.yaml中的: + +```yaml +services: + SeaMoon-FC-HTTP-Proxy: + component: fc + props: +...... + instanceConcurrency: 10 #一个实例最多请求处理数 +...... + timeout: 300 #超时时间,数值越大,可维持的不中断连接时间就会越长 +``` + +随着修改,改方案可能导致的花费也会随之不同。 + +#### 可能遇到的坑 + ++ 需要go > 1.18环境 (因为需要动态编译) \ No newline at end of file diff --git "a/docs/guide/03.\345\256\242\346\210\267\347\253\257/01.\345\256\242\346\210\267\347\253\257\344\270\213\350\275\275.md" "b/docs/guide/03.\345\256\242\346\210\267\347\253\257/01.\345\256\242\346\210\267\347\253\257\344\270\213\350\275\275.md" deleted file mode 100644 index 1222181..0000000 --- "a/docs/guide/03.\345\256\242\346\210\267\347\253\257/01.\345\256\242\346\210\267\347\253\257\344\270\213\350\275\275.md" +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: 客户端下载 -date: 2022-09-29 23:45:03 -permalink: /guide/client/download -article: false ---- - -## 客户端下载 - -在 [Github Release](https://github.com/DVKunion/SeaMoon/releases) 界面。在最新版本列表哪,选择您对应系统型号的client 包下载。 - -> 由于项目仍处于开发阶段,请尽量保证使用最新版本的客户端使用。 - -![release.png](https://cdn.dvkunion.cn/seamoon/b99b44ea50754bef959bfee42a07059b.png) - diff --git "a/docs/guide/03.\345\256\242\346\210\267\347\253\257\351\203\250\347\275\262/00.client.md" "b/docs/guide/03.\345\256\242\346\210\267\347\253\257\351\203\250\347\275\262/00.client.md" new file mode 100644 index 0000000..0d97f1c --- /dev/null +++ "b/docs/guide/03.\345\256\242\346\210\267\347\253\257\351\203\250\347\275\262/00.client.md" @@ -0,0 +1,13 @@ +--- +title: 客户端部署 +date: 2023-07-18 23:45:03 +permalink: /guide/client +article: false +--- + +## 客户端部署 + +SeaMoon 客户端同样支持多模式部署 + ++ [docker](https://seamoon.dvkunion.cn/guide/client/docker/) ++ [binary](https://seamoon.dvkunion.cn/guide/deploy/binary/) diff --git "a/docs/guide/03.\345\256\242\346\210\267\347\253\257\351\203\250\347\275\262/01.docker.md" "b/docs/guide/03.\345\256\242\346\210\267\347\253\257\351\203\250\347\275\262/01.docker.md" new file mode 100644 index 0000000..7f6e35d --- /dev/null +++ "b/docs/guide/03.\345\256\242\346\210\267\347\253\257\351\203\250\347\275\262/01.docker.md" @@ -0,0 +1,31 @@ +--- +title: docker +date: 2022-09-29 23:45:03 +permalink: /guide/client/docker +article: false +--- + +## Docker + +推荐使用 docker 一键部署client + +```shell +$ docker run -it -d --net=host dvkunion/seamoon-client +``` + +默认使用`--net=host`模式,然后浏览器打开: + +`localhost:7777` + +即可开启客户端, 点击配置管理 + +![](https://cdn.dvkunion.cn/seamoon/04f8a842b0c24c5e93c37c7c20f91d72.png) + +添加云端配置 + +![](https://cdn.dvkunion.cn/seamoon/dfcc22b01c4a4f358bdee59acc5c563b.png) + +> 注意,此处填写的值为 Step.2 中输出的 domain字段,并去除 http:// 协议头,属于对应域名即可。 +> + +开启socks5代理,并保持默认`:1080`不改变。 \ No newline at end of file diff --git "a/docs/guide/03.\345\256\242\346\210\267\347\253\257/02.\345\256\242\346\210\267\347\253\257\351\205\215\347\275\256.md" "b/docs/guide/03.\345\256\242\346\210\267\347\253\257\351\203\250\347\275\262/02.binary.md" similarity index 78% rename from "docs/guide/03.\345\256\242\346\210\267\347\253\257/02.\345\256\242\346\210\267\347\253\257\351\205\215\347\275\256.md" rename to "docs/guide/03.\345\256\242\346\210\267\347\253\257\351\203\250\347\275\262/02.binary.md" index b6cf3ed..0e52b64 100644 --- "a/docs/guide/03.\345\256\242\346\210\267\347\253\257/02.\345\256\242\346\210\267\347\253\257\351\205\215\347\275\256.md" +++ "b/docs/guide/03.\345\256\242\346\210\267\347\253\257\351\203\250\347\275\262/02.binary.md" @@ -1,19 +1,24 @@ --- -title: 客户端配置 +title: binary date: 2022-09-30 00:01:03 -permalink: /guide/client/setting +permalink: /guide/client/binary article: false --- -## 客户端配置 +## Binary -客户端界面如下: +## 客户端下载 + +在 [Github Release](https://github.com/DVKunion/SeaMoon/releases) 界面。在最新版本列表哪,选择您对应系统型号的client 包下载。 + +> 由于项目仍处于开发阶段,请尽量保证使用最新版本的客户端使用。 + +![release.png](https://cdn.dvkunion.cn/seamoon/b99b44ea50754bef959bfee42a07059b.png) -![](https://cdn.dvkunion.cn/seamoon/bf0f8d2fc5084c329f9638d5c3f0bf46.png) -## 客户端使用 - v1.1.0 版本 +### 客户端配置: v1.1.0-latest 版本 -> 1.1.0 使用B/S架构,无需任何参数,会占用本地7777端口开启一个控制端 +> 1.1.0 之后使用B/S架构,无需任何参数,会占用本地7777端口开启一个控制端 `./client` @@ -40,7 +45,7 @@ article: false ![](https://cdn.dvkunion.cn/seamoon/293fcd6a33cd4c298fd62888fa016321.png) -## 客户端使用 - v1.0.0 版本 +## 客户端配置: v1.0.0 版本 > 1.0.0 版本需要在client传入参数,已经在1.1.0版本废弃了 > 建议使用 1.1.0 版本 diff --git "a/docs/tech/00.\345\256\232\344\275\215\344\270\216\347\211\271\346\200\247/01.feature.md" "b/docs/tech/00.\345\256\232\344\275\215\344\270\216\347\211\271\346\200\247/01.feature.md" index 990cb56..adfc163 100644 --- "a/docs/tech/00.\345\256\232\344\275\215\344\270\216\347\211\271\346\200\247/01.feature.md" +++ "b/docs/tech/00.\345\256\232\344\275\215\344\270\216\347\211\271\346\200\247/01.feature.md" @@ -7,6 +7,14 @@ article: false # FEATURE +## SeaMoon 1.1.2 + +### ❤️ What's New +* 🔧 fix(websocket): 修正了protocol error detect 时仍挂起gorouting导致卡死的问题 (#6) +* 🔥 feat(dockerfile): 增加了docker client, 现在可以通过docker来启动客户端 (#6) + +[**Full Changelog**](https://github.com/DVKunion/SeaMoon/compare/1.1.1...1.1.2) + ## SeaMoon 1.1.1 ### ❤️ What's New diff --git a/package.json b/package.json index 4dfb226..38ac102 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SeaMoon", - "version": "1.0.1", + "version": "1.1.2", "main": "index.js", "license": "MIT", "repository": "https://github.com/DVKunion/SeaMoon", diff --git a/pkg/client/config.go b/pkg/client/config.go index aef88ca..7a99d0f 100644 --- a/pkg/client/config.go +++ b/pkg/client/config.go @@ -30,7 +30,7 @@ type proxyConfig struct { var ( singleton *clientConfig - configPath = ".config" + configPath = ".seamoom" ) func Config() *clientConfig { @@ -62,6 +62,7 @@ func (c *clientConfig) Save() error { if err := toml.NewEncoder(&buf).Encode(c); err != nil { return err } + fd, err := os.OpenFile(configPath, os.O_CREATE|os.O_WRONLY, 0644) if err != nil { return err diff --git a/pkg/client/http.go b/pkg/client/http.go index 774aa97..c7f2b59 100644 --- a/pkg/client/http.go +++ b/pkg/client/http.go @@ -3,15 +3,17 @@ package client import ( "context" "crypto/tls" - "github.com/DVKunion/SeaMoon/pkg/consts" - "github.com/DVKunion/SeaMoon/pkg/utils" - "github.com/google/martian/v3" - log "github.com/sirupsen/logrus" "net" "net/http" "net/url" "strings" "time" + + "github.com/google/martian/v3" + log "github.com/sirupsen/logrus" + + "github.com/DVKunion/SeaMoon/pkg/consts" + "github.com/DVKunion/SeaMoon/pkg/utils" ) func HttpController(ctx context.Context, sg *SigGroup) { @@ -27,7 +29,9 @@ func HttpController(ctx context.Context, sg *SigGroup) { } var proxyAddr string for _, p := range Config().ProxyAddr { - if strings.HasPrefix(p, "http-proxy") { + if strings.HasPrefix(p, "http://") || strings.HasPrefix(p, "https://") { + proxyAddr = p + } else if strings.HasPrefix(p, "http-proxy") { proxyAddr = "http://" + p } } diff --git a/pkg/client/socks.go b/pkg/client/socks.go index a74b390..c388d6d 100644 --- a/pkg/client/socks.go +++ b/pkg/client/socks.go @@ -39,12 +39,10 @@ func Socks5Controller(ctx context.Context, sg *SigGroup) { } var proxyAddr string for _, p := range Config().ProxyAddr { - if strings.HasPrefix(p, "socks-proxy") { - if consts.Version == "dev" { - proxyAddr = "ws://127.0.0.1:8888" - } else { - proxyAddr = "ws://" + p - } + if strings.HasPrefix(p, "ws://") || strings.HasPrefix(p, "wss://") { + proxyAddr = p + } else if strings.HasPrefix(p, "socks-proxy") { + proxyAddr = "ws://" + p } } if proxyAddr == "" { diff --git a/s.yaml b/s.yaml index 600e7fd..3cfd8d8 100644 --- a/s.yaml +++ b/s.yaml @@ -16,7 +16,7 @@ actions: pre-deploy: - run: go mod tidy path: ./ - - run: GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X github.com/DVKunion/SeaMoon/pkg/consts.Version=1.1.0" -o main cmd/aliyun_server.go + - run: GO111MODULE=on GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X github.com/DVKunion/SeaMoon/pkg/consts.Version=1.1.2" -o main cmd/aliyun_server.go path: ./ - run: chmod +x main path: ./ @@ -36,11 +36,13 @@ services: - ./main environmentVariables: { serverMod: "http" } handler: main - instanceConcurrency: 1 + instanceConcurrency: 10 instanceType: e1 - memorySize: 512 + cpu: 0.05 + diskSize: 512 + memorySize: 128 runtime: custom - timeout: 600 + timeout: 300 internetAccess: true triggers: - name: httpTrigger @@ -78,11 +80,13 @@ services: - ./main environmentVariables: { serverMod: "socks5" } handler: main - instanceConcurrency: 1 + instanceConcurrency: 10 instanceType: e1 - memorySize: 512 + cpu: 0.05 + diskSize: 512 + memorySize: 128 runtime: custom - timeout: 600 + timeout: 300 internetAccess: true triggers: - name: httpTrigger