diff --git a/.github/workflows/sing-box.yml b/.github/workflows/sing-box.yml new file mode 100644 index 00000000..3eb65af4 --- /dev/null +++ b/.github/workflows/sing-box.yml @@ -0,0 +1,143 @@ +name: Build sing-box + +on: + workflow_dispatch: + + release: + types: + - 'prereleased' + - 'published' + - 'released' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + config: + - { + name: "windows-386", + GOARCH: 386, + GOOS: windows, + release: true + } + - { + name: "windows-amd64", + GOARCH: amd64, + GOOS: windows, + release: true + } + - { + name: "linux-amd64", + GOARCH: amd64, + GOOS: linux, + release: true + } + - { + name: "linux-arm64", + GOARCH: arm64, + GOOS: linux, + release: true + } + - { + name: "freebsd-amd64", + GOARCH: amd64, + GOOS: freebsd, + release: true + } + - { + name: "freebsd-arm", + GOARCH: arm, + GOOS: linux, + release: true + } + - { + name: "darwin-arm64", + GOARCH: arm64, + GOOS: darwin, + release: true + } + - { + name: "darwin-amd64", + GOARCH: amd64, + GOOS: darwin, + release: true + } + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install go + uses: actions/setup-go@v3 + with: + go-version: '1.19.2' + check-latest: true + + - name: Build sing-box + run: | + mkdir release-tmp + export GOARCH=${{ matrix.config.GOARCH }} + export GOOS=${{ matrix.config.GOOS }} + ~/go install -v -tags \ + --with_quic,\ + --with_grpc,\ + --with_wireguard,\ + --with_shadowsocksr,\ + --with_ech,with_utls,\ + --with_acme,\ + --with_clash_api,\ + --with_gvisor,\ + --with_embedded_tor,\ + --with_lwip \ + --with github.com/sagernet/sing-box/cmd/sing-box@v1.1-beta10 \ + --output ./release-tmp/sing-box + + - name: Rename for Windows + if: matrix.config.GOOS == 'windows' + run: | + mv ./release-tmp/sing-box ./release-tmp/sing-box.exe + + - name: Calculate Hash + run: | + cd ./release-tmp || exit 1 + sha256sum * > sha256 + + - name: Generate zip for Windows + if: matrix.config.GOOS == 'windows' + run: | + mkdir release-ready + cd ./release-tmp + zip -r ../release-ready/sing-box-${{ matrix.config.name }}.zip * + + - name: Generate tar for other platform + if: matrix.config.GOOS != 'windows' + run: | + mkdir release-ready + cd ./release-tmp + tar -zcvf ../release-ready/sing-box-${{ matrix.config.name }}.tar.gz * + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v3 + with: + name: caddy-${{ github.sha }}-${{ matrix.config.name }} + path: ./release-ready/* + + - name: Upload to GitHub Release for Windows + uses: svenstaro/upload-release-action@v2 + if: github.event_name == 'release' && matrix.config.release && matrix.config.GOOS == 'windows' + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./release-ready/sing-box-${{ matrix.config.name }}.zip + tag: ${{ github.ref }} + overwrite: true + + - name: Upload to GitHub Release for other platform + uses: svenstaro/upload-release-action@v2 + if: github.event_name == 'release' && matrix.config.release && matrix.config.GOOS != 'windows' + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./release-ready/caddy-${{ matrix.config.name }}.tar.gz + tag: ${{ github.ref }} + overwrite: true diff --git a/.github/工作流程/sing-box.yml b/.github/工作流程/sing-box.yml new file mode 100644 index 00000000..3eb65af4 --- /dev/null +++ b/.github/工作流程/sing-box.yml @@ -0,0 +1,143 @@ +name: Build sing-box + +on: + workflow_dispatch: + + release: + types: + - 'prereleased' + - 'published' + - 'released' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + config: + - { + name: "windows-386", + GOARCH: 386, + GOOS: windows, + release: true + } + - { + name: "windows-amd64", + GOARCH: amd64, + GOOS: windows, + release: true + } + - { + name: "linux-amd64", + GOARCH: amd64, + GOOS: linux, + release: true + } + - { + name: "linux-arm64", + GOARCH: arm64, + GOOS: linux, + release: true + } + - { + name: "freebsd-amd64", + GOARCH: amd64, + GOOS: freebsd, + release: true + } + - { + name: "freebsd-arm", + GOARCH: arm, + GOOS: linux, + release: true + } + - { + name: "darwin-arm64", + GOARCH: arm64, + GOOS: darwin, + release: true + } + - { + name: "darwin-amd64", + GOARCH: amd64, + GOOS: darwin, + release: true + } + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install go + uses: actions/setup-go@v3 + with: + go-version: '1.19.2' + check-latest: true + + - name: Build sing-box + run: | + mkdir release-tmp + export GOARCH=${{ matrix.config.GOARCH }} + export GOOS=${{ matrix.config.GOOS }} + ~/go install -v -tags \ + --with_quic,\ + --with_grpc,\ + --with_wireguard,\ + --with_shadowsocksr,\ + --with_ech,with_utls,\ + --with_acme,\ + --with_clash_api,\ + --with_gvisor,\ + --with_embedded_tor,\ + --with_lwip \ + --with github.com/sagernet/sing-box/cmd/sing-box@v1.1-beta10 \ + --output ./release-tmp/sing-box + + - name: Rename for Windows + if: matrix.config.GOOS == 'windows' + run: | + mv ./release-tmp/sing-box ./release-tmp/sing-box.exe + + - name: Calculate Hash + run: | + cd ./release-tmp || exit 1 + sha256sum * > sha256 + + - name: Generate zip for Windows + if: matrix.config.GOOS == 'windows' + run: | + mkdir release-ready + cd ./release-tmp + zip -r ../release-ready/sing-box-${{ matrix.config.name }}.zip * + + - name: Generate tar for other platform + if: matrix.config.GOOS != 'windows' + run: | + mkdir release-ready + cd ./release-tmp + tar -zcvf ../release-ready/sing-box-${{ matrix.config.name }}.tar.gz * + + - name: Upload a Build Artifact + uses: actions/upload-artifact@v3 + with: + name: caddy-${{ github.sha }}-${{ matrix.config.name }} + path: ./release-ready/* + + - name: Upload to GitHub Release for Windows + uses: svenstaro/upload-release-action@v2 + if: github.event_name == 'release' && matrix.config.release && matrix.config.GOOS == 'windows' + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./release-ready/sing-box-${{ matrix.config.name }}.zip + tag: ${{ github.ref }} + overwrite: true + + - name: Upload to GitHub Release for other platform + uses: svenstaro/upload-release-action@v2 + if: github.event_name == 'release' && matrix.config.release && matrix.config.GOOS != 'windows' + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./release-ready/caddy-${{ matrix.config.name }}.tar.gz + tag: ${{ github.ref }} + overwrite: true diff --git a/README.md b/README.md index 7d0bc2e7..ac832c9b 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,59 @@ -# sing-box +# sing-box 网络代理平台的“瑞士军刀” -The universal proxy platform. +### 官方网址:https://github.com/SagerNet/sing-box -## Documentation +通用代理平台 The universal proxy platform. + +## 官方文档 Documentation https://sing-box.sagernet.org +### Matsuri (茉莉) for Android +安卓端支持软件Matsuri +官方网址:https://github.com/MatsuriDayo/Matsuri +安卓端插件地址 +https://github.com/SagerNet/SagerNet + +### 基于 Qt/C++ 的跨平台 GUI 代理配置管理器 + +目前支持 Windows / Linux amd64 开箱即用 https://github.com/MatsuriDayo/nekoray + +### 一键安装、管理sing-box +网址:https://github.com/FranzKafkaYu/sing-box-yes + +### 安装 + +sing-box 需要 Golang 1.18.5 或更高版本 +#### 安装 Golang +``` +cd +curl -fsL https://raw.githubusercontent.com/jetsung/golang-install/main/install.sh | bash +source /root/.bashrc +``` +#### 安装最新的 sing-box 版本 +``` +go install -v github.com/sagernet/sing-box/cmd/sing-box@latest +```` +#### 自定义安装,具体方法看官方文档 https://sing-box.sagernet.org +``` +例: +go install -v -tags "with_acme with_clash_api with_quic with_grpc with_wireguard with_ech with_utls with_gvisor with_shadowsocksr" github.com/sagernet/sing-box/cmd/sing-box@dev-next +``` +### 设置 DNS +Disini akan menggantikan default dns dari WAN/Modem. + +add resolver updater 来自https://github.com/malikshi/sing_box +``` +wget -O /usr/local/bin/u-resolver https://raw.githubusercontent.com/malikshi/sing_box/main/u-resolver.sh && chmod +x /usr/local/bin/u-resolver && u-resolver +``` + +### 设置 sing-box +Download GEO Assets +``` +wget -c -P /etc/sing-box/ "https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db" +wget -c -P /etc/sing-box/ "https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db" +``` + ## License ``` @@ -23,4 +71,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . -``` \ No newline at end of file +``` +# 致谢 +SagerNet/sing-box +# 致谢所有github贡献者