diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..bacee595 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,7 @@ +如果你遇到的问题不是 Sonic 的 bug,比如你不清楚要如何配置,请使用[Discussion](https://github.com/go-sonic/discussion/issues)进行讨论。 + +此 Issue 会被立即关闭。 + +If you are not sure if your question is truely a bug in Sonic, please discuss it [here](https://github.com/go-sonic/discussion/issues) first. + +This issue will be closed immediately. diff --git a/.github/ISSUE_TEMPLATE/bug_cn.md b/.github/ISSUE_TEMPLATE/bug_cn.md new file mode 100644 index 00000000..24486850 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_cn.md @@ -0,0 +1,87 @@ +--- +name: V2Ray 程序问题 +about: "提交一个 V2Ray 的程序问题报告。" +--- + + + +## 你正在使用哪个版本的 V2Ray? + + + + +## 你的使用场景是什么? + + + + +## 你看到的异常现象是什么? + + + + +## 你期待看到的正常表现是怎样的? + + + +## 请附上你的配置 + + + +**服务端配置:** + +```javascript +// 在这里附上服务器端配置文件 + +``` + +**客户端配置:** + +```javascript +// 在这里附上客户端配置 + +``` + +## 请附上出错时软件输出的错误日志 + + + +**服务器端错误日志:** + +```javascript +// 在这里附上服务器端日志 + +``` + +**客户端错误日志:** + +```javascript +// 在这里附上客户端日志 + +``` + +## 请附上访问日志 + + + +```javascript +// 在这里附上服务器端日志 + +``` + +## 其它相关的配置文件(如 Nginx)和相关日志 + + + +## 如果 V2Ray 无法启动,请附上 `--test` 命令的输出 + + + +## 如果 V2Ray 服务运行异常,请附上 journal 日志 + + + + diff --git a/.github/ISSUE_TEMPLATE/bug_en.md b/.github/ISSUE_TEMPLATE/bug_en.md new file mode 100644 index 00000000..a734fe65 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_en.md @@ -0,0 +1,90 @@ +--- +name: Bug report +about: "Create a bug report to help us improve" +--- + + + +## What version of V2Ray are you using? + + + + +## What's your scenario of using V2Ray? + + + + +## What problems have you encountered? + + + + +## What's your expectation? + + + +## Please attach your configuration here + + + +**Server configuration:** + +```javascript +// Please attach your server configuration here. + +``` + +**Client configuration:** + +```javascript +// Please attach your client configuration here. + +``` + +## Please attach error logs here + + + +**Server error log:** + +```javascript +// Please attach your server error log here. + +``` + +**Client error log:** + +```javascript +// Please attach your client error log here. + +``` + +## Please attach access log here + + + +```javascript +// Please attach your server access log here. + +``` + +## Other configurations (such as Nginx) and logs here + + + +## If V2Ray cannot start up, please attach output from `--test` command + + + +## If V2Ray service is abnormal, please attach journal log here + + + + diff --git a/.github/ISSUE_TEMPLATE/other_en.md b/.github/ISSUE_TEMPLATE/other_en.md new file mode 100644 index 00000000..8b6b04f3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/other_en.md @@ -0,0 +1,12 @@ +--- +name: Other +about: "其它问题请使用 https://github.com/v2fly/v2ray-core/discussions 进行讨论 / Please discuss other issues at https://github.com/v2fly/v2ray-core/discussions" +--- + +如果你遇到的问题不是 V2Ray 的 bug,比如你不清楚要如何配置,请使用[Discussion](https://github.com/v2fly/v2ray-core/discussions)进行讨论。 + +此 Issue 会被立即关闭。 + +If you are not sure if your question is truely a bug in V2Ray, please discuss it [here](https://github.com/v2fly/v2ray-core/discussions) first. + +This issue will be closed immediately. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..d85c6373 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" + open-pull-requests-limit: 10 + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/linters/.golangci.yml b/.github/linters/.golangci.yml new file mode 100644 index 00000000..4b5cd908 --- /dev/null +++ b/.github/linters/.golangci.yml @@ -0,0 +1,54 @@ +run: + timeout: 5m + skip-files: + - .gen.go + - .pb.go + +issues: + new: true + exclude-rules: + - linters: + - staticcheck + text: "SA1019:" + - linters: + - stylecheck + text: "ST1016:" + +linters: + enable: + - asciicheck + - bodyclose + - depguard + - gocritic + - gofmt + - gofumpt + - goimports + - goprintffuncname + - gosimple + - govet + - ineffassign + - misspell + - nakedret + - revive + - rowserrcheck + - staticcheck + - structcheck + - stylecheck + - typecheck + - unconvert + - unparam + - varcheck + - whitespace + disable: + - deadcode + - errcheck + - unused + +linters-settings: + goimports: + local-prefixes: github.com/go-sonic/sonic + revive: + rules: + - name: blank-imports + severity: warning + disabled: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..f564cc0e --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,47 @@ +name: CodeQL + +on: + push: + branches: [master] + pull_request: + branches: [master] + types: [opened, synchronize, reopened] + paths-ignore: + - '**/*.md' + - '**/*.txt' + +jobs: + analyze: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + language: ["go"] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 00000000..73b50af6 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,35 @@ +name: Linter + +on: + push: + branches: + - master + - v* + paths: + - "**/*.go" + - ".github/workflows/linter.yml" + pull_request: + types: [opened, synchronize, reopened] + paths: + - "**/*.go" + - ".github/workflows/linter.yml" + +jobs: + lint: + if: github.repository == 'go-sonic/sonic' + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v3 + with: + go-version: ^1.19 + + - name: Checkout codebase + uses: actions/checkout@v3 + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + args: --config=.github/linters/.golangci.yml + only-new-issues: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..49e3e237 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,133 @@ +name: Release + +on: + release: + types: [prereleased] + push: + branches: + - master + - v* + paths: + - "**/*.go" + - "go.mod" + - "go.sum" + - ".github/workflows/*.yml" + pull_request: + types: [opened, synchronize, reopened] + paths: + - "**/*.go" + - "go.mod" + - "go.sum" + - ".github/workflows/*.yml" + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + # Include amd64 on all platforms. + goos: [windows, linux, darwin] + goarch: [amd64, 386] + exclude: + - goarch: 386 + goos: darwin + include: + # BEGIN Linux ARM 5 6 7 + - goos: linux + goarch: arm-7 + - goos: linux + goarch: arm-6 + - goos: linux + goarch: arm-5 + # END Linux ARM 5 6 7 + # BEGIN Other architectures + - goos: darwin + goarch: arm64 + - goos: linux + goarch: arm64 + # BEGIN MIPS + - goos: linux + goarch: mips64 + - goos: linux + goarch: mips64le + - goos: linux + goarch: mipsle + - goos: linux + goarch: mips + # END MIPS + fail-fast: false + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Show workflow information + run: | + echo "GOOS: $GOOS, GOARCH: $GOARCH" + + - name: Build + uses: crazy-max/ghaction-xgo@v2 + with: + xgo_version: latest + go_version: 1.19 + dest: build + prefix: sonic + targets: ${{matrix.goos}}/${{matrix.goarch}} + v: true + x: false + race: false + ldflags: -s -w + buildmode: default + trimpath: true + + - name: Rename executable file + run: | + cd ./build || exit 1 + mv sonic-$GOOS-$GOARCH* sonic + + - name: Rename Windows ecutable file + if: matrix.goos == 'windows' + run: | + cd ./build || exit 1 + mv sonic sonic.exe + + - name: Prepare package + run: | + cp -rv ./conf ./build + cp -rv ./resources ./build + + + - name: Prepare package for Linux + if: matrix.goos == 'linux' + run: cp -rv ./release/systemd ./build/ + + - name: Create ZIP archive + run: | + pushd build || exit 1 + zip -9vr ../sonic-$GOOS-$GOARCH.zip . + popd || exit 1 + FILE=./sonic-$GOOS-$GOARCH.zip + DGST=$FILE.dgst + openssl dgst -md5 $FILE | sed 's/([^)]*)//g' >>$DGST + openssl dgst -sha1 $FILE | sed 's/([^)]*)//g' >>$DGST + openssl dgst -sha256 $FILE | sed 's/([^)]*)//g' >>$DGST + openssl dgst -sha512 $FILE | sed 's/([^)]*)//g' >>$DGST + + - name: Upload ZIP file to Artifacts + uses: actions/upload-artifact@v3 + with: + name: sonic-${{matrix.goos}}-${{matrix.goarch}}.zip + path: sonic-${{matrix.goos}}-${{matrix.goarch}}.zip + + - name: Upload files to GitHub release + uses: svenstaro/upload-release-action@v2 + if: github.event_name == 'release' + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file_glob: true + file: ./sonic-${{matrix.goos}}-${{matrix.goarch}}.zip* + tag: ${{ github.ref }} diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml new file mode 100644 index 00000000..3c1c5cad --- /dev/null +++ b/.github/workflows/semgrep.yml @@ -0,0 +1,20 @@ +name: Semgrep +on: [pull_request] +jobs: + semgrep: + name: Scan + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: returntocorp/semgrep-action@v1 + env: # Optional environment variable for inline PR comments (beta) + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + config: | + p/golang + p/r2c-ci + p/r2c-security-audit + p/insecure-transport + p/secrets + publishToken: ${{ secrets.SEMGREP_APP_TOKEN }} + publishDeployment: 241 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..6e0315d2 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,17 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: "30 1 * * *" + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v6 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: "This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days" + stale-pr-message: 'It has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days' + days-before-stale: 120 + days-before-close: 5 diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..69afbc3c --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/.idea +/logs +.DS_Store +/upload +/.vscode +sonic.db +__debug_bin \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..608e46b9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "resources/template/theme/default-theme-anatole"] + path = resources/template/theme/default-theme-anatole + url = git@github.com:go-sonic/default-theme-anatole.git diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..f737be53 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 1379Monitor + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..7c9dd1ff --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +
+ +
+ +Sonic [ˈsɒnɪk] ,Sonic is a Go Blogging Platform. Simple and Powerful.
+ +
+
+
+
+
+
+
+Website
+Telegram Channel
+
+ +
+ +Sonic [ˈsɒnɪk] ,Sonic 是一个用Golang开发的博客平台,高效快速.
+ +
+
+
+
+
+
+
+Telegram 频道
+