Snapshot uncommitted work: proxy UI, sing-box integration, socks bridge
- Lab app: proxy panel, node editor, configuration and detail pages, responsive layout, and related tests - Add meshport-socks crate and sing-box bridge scripts/docs - Add singbox_flutter binding and meshport_client_core package - FFI, VPN helper (unified mac path), and Android/macOS runner updates - Docs for architecture, client runtime, UI design, and validation - UI design output artifacts under outputs/ui Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 5.5
parent
10b10e5bdf
commit
2f185f914d
@@ -17,8 +17,10 @@ else
|
||||
scripts/cargo-local.sh build -p meshport-ffi --target aarch64-linux-android --features system-vpn --locked
|
||||
profile=debug
|
||||
fi
|
||||
sh scripts/build-singbox-library.sh android
|
||||
mkdir -p apps/meshport_lab/android/app/src/main/jniLibs/arm64-v8a
|
||||
cp "target/aarch64-linux-android/$profile/libmeshport_ffi.so" apps/meshport_lab/android/app/src/main/jniLibs/arm64-v8a/
|
||||
cp target/singbox/android-arm64/libmeshport_proxy.so apps/meshport_lab/android/app/src/main/jniLibs/arm64-v8a/
|
||||
build_number=$(date +%s)
|
||||
cd apps/meshport_lab
|
||||
flutter build apk "$mode" --target-platform android-arm64 --build-number="$build_number"
|
||||
|
||||
@@ -3,15 +3,18 @@ set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
sh scripts/prepare-lab-default.sh
|
||||
scripts/cargo-local.sh build -p meshport-ffi -p meshport-vpn-helper --locked
|
||||
sh scripts/build-singbox-library.sh macos
|
||||
root="$PWD"
|
||||
cd apps/meshport_lab
|
||||
build_number=$(TZ=Asia/Tokyo date +%Y%m%d%H%M%S)
|
||||
flutter build macos --debug --build-number="$build_number"
|
||||
app="$PWD/build/macos/Build/Products/Debug/MeshPort.app"
|
||||
cp "$root/target/debug/libmeshport_ffi.dylib" "$app/Contents/Frameworks/"
|
||||
cp "$root/target/debug/libmeshport_proxy.dylib" "$app/Contents/Frameworks/"
|
||||
cp "$root/target/debug/meshport-vpn-helper" "$app/Contents/MacOS/"
|
||||
codesign --force --sign - "$app/Contents/MacOS/meshport-vpn-helper"
|
||||
codesign --force --sign - "$app/Contents/Frameworks/libmeshport_ffi.dylib"
|
||||
codesign --force --sign - "$app/Contents/Frameworks/libmeshport_proxy.dylib"
|
||||
codesign --force --deep --sign - --entitlements macos/Runner/DebugProfile.entitlements "$app"
|
||||
touch "$app"
|
||||
printf '%s\n' "$app"
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
platform="${1:-macos}"
|
||||
case "$platform" in
|
||||
macos)
|
||||
mkdir -p target/debug
|
||||
sh scripts/go-local.sh build -mod=readonly -trimpath -buildmode=c-shared -o "$PWD/target/debug/libmeshport_proxy.dylib" ./cmd/meshport-singbox-ffi
|
||||
;;
|
||||
android)
|
||||
sdk="${ANDROID_SDK_ROOT:-$HOME/Library/Android/sdk}"
|
||||
ndk="$sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/bin"
|
||||
mkdir -p target/singbox/android-arm64
|
||||
export GOOS=android GOARCH=arm64 CGO_ENABLED=1
|
||||
export CC="$ndk/aarch64-linux-android26-clang"
|
||||
export CGO_LDFLAGS='-Wl,-z,max-page-size=16384'
|
||||
sh scripts/go-local.sh build -mod=readonly -trimpath -buildmode=c-shared -o "$PWD/target/singbox/android-arm64/libmeshport_proxy.so" ./cmd/meshport-singbox-ffi
|
||||
;;
|
||||
*) printf '%s\n' 'usage: build-singbox-library.sh [macos|android]' >&2; exit 2 ;;
|
||||
esac
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
root="$PWD"
|
||||
mkdir -p target/debug
|
||||
sh scripts/go-local.sh build -mod=readonly -trimpath -o "$root/target/debug/meshport-singbox" ./cmd/meshport-singbox
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
export GOPATH="$PWD/work/toolchain/go"
|
||||
export GOMODCACHE="$GOPATH/pkg/mod"
|
||||
export GOCACHE="$PWD/work/cache/go-build"
|
||||
export GOTOOLCHAIN=auto
|
||||
export GOFLAGS="${GOFLAGS:--tags=with_utls}"
|
||||
task_root="$PWD"
|
||||
cd engines/singbox
|
||||
go mod download github.com/sagernet/sing-box@v1.14.3
|
||||
cd "$task_root"
|
||||
python3 scripts/prepare-singbox-patch.py
|
||||
export GOFLAGS="$GOFLAGS -modfile=$PWD/work/singbox-patched.go.mod"
|
||||
cd engines/singbox
|
||||
exec go "$@"
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Prepare a pinned, private module copy; never change the download cache."""
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
root = Path(__file__).resolve().parent.parent
|
||||
upstream = root / 'work/toolchain/go/pkg/mod/github.com/sagernet/sing-box@v1.14.3'
|
||||
source = upstream / 'route/rule/rule_set_remote.go'
|
||||
mod = (root / 'engines/singbox/go.mod').read_text()
|
||||
if 'github.com/sagernet/sing-box v1.14.3' not in mod:
|
||||
raise SystemExit('Review the sing-box patch before changing the upstream version')
|
||||
# Hash below is filled from the unmodified, checksum-verified pinned module.
|
||||
EXPECTED = 'f7c0e48dfb47f1198fc7c243c3d0319872b5429f0948532d08e9e46bdc583825'
|
||||
if not source.exists() or hashlib.sha256(source.read_bytes()).hexdigest() != EXPECTED:
|
||||
raise SystemExit('Unexpected upstream rule-set source; refusing to apply patch')
|
||||
folder = root / 'work/singbox-patched'
|
||||
if not folder.exists():
|
||||
temporary = Path(tempfile.mkdtemp(prefix='singbox-source-', dir=root / 'work'))
|
||||
try:
|
||||
shutil.copytree(upstream, temporary / 'module', copy_function=shutil.copyfile)
|
||||
# Go's cache directories are read-only; the owned copy must be writable.
|
||||
for directory, _, _ in os.walk(temporary / 'module'):
|
||||
os.chmod(directory, 0o755)
|
||||
try:
|
||||
os.rename(temporary / 'module', folder)
|
||||
except FileExistsError:
|
||||
pass
|
||||
finally:
|
||||
shutil.rmtree(temporary)
|
||||
patch = (root / 'engines/singbox/patches/rule_set_remote.go.txt').read_bytes()
|
||||
target = folder / 'route/rule/rule_set_remote.go'
|
||||
if target.read_bytes() != patch:
|
||||
fd, temporary = tempfile.mkstemp(prefix='remote-rule-', dir=target.parent)
|
||||
with os.fdopen(fd, 'wb') as stream:
|
||||
stream.write(patch)
|
||||
os.replace(temporary, target)
|
||||
altmod = root / 'work/singbox-patched.go.mod'
|
||||
value = mod + '\nreplace github.com/sagernet/sing-box => ' + json.dumps(str(folder)) + '\n'
|
||||
if not altmod.exists() or altmod.read_text() != value:
|
||||
altmod.write_text(value)
|
||||
checksum = (root / 'engines/singbox/go.sum').read_bytes()
|
||||
altsum = altmod.with_suffix('.sum')
|
||||
if not altsum.exists() or altsum.read_bytes() != checksum:
|
||||
fd, temporary = tempfile.mkstemp(prefix='singbox-checksum-', dir=root / 'work')
|
||||
with os.fdopen(fd, 'wb') as stream:
|
||||
stream.write(checksum)
|
||||
os.replace(temporary, altsum)
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
scripts/cargo-local.sh build -p meshport-ffi --locked
|
||||
sh scripts/build-singbox-library.sh macos
|
||||
export MESHPORT_LIBRARY="$PWD/target/debug/libmeshport_ffi.dylib"
|
||||
export MESHPORT_PROXY_LIBRARY="$PWD/target/debug/libmeshport_proxy.dylib"
|
||||
cd apps/meshport_lab
|
||||
flutter test test/proxy_profile_test.dart test/proxy_session_test.dart test/widget_test.dart test/proxy_node_editor_test.dart test/configuration_pages_test.dart test/advanced_profile_test.dart test/advanced_pages_test.dart
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
sh scripts/build-singbox.sh
|
||||
export MESHPORT_SINGBOX_BIN="$PWD/target/debug/meshport-singbox"
|
||||
scripts/cargo-local.sh test -p meshport-socks --locked --test bridge singbox_to_meshport_tcp_udp_and_withdrawal -- --ignored
|
||||
Reference in New Issue
Block a user