Projects STRLCPY SeaMoon Commits 4064452a
🤬
  • ■ ■ ■ ■ ■ ■
    .github/conf/.goreleaser.yml
    1 1  before:
    2 2   hooks:
    3 3   - go mod tidy
    4  - -
    5 4  builds:
    6 5   - binary: seamoon
    7 6   env:
    8 7   - CGO_ENABLED=0
    9 8   main: ./cmd/main.go
    10  - goos:
    11  - - linux
    12  - - windows
    13  - - darwin
     9 + ignore:
     10 + # modernc.org/[email protected] not implement if these platform
     11 + - goos: darwin
     12 + goarch: 386
     13 + - goos: windows
     14 + goarch: 386
    14 15   goarm:
    15 16   - 6
    16 17   - 7
    17 18   ldflags:
    18  - - -s -w -X github.com/DVKunion/SeaMoon/system/xlog.Version={{.Version}} -X github.com/DVKunion/SeaMoon/system/xlog.Commit={{.Sha}}
     19 + - -s -w -X github.com/DVKunion/SeaMoon/system/xlog.Version={{.Version}} -X github.com/DVKunion/SeaMoon/system/xlog.Commit={{.ShortCommit}}
    19 20  checksum:
    20 21   name_template: 'checksums.txt'
    21 22  snapshot:
    22 23   name_template: "{{ .Tag }}-next"
    23 24  upx:
    24 25   - enabled: true
    25  - goos: [linux, darwin]
     26 + goos: [ linux, darwin ]
     27 + goarch: [ amd64, arm64 ]
    26 28   compress: best
    27 29  changelog:
    28 30   sort: asc
    skipped 4 lines
  • ■ ■ ■ ■ ■
    .github/workflows/build.yml
    1  -name: SeaMoon
    2  - 
     1 +name: seamoon-build
    3 2  on:
    4  - push:
    5  - tags:
    6  - - "*"
    7  - pull_request:
    8  - branches: [ "main" ]
     3 + workflow_call:
     4 + secrets:
     5 + DOCKERHUB_USERNAME:
     6 + required: true
     7 + DOCKERHUB_TOKEN:
     8 + required: true
    9 9   
    10 10  jobs:
    11 11   build:
    skipped 18 lines
    30 30   - uses: actions/upload-artifact@v4
    31 31   with:
    32 32   path: seamoon
     33 + build-docker:
     34 + name: build-docker
     35 + runs-on: ubuntu-20.04
     36 + if: startsWith(github.ref, 'refs/tags/')
     37 + steps:
     38 + - uses: actions/checkout@v4
     39 + - uses: docker/setup-qemu-action@v3
     40 + - uses: docker/setup-buildx-action@v3
     41 + - uses: docker/login-action@v3
     42 + name: login docker.io
     43 + with:
     44 + registry: "docker.io"
     45 + username: ${{ secrets.DOCKERHUB_USERNAME }}
     46 + password: ${{ secrets.DOCKERHUB_TOKEN }}
     47 + - name: Set up Node.js
     48 + uses: actions/setup-node@v4
     49 + with:
     50 + node-version: '20'
     51 + - name: Build Front
     52 + run: |
     53 + cd web && npm install | true && npm run build && cp -r dist ../cmd/client/static
     54 + - uses: docker/build-push-action@v5
     55 + with:
     56 + push: true
     57 + platforms: |
     58 + linux/amd64
     59 + linux/arm64
     60 + linux/386
     61 + tags: |
     62 + docker.io/dvkunion/seamoon:latest
     63 + docker.io/dvkunion/seamoon:${{github.ref_name}}
     64 + build-args: |
     65 + VERSION=${{github.ref_name}}
     66 + context: ./
  • ■ ■ ■ ■ ■ ■
    .github/workflows/package.yaml
    1  -name: Package
    2  -on:
    3  - push:
    4  - tags:
    5  - - "*"
    6  - 
    7  -jobs:
    8  - package-docker:
    9  - name: package-docker
    10  - runs-on: ubuntu-20.04
    11  - if: startsWith(github.ref, 'refs/tags/')
    12  - strategy:
    13  - matrix:
    14  - include:
    15  - - registry: docker.io
    16  - repo: dvkunion/seamoon
    17  - username: ${{ secrets.DOCKERHUB_USERNAME }}
    18  - password: ${{ secrets.DOCKERHUB_TOKEN }}
    19  - - registry: [
    20  - registry.cn-hangzhou.aliyuncs.com,
    21  - registry.cn-shanghai.aliyuncs.com,
    22  - registry.cn-qingdao.aliyuncs.com,
    23  - registry.cn-beijing.aliyuncs.com,
    24  - registry.cn-zhangjiakou.aliyuncs.com,
    25  - registry.cn-huhehaote.aliyuncs.com,
    26  - registry.cn-shenzhen.aliyuncs.com,
    27  - registry.cn-chengdu.aliyuncs.com,
    28  - registry.cn-hongkong.aliyuncs.com,
    29  - registry.ap-northeast-1.aliyuncs.com,
    30  - registry.ap-southeast-1.aliyuncs.com,
    31  - registry.ap-southeast-2.aliyuncs.com/seammon/seamoon",
    32  - registry.ap-southeast-3.aliyuncs.com,
    33  - registry.ap-southeast-5.aliyuncs.com,
    34  - registry.ap-south-1.aliyuncs.com,
    35  - registry.eu-central-1.aliyuncs.com,
    36  - registry.eu-west-1.aliyuncs.com,
    37  - registry.us-west-1.aliyuncs.com,
    38  - registry.us-east-1.aliyuncs.com,
    39  - ]
    40  - repo: seamoon/seamoon
    41  - username: ${{ secrets.ALIYUN_USERNAME }}
    42  - password: ${{ secrets.ALIYUN_PASSWORD }}
    43  - - registry: [
    44  - hkccr.ccs.tencentyun.com,
    45  - inccr.ccs.tencentyun.com,
    46  - sgccr.ccs.tencentyun.com,
    47  - thccr.ccs.tencentyun.com,
    48  - krccr.ccs.tencentyun.com,
    49  - jpccr.ccs.tencentyun.com,
    50  - deccr.ccs.tencentyun.com,
    51  - useccr.ccs.tencentyun.com,
    52  - uswccr.ccs.tencentyun.com,
    53  - ]
    54  - repo: seamoon/seamoon
    55  - username: ${{ secrets.TENCENT_USERNAME }}
    56  - password: ${{ secrets.TENCENT_PASSWORD }}
    57  - - registry: [
    58  - ccr.ccs.tencentyun.com,
    59  - ]
    60  - repo: dvkunion/seamoon
    61  - username: ${{ secrets.TENCENT_USERNAME }}
    62  - password: ${{ secrets.TENCENT_PASSWORD }}
    63  - steps:
    64  - - uses: actions/checkout@v4
    65  - - uses: docker/setup-qemu-action@v3
    66  - - uses: docker/setup-buildx-action@v3
    67  - - uses: docker/login-action@v3
    68  - name: login ${{ matrix.registry }}
    69  - with:
    70  - registry: ${{ matrix.registry }}
    71  - username: ${{ matrix.username }}
    72  - password: ${{ matrix.password }}
    73  - - uses: docker/build-push-action@v5
    74  - with:
    75  - push: true
    76  - platforms: |
    77  - linux/amd64
    78  - linux/arm64
    79  - linux/386
    80  - tags: |
    81  - ${{ matrix.registry }}/${{ matrix.repo }}:latest
    82  - ${{ matrix.registry }}/${{ matrix.repo }}:${{github.ref_name}}
    83  - build-args: |
    84  - VERSION=${{github.ref_name}}
    85  - context: ./
  • ■ ■ ■ ■ ■ ■
    .github/workflows/pages.yml
    1 1  # Simple workflow for deploying static content to GitHub Pages
    2  -name: Deploy
     2 +name: seamoon-package
     3 +on:
     4 + workflow_call:
    3 5   
    4  -on:
    5  - push:
    6  - branches: [ "main", "feat/docs" ]
    7 6  jobs:
    8 7   # Single deploy job since we're just deploying
    9 8   deploy:
    skipped 1 lines
    11 10   name: github-pages
    12 11   url: ${{ steps.deployment.outputs.page_url }}
    13 12   runs-on: ubuntu-latest
    14  - strategy:
    15  - matrix:
    16  - node-version: [ 18.x ]
    17 13   steps:
    18 14   - name: Checkout
    19 15   uses: actions/checkout@v4
    20  - - name: Use Node.js ${{ matrix.node-version }}
     16 + - name: Setup Node.js
    21 17   uses: actions/setup-node@v4
    22 18   with:
    23  - node-version: ${{ matrix.node-version }}
     19 + node-version: 18.x
    24 20   - name: Build
    25 21   # 安装 Node 之后就可以执行构建脚本
    26 22   run: |
    skipped 14 lines
  • ■ ■ ■ ■ ■ ■
    .github/workflows/release.yml
    1  -name: goreleaser
    2  - 
     1 +name: seamoon-goreleaser
    3 2  on:
    4  - push:
    5  - tags:
    6  - - "*"
    7  - 
     3 + workflow_call:
     4 + secrets:
     5 + GO_RELEASER_GITHUB_TOKEN:
     6 + required: true
    8 7  jobs:
    9 8   build:
    10 9   name: GoReleaser build
    skipped 3 lines
    14 13   uses: actions/checkout@v4
    15 14   with:
    16 15   fetch-depth: 0
     16 + - name: Set up Node.js
     17 + uses: actions/setup-node@v4
     18 + with:
     19 + node-version: '20'
     20 + - name: Build Front
     21 + run: |
     22 + cd web && npm install | true && npm run build && cp -r dist ../cmd/client/static
    17 23   - name: Set up Go
    18 24   uses: actions/setup-go@v5
    19 25   with:
    skipped 4 lines
    24 30   with:
    25 31   distribution: goreleaser
    26 32   version: latest
    27  - args: -f .github/conf/.goreleaser.yml
     33 + args: -f .github/conf/.goreleaser.yml --timeout 1h
    28 34   workdir: .
    29 35   env:
    30 36   GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
  • ■ ■ ■ ■ ■ ■
    .github/workflows/seamoon.yml
     1 +name: seamoon
     2 +on: [ push, pull_request ]
     3 +jobs:
     4 + build:
     5 + uses: ./.github/workflows/build.yml
     6 + secrets:
     7 + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
     8 + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
     9 + docs:
     10 + if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feat/docs' }}
     11 + uses: ./.github/workflows/pages.yml
     12 + release:
     13 + if: startsWith(github.ref, 'refs/tags/')
     14 + uses: ./.github/workflows/release.yml
     15 + secrets:
     16 + GO_RELEASER_GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
     17 + sync:
     18 + needs: [ build ]
     19 + if: startsWith(github.ref, 'refs/tags/')
     20 + uses: ./.github/workflows/sync.yml
     21 + secrets:
     22 + ALIYUN_USERNAME: ${{ secrets.ALIYUN_USERNAME }}
     23 + ALIYUN_PASSWORD: ${{ secrets.ALIYUN_PASSWORD }}
     24 + TENCENT_USERNAME: ${{ secrets.TENCENT_USERNAME }}
     25 + TENCENT_PASSWORD: ${{ secrets.TENCENT_PASSWORD }}
     26 + 
     27 + 
  • ■ ■ ■ ■ ■ ■
    .github/workflows/sync.yml
     1 +name: seamoon-package
     2 +on:
     3 + workflow_call:
     4 + secrets:
     5 + ALIYUN_USERNAME:
     6 + required: true
     7 + ALIYUN_PASSWORD:
     8 + required: true
     9 + TENCENT_USERNAME:
     10 + required: true
     11 + TENCENT_PASSWORD:
     12 + required: true
     13 + 
     14 +jobs:
     15 + sync-aliyun:
     16 + name: sync-aliyun
     17 + runs-on: ubuntu-20.04
     18 + if: startsWith(github.ref, 'refs/tags/')
     19 + strategy:
     20 + fail-fast: false
     21 + matrix:
     22 + registry: [ registry.cn-hangzhou.aliyuncs.com,
     23 + registry.cn-shanghai.aliyuncs.com,
     24 + registry.cn-qingdao.aliyuncs.com,
     25 + registry.cn-beijing.aliyuncs.com,
     26 + registry.cn-zhangjiakou.aliyuncs.com,
     27 + registry.cn-huhehaote.aliyuncs.com,
     28 + registry.cn-shenzhen.aliyuncs.com,
     29 + registry.cn-chengdu.aliyuncs.com,
     30 + registry.cn-hongkong.aliyuncs.com,
     31 + registry.ap-northeast-1.aliyuncs.com,
     32 + registry.ap-southeast-1.aliyuncs.com,
     33 + registry.ap-southeast-2.aliyuncs.com,
     34 + registry.ap-southeast-3.aliyuncs.com,
     35 + registry.ap-southeast-5.aliyuncs.com,
     36 + registry.ap-south-1.aliyuncs.com,
     37 + registry.eu-central-1.aliyuncs.com,
     38 + registry.eu-west-1.aliyuncs.com,
     39 + registry.us-west-1.aliyuncs.com,
     40 + registry.us-east-1.aliyuncs.com
     41 + ]
     42 + repo: [seamoon]
     43 + steps:
     44 + - uses: actions/checkout@v4
     45 + - name: skopeo-copy
     46 + run: |
     47 + skopeo sync --src docker --dest docker --dest-creds ${{ secrets.ALIYUN_USERNAME }}:${{ secrets.ALIYUN_PASSWORD }} docker.io/dvkunion/seamoon:${{github.ref_name}} ${{ matrix.registry }}/${{ matrix.repo }}
     48 + skopeo sync --src docker --dest docker --dest-creds ${{ secrets.ALIYUN_USERNAME }}:${{ secrets.ALIYUN_PASSWORD }} docker.io/dvkunion/seamoon:latest ${{ matrix.registry }}/${{ matrix.repo }}
     49 + 
     50 + package-tencent:
     51 + name: package-tecent
     52 + runs-on: ubuntu-20.04
     53 + if: startsWith(github.ref, 'refs/tags/')
     54 + strategy:
     55 + fail-fast: false
     56 + matrix:
     57 + registry: [ hkccr.ccs.tencentyun.com,
     58 + inccr.ccs.tencentyun.com,
     59 + sgccr.ccs.tencentyun.com,
     60 + thccr.ccs.tencentyun.com,
     61 + krccr.ccs.tencentyun.com,
     62 + jpccr.ccs.tencentyun.com,
     63 + deccr.ccs.tencentyun.com,
     64 + useccr.ccs.tencentyun.com,
     65 + uswccr.ccs.tencentyun.com
     66 + ]
     67 + repo: [seamoon]
     68 + include:
     69 + - registry: ccr.ccs.tencentyun.com
     70 + repo: [dvkunion]
     71 + steps:
     72 + - uses: actions/checkout@v4
     73 + - name: skopeo-copy
     74 + run: |
     75 + skopeo sync --src docker --dest docker --dest-creds ${{ secrets.TENCENT_USERNAME }}:${{ secrets.TENCENT_PASSWORD }} docker.io/dvkunion/seamoon:${{github.ref_name}} ${{ matrix.registry }}/${{ matrix.repo }}
     76 + skopeo sync --src docker --dest docker --dest-creds ${{ secrets.TENCENT_USERNAME }}:${{ secrets.TENCENT_PASSWORD }} docker.io/dvkunion/seamoon:latest ${{ matrix.registry }}/${{ matrix.repo }}
     77 + 
  • ■ ■ ■ ■ ■ ■
    Dockerfile
    1  -# build stage
    2  -FROM node:20 as front
    3  -COPY .. /src
    4  -WORKDIR /src/web
    5  -RUN npm run build
    6  - 
    7 1  FROM golang:alpine AS build
    8 2  ARG VERSION
    9 3  ARG SHA
    skipped 2 lines
    12 6  ENV CGO_ENABLED 0
    13 7  ENV VERSION=${VERSION}
    14 8  ENV SHA=${SHA}
    15  -COPY --from=front /src/web/dist /src/cmd/client/static
    16  -#COPY ./seamoon /tmp/seamoon
    17 9  RUN go build -v -ldflags "-X github.com/DVKunion/SeaMoon/system/xlog.Version=${VERSION} -X github.com/DVKunion/SeaMoon/system/xlog.Commit=${SHA}" -o /tmp/seamoon cmd/main.go
    18 10  RUN chmod +x /tmp/seamoon
    19 11  RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \
    skipped 13 lines
  • ■ ■ ■ ■
    web/src/pages/function/index.tsx
    skipped 42 lines
    43 43   rowKey={"ID"}
    44 44   showActions="hover"
    45 45   rowSelection={{}}
    46  - grid={{gutter: 16, xs: 1, sm: 2, md: 2, lg: 2, xl: 3}}
     46 + grid={{gutter: 16, xs: 1, sm: 2, md: 2, lg: 2, xl: 3, xxl: 3}}
    47 47   onItem={(record: Serverless.Tunnel) => {
    48 48   return {
    49 49   onClick: () => {
    skipped 126 lines
  • ■ ■ ■ ■ ■ ■
    web/src/pages/service/index.tsx
    skipped 91 lines
    92 92   rowKey={"ID"}
    93 93   showActions="hover"
    94 94   rowSelection={{}}
    95  - grid={{gutter: 16, xs: 1, sm: 2, md: 2, lg: 2, xl: 3}}
     95 + grid={{gutter: 16, xs: 1, sm: 2, md: 2, lg: 2, xl: 3, xxl: 3}}
    96 96   onItem={(record: any) => {
    97 97   return {
    98 98   onClick: () => {
    skipped 35 lines
    134 134   content: {
    135 135   render: (_, record) => {
    136 136   const oRecord = oData.get(record.id);
    137  - return <ProCard gutter={8} style={{margin: "-6% 0 -4% -3%"}} >
     137 + return <ProCard gutter={8} style={{margin: "-6% 0 -4% -3%"}}>
    138 138   <ProCard colSpan={12} split={"horizontal"} style={{marginLeft: "-3%"}}>
    139 139   <Statistic title="当前连接:" value={record.conn}
    140 140   trend={calcThread(record.conn, oRecord === undefined ? 0 : oRecord.conn)}/>
    skipped 9 lines
    150 150   <ProCard colSpan={12} split={"horizontal"}>
    151 151   <Statistic title="当前延迟:" value={record.lag + " ms"}
    152 152   trend={calcThread(record.lag, oRecord === undefined ? 0 : oRecord.lag)}/>
    153  - <Statistic title="下行速率:" value={record.speed_down === 0 ? "未测速" : record.speed_down.toFixed(2) + " Mbps"}
     153 + <Statistic title="下行速率:"
     154 + value={record.speed_down === 0 ? "未测速" : record.speed_down.toFixed(2) + " Mbps"}
    154 155   trend={record.speed_down === 0 ? undefined : calcThread(record.speed_down, oRecord === undefined ? 0 : oRecord.speed_down)}/>
    155 156   <Statistic title="总计流出:" valueRender={() => {
    156 157   return SpeedTransfer({
    skipped 78 lines
Please wait...
Page is in error, reload to recover