From ff23fb7173dcf04cdb636608c52f221c1f72e4ab Mon Sep 17 00:00:00 2001 From: arm64v8a <48624112+arm64v8a@users.noreply.github.com> Date: Fri, 21 Apr 2023 10:03:21 +0900 Subject: [PATCH] update libs --- core_commit.txt | 1 - docs/Build_Core.md | 21 ++++++++++++--------- go/cmd/nekobox_core/go.mod | 16 ++++++++-------- go/cmd/nekobox_core/go.sum | 8 -------- go/cmd/nekobox_core/update-box.sh | 2 -- go/cmd/nekobox_core/update-extra.sh | 2 -- go/cmd/nekoray_core/go.mod | 2 +- libs/build_go.sh | 2 ++ libs/get_source.sh | 25 +++++++++++++++++++------ libs/get_source_env.sh | 9 +++++++++ 10 files changed, 51 insertions(+), 37 deletions(-) delete mode 100644 core_commit.txt delete mode 100644 go/cmd/nekobox_core/update-box.sh delete mode 100644 go/cmd/nekobox_core/update-extra.sh create mode 100644 libs/get_source_env.sh diff --git a/core_commit.txt b/core_commit.txt deleted file mode 100644 index 1fb361c..0000000 --- a/core_commit.txt +++ /dev/null @@ -1 +0,0 @@ -8134d3cc23aa6b8e2a056887addf22d7d22bd969 diff --git a/docs/Build_Core.md b/docs/Build_Core.md index 6b8f74d..30c3cb7 100644 --- a/docs/Build_Core.md +++ b/docs/Build_Core.md @@ -1,22 +1,25 @@ ## 构建 nekoray_core & nekobox_core -### 简易构建 +### 目录结构 -1. 把 `Matsuridayo/v2ray-core` 置于 `../` -2. 进入 `go/cmd/nekoray_core` 文件夹 `go build` 得到 `nekoray_core`。 -3. 进入 `go/cmd/nekobox_core` 文件夹 `go build` 得到 `nekobox_core`。 - -具体编译过程请参考 `libs/get_source.sh` `libs/build_go.sh` - -非官方构建无需编译 `updater` `launcher` +``` + | nekoray + | go/cmd/* + | v2ray_core + | sing-box-extra + | sing-box + | ...... +``` ### 常规构建 -1. 把 `Matsuridayo/v2ray-core` 置于 `../` +1. `bash libs/get_source.sh` (自动下载目录结构,自动 checkout commit) 2. `GOOS=windows GOARCH=amd64 bash libs/build_go.sh` 具体支持的 GOOS 和 GOARCH 请看 `libs/build_go.sh` +非官方构建无需编译 `updater` `launcher` + ### sing-box tags 具体使用的 tags 请看 `libs/build_go.sh` diff --git a/go/cmd/nekobox_core/go.mod b/go/cmd/nekobox_core/go.mod index 0d7ccc1..b6ac4e3 100644 --- a/go/cmd/nekobox_core/go.mod +++ b/go/cmd/nekobox_core/go.mod @@ -3,9 +3,10 @@ module nekobox_core go 1.19 require ( - github.com/matsuridayo/libneko v0.0.0-20230315005352-9d7e3f3a79d1 - github.com/matsuridayo/sing-box-extra v0.0.0-20230417014110-39b3adb5f93f - github.com/sagernet/sing-box v1.2.4 + github.com/matsuridayo/libneko v1.0.0 // replaced + github.com/matsuridayo/sing-box-extra v1.0.0 // replaced + github.com/sagernet/sing-box v1.0.0 // replaced + github.com/sagernet/sing-dns v1.0.0 // indirect; replaced grpc_server v1.0.0 ) @@ -55,7 +56,6 @@ require ( github.com/sagernet/quic-go v0.0.0-20230202071646-a8c8afb18b32 // indirect github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 // indirect github.com/sagernet/sing v0.2.3 // indirect - github.com/sagernet/sing-dns v0.1.5-0.20230415085626-111ecf799dfc // indirect github.com/sagernet/sing-shadowsocks v0.2.0 // indirect github.com/sagernet/sing-shadowtls v0.1.0 // indirect github.com/sagernet/sing-tun v0.1.4-0.20230326080954-8848c0e4cbab // indirect @@ -92,10 +92,10 @@ require ( replace grpc_server v1.0.0 => ../../grpc_server -// replace github.com/matsuridayo/sing-box-extra => ../../../../sing-box-extra +replace github.com/matsuridayo/libneko v1.0.0 => ../../../../libneko -// replace github.com/sagernet/sing-box => ../../../../sing-box +replace github.com/matsuridayo/sing-box-extra v1.0.0 => ../../../../sing-box-extra -// replace github.com/sagernet/sing-dns => ../../../../sing-dns +replace github.com/sagernet/sing-box v1.0.0 => ../../../../sing-box -replace github.com/sagernet/sing-dns => github.com/matsuridayo/sing-dns v0.0.0-20230410025504-c609bffff165 +replace github.com/sagernet/sing-dns v1.0.0 => ../../../../sing-dns diff --git a/go/cmd/nekobox_core/go.sum b/go/cmd/nekobox_core/go.sum index fd3e713..67aff1d 100644 --- a/go/cmd/nekobox_core/go.sum +++ b/go/cmd/nekobox_core/go.sum @@ -95,12 +95,6 @@ github.com/libdns/libdns v0.2.1 h1:Wu59T7wSHRgtA0cfxC+n1c/e+O3upJGWytknkmFEDis= github.com/libdns/libdns v0.2.1/go.mod h1:yQCXzk1lEZmmCPa857bnk4TsOiqYasqpyOEeSObbb40= github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= -github.com/matsuridayo/libneko v0.0.0-20230315005352-9d7e3f3a79d1 h1:+FflyEuq2hn++MENFuT1/qFHz0KITKK/F6ZHxs23mrg= -github.com/matsuridayo/libneko v0.0.0-20230315005352-9d7e3f3a79d1/go.mod h1:IRO07Queptz/rGFvEW+3Hmwpx7MCup6WiDs4p5jMt4g= -github.com/matsuridayo/sing-box-extra v0.0.0-20230417014110-39b3adb5f93f h1:x0UjjMoYh5WSDGhIuRkmZUhGoxXnK++wyvuPnURhz6Q= -github.com/matsuridayo/sing-box-extra v0.0.0-20230417014110-39b3adb5f93f/go.mod h1:NfCwDELPcVFo8rp0d/P7M2OPmegGCGcwF4GSpgZu8Rs= -github.com/matsuridayo/sing-dns v0.0.0-20230410025504-c609bffff165 h1:19PQEuBatWsTdQaoB60wdxQFHr3DOBhdTCpHzbkPDNw= -github.com/matsuridayo/sing-dns v0.0.0-20230410025504-c609bffff165/go.mod h1:69PNSHyEmXdjf6C+bXBOdr2GQnPeEyWjIzo/MV8gmz8= github.com/mholt/acmez v1.1.0 h1:IQ9CGHKOHokorxnffsqDvmmE30mDenO1lptYZ1AYkHY= github.com/mholt/acmez v1.1.0/go.mod h1:zwo5+fbLLTowAX8o8ETfQzbDtwGEXnPhkmGdKIP+bgs= github.com/miekg/dns v1.1.53 h1:ZBkuHr5dxHtB1caEOlZTLPo7D3L3TWckgUUs/RHfDxw= @@ -145,8 +139,6 @@ github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2 github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk= github.com/sagernet/sing v0.2.3 h1:V50MvZ4c3Iij2lYFWPlzL1PyipwSzjGeN9x+Ox89vpk= github.com/sagernet/sing v0.2.3/go.mod h1:Ta8nHnDLAwqySzKhGoKk4ZIB+vJ3GTKj7UPrWYvM+4w= -github.com/sagernet/sing-box v1.2.4 h1:41tDGjU4zCym459HYbpKRJpGmi8zi1FcKAvv6DfqWOQ= -github.com/sagernet/sing-box v1.2.4/go.mod h1:LDW5ZOuWURxSWz+auElryalxCBlGbA0zvsC8XSy8Sp0= github.com/sagernet/sing-shadowsocks v0.2.0 h1:ILDWL7pwWfkPLEbviE/MyCgfjaBmJY/JVVY+5jhSb58= github.com/sagernet/sing-shadowsocks v0.2.0/go.mod h1:ysYzszRLpNzJSorvlWRMuzU6Vchsp7sd52q+JNY4axw= github.com/sagernet/sing-shadowtls v0.1.0 h1:05MYce8aR5xfKIn+y7xRFsdKhKt44QZTSEQW+lG5IWQ= diff --git a/go/cmd/nekobox_core/update-box.sh b/go/cmd/nekobox_core/update-box.sh deleted file mode 100644 index b3fda1a..0000000 --- a/go/cmd/nekobox_core/update-box.sh +++ /dev/null @@ -1,2 +0,0 @@ -go get github.com/sagernet/sing-box@"$1" -go mod tidy diff --git a/go/cmd/nekobox_core/update-extra.sh b/go/cmd/nekobox_core/update-extra.sh deleted file mode 100644 index 52b93f8..0000000 --- a/go/cmd/nekobox_core/update-extra.sh +++ /dev/null @@ -1,2 +0,0 @@ -go get github.com/matsuridayo/sing-box-extra@"$1" -go mod tidy diff --git a/go/cmd/nekoray_core/go.mod b/go/cmd/nekoray_core/go.mod index 6fe865c..f4daaae 100644 --- a/go/cmd/nekoray_core/go.mod +++ b/go/cmd/nekoray_core/go.mod @@ -6,7 +6,7 @@ require ( github.com/Dreamacro/clash v1.9.0 github.com/jsimonetti/rtnetlink v1.2.2 github.com/matsuridayo/libneko v0.0.0-20230304130313-5ea96b79b3c3 - github.com/v2fly/v2ray-core/v5 v5.0.0 + github.com/v2fly/v2ray-core/v5 v5.0.0 // replaced grpc_server v1.0.0 kernel.org/pub/linux/libs/security/libcap/cap v1.2.65 ) diff --git a/libs/build_go.sh b/libs/build_go.sh index 0fb08c4..174346e 100755 --- a/libs/build_go.sh +++ b/libs/build_go.sh @@ -3,7 +3,9 @@ set -e source libs/deploy_common.sh [ "$GOOS" == "windows" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/windows64 || true +[ "$GOOS" == "windows" ] && [ "$GOARCH" == "arm64" ] && DEST=$DEPLOYMENT/windows-arm64 || true [ "$GOOS" == "linux" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/linux64 || true +[ "$GOOS" == "linux" ] && [ "$GOARCH" == "arm64" ] && DEST=$DEPLOYMENT/linux-arm64 || true [ "$GOOS" == "darwin" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/macos-amd64 || true [ "$GOOS" == "darwin" ] && [ "$GOARCH" == "arm64" ] && DEST=$DEPLOYMENT/macos-arm64 || true if [ -z $DEST ]; then diff --git a/libs/get_source.sh b/libs/get_source.sh index a8e7e46..1a4f12a 100755 --- a/libs/get_source.sh +++ b/libs/get_source.sh @@ -2,16 +2,29 @@ set -e source libs/deploy_common.sh - -#### get source #### -COMMIT_V=$(cat core_commit.txt) - +ENV_NEKORAY=1 +source libs/get_source_env.sh pushd .. -git clone --no-checkout https://github.com/MatsuriDayo/v2ray-core.git +#### +if [ ! -d "sing-box-extra" ]; then + git clone --no-checkout https://github.com/MatsuriDayo/sing-box-extra.git +fi +pushd sing-box-extra +git checkout "$COMMIT_SING_BOX_EXTRA" +ENV_SING_BOX_EXTRA=1 +source $SRC_ROOT/libs/get_source_env.sh +NO_ENV=1 ./libs/get_source.sh + +popd + +#### +if [ ! -d "v2ray-core" ]; then + git clone --no-checkout https://github.com/MatsuriDayo/v2ray-core.git +fi pushd v2ray-core -git checkout $COMMIT_V +git checkout "$COMMIT_MATSURI_V2RAY" popd popd diff --git a/libs/get_source_env.sh b/libs/get_source_env.sh new file mode 100644 index 0000000..9d547e4 --- /dev/null +++ b/libs/get_source_env.sh @@ -0,0 +1,9 @@ +if [ ! -z $ENV_NEKORAY ]; then + export COMMIT_SING_BOX_EXTRA="a4eacbd0e54b6ec0a42096c42b6137a5be91a0bc" + export COMMIT_MATSURI_V2RAY="8134d3cc23aa6b8e2a056887addf22d7d22bd969" +fi + +if [ ! -z $ENV_SING_BOX_EXTRA ]; then + source libs/get_source_env.sh + # export COMMIT_SING_BOX="" +fi