Compare commits
92 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| da527b57af | |||
| 307f3c454a | |||
| b3057a72bb | |||
| 7a95af02b9 | |||
| 161d5dbcaf | |||
| 23b8260d87 | |||
| 9cce230f1f | |||
| 3185a0c66d | |||
| 759fdccc96 | |||
| 470c2eca39 | |||
| 52ac80a037 | |||
| 4f3bcf4e52 | |||
| 8b4ea9646d | |||
| a911f25a28 | |||
| 7b500dde68 | |||
| dc294c2eec | |||
| 425dd00208 | |||
| 5eaa8c2b49 | |||
| 6bbbba0343 | |||
| 2305f3d6d3 | |||
| e42e2dac79 | |||
| c876251950 | |||
| 04f3fadb62 | |||
| fd89f2a965 | |||
| 227e7e4ab9 | |||
| 7f6ca27e19 | |||
| 9f17517c20 | |||
| 8c1483da96 | |||
| a3c82260f2 | |||
| b94558069b | |||
| 849515fb0e | |||
| 4acdff0477 | |||
| 9d266f282c | |||
| 5e3a8f70f7 | |||
| cecdbd1b01 | |||
| 606b3aca90 | |||
| c418800664 | |||
| fe12e9ce33 | |||
| ebf60d4ce6 | |||
| 7773749c53 | |||
| 8eb287d32d | |||
| aa1dfe0e4b | |||
| d0b07f42de | |||
| b9fc411999 | |||
| 56c4caeaf3 | |||
| 012e71cc10 | |||
| 18f5c7093a | |||
| 103e7eb984 | |||
| d2131f1f9c | |||
| 6ba16654b1 | |||
| bc19fe5ef5 | |||
| 7ebe87e276 | |||
| 14d955951e | |||
| 621e34cc6a | |||
| 20b794122c | |||
| 1cad70e0b2 | |||
| c4c0cb3a7a | |||
| 0703c3aa07 | |||
| 999ee48e6b | |||
| 61d17ccbe2 | |||
| 882f74100e | |||
| 7e267072f3 | |||
| 1d0acc8f38 | |||
| df0aa6b9f9 | |||
| b8e2955ebe | |||
| dc0c6a0e09 | |||
| 5b044334ee | |||
| 3a96b19e0c | |||
| 31a8a2ba06 | |||
| c98b5df051 | |||
| a0e3b69ac5 | |||
| 5b8e815fe6 | |||
| a2523209b8 | |||
| f374e2ce3c | |||
| f2ef91036a | |||
| 4c70cd5f12 | |||
| 63ce949edc | |||
| 2080366d66 | |||
| 15e607dfc6 | |||
| 7ba0cec04f | |||
| 73a95e2c7a | |||
| 26c1cd4bcb | |||
| ec225e72bd | |||
| eca0f8a08f | |||
| 1b78c4b61c | |||
| 4fa894245c | |||
| 97f69f1a9c | |||
| 839a1627fd | |||
| 91b6620347 | |||
| e954bcc430 | |||
| 51a30184d7 | |||
| 267865c61d |
@@ -0,0 +1,10 @@
|
||||
# Git LFS 配置 - iOS 大文件
|
||||
# Libbox.xcframework 二进制文件
|
||||
*.xcframework/**/*.framework/Versions/A/Libbox filter=lfs diff=lfs merge=lfs -text
|
||||
*.xcframework/**/*.framework/Libbox filter=lfs diff=lfs merge=lfs -text
|
||||
# 其他大型二进制文件
|
||||
*.a filter=lfs diff=lfs merge=lfs -text
|
||||
*.dylib filter=lfs diff=lfs merge=lfs -text
|
||||
*.framework/Versions/A/* filter=lfs diff=lfs merge=lfs -text
|
||||
iOS-SwiftUI-Code/Libbox.xcframework/**/*.framework/Versions/A/Libbox filter=lfs diff=lfs merge=lfs -text
|
||||
iOS-SwiftUI-Code/Libbox.xcframework/**/*.framework/Libbox filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -0,0 +1,304 @@
|
||||
name: Build Debug
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
# ==================== Android Debug 构建 ====================
|
||||
build-android-debug:
|
||||
name: Build Android Debug APK
|
||||
runs-on: ubuntu
|
||||
env:
|
||||
RUNNER_TOOL_CACHE: /toolcache
|
||||
|
||||
steps:
|
||||
- name: Install Node.js
|
||||
run: |
|
||||
export PATH="/toolcache/bin:$PATH"
|
||||
if ! command -v node &> /dev/null; then
|
||||
if command -v apk &> /dev/null; then
|
||||
apk add --no-cache nodejs npm
|
||||
else
|
||||
curl -fsSL https://nodejs.org/dist/v20.0.0/node-v20.0.0-linux-x64.tar.xz | tar -xJ -C /tmp
|
||||
mkdir -p /toolcache
|
||||
cp -r /tmp/node-v20.0.0-linux-x64/{bin,lib,share} /toolcache/
|
||||
fi
|
||||
fi
|
||||
node --version
|
||||
|
||||
- name: Install Git LFS
|
||||
run: |
|
||||
if command -v apk &> /dev/null; then
|
||||
apk add --no-cache git-lfs
|
||||
elif command -v apt-get &> /dev/null; then
|
||||
apt-get update && apt-get install -y git-lfs
|
||||
else
|
||||
curl -sL https://github.com/git-lfs/git-lfs/releases/download/v3.5.1/git-lfs-linux-amd64-v3.5.1.tar.gz | tar xz -C /tmp
|
||||
mv /tmp/git-lfs-3.5.1/git-lfs /toolcache/bin/
|
||||
fi
|
||||
git lfs install
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Pull Git LFS files
|
||||
run: |
|
||||
git lfs install
|
||||
git lfs pull || echo "LFS pull failed, continuing without LFS files (Android build doesn't need them)"
|
||||
|
||||
- name: Install Java 17
|
||||
run: |
|
||||
if command -v apk &> /dev/null; then
|
||||
# Enable community repository for openjdk17-jdk
|
||||
sed -i 's/^#.*\/community\/.*$/\0/' /etc/apk/repositories || true
|
||||
echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories
|
||||
apk update
|
||||
apk add --no-cache openjdk17-jdk
|
||||
echo "JAVA_HOME=/usr/lib/jvm/java-17-openjdk" >> $GITHUB_ENV
|
||||
elif command -v apt-get &> /dev/null; then
|
||||
apt-get update && apt-get install -y openjdk-17-jdk
|
||||
echo "JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64" >> $GITHUB_ENV
|
||||
else
|
||||
curl -sL https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz | tar xz -C /toolcache
|
||||
echo "JAVA_HOME=/toolcache/jdk-17.0.9+9" >> $GITHUB_ENV
|
||||
echo "/toolcache/jdk-17.0.9+9/bin" >> $GITHUB_PATH
|
||||
fi
|
||||
java -version
|
||||
|
||||
- name: Install Go 1.23
|
||||
run: |
|
||||
# Create toolcache directory if not exists
|
||||
mkdir -p /toolcache
|
||||
# Install curl if not available (Alpine uses apk)
|
||||
if ! command -v curl &> /dev/null; then
|
||||
if command -v apk &> /dev/null; then
|
||||
apk add --no-cache curl
|
||||
fi
|
||||
fi
|
||||
# Download Go 1.23 directly to ensure correct version
|
||||
curl -sL https://go.dev/dl/go1.23.0.linux-amd64.tar.gz | tar xz -C /toolcache
|
||||
echo "/toolcache/go/bin" >> $GITHUB_PATH
|
||||
echo "GOROOT=/toolcache/go" >> $GITHUB_ENV
|
||||
/toolcache/go/bin/go version
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: |
|
||||
cd Android-kotlin-Code
|
||||
chmod +x gradlew
|
||||
|
||||
- name: Create local.properties
|
||||
run: |
|
||||
cd Android-kotlin-Code
|
||||
echo "sdk.dir=$ANDROID_HOME" > local.properties
|
||||
|
||||
- name: Build Android Debug APK
|
||||
run: |
|
||||
cd Android-kotlin-Code
|
||||
./gradlew app:assembleDebug --stacktrace
|
||||
|
||||
- name: List APK files
|
||||
run: |
|
||||
echo "Listing APK files..."
|
||||
find Android-kotlin-Code/app/build/outputs/apk -name "*.apk" -type f || echo "No APK files found"
|
||||
ls -la Android-kotlin-Code/app/build/outputs/apk/ || true
|
||||
|
||||
- name: Copy APK to artifacts
|
||||
run: |
|
||||
mkdir -p /tmp/artifacts
|
||||
find Android-kotlin-Code/app/build/outputs/apk -name "*.apk" -type f -exec cp {} /tmp/artifacts/ \;
|
||||
ls -la /tmp/artifacts/
|
||||
echo "APK files copied to /tmp/artifacts"
|
||||
|
||||
# ==================== iOS Debug 构建 ====================
|
||||
build-ios-debug:
|
||||
name: Build iOS Debug App
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Git LFS
|
||||
run: |
|
||||
git lfs install
|
||||
git lfs pull
|
||||
|
||||
- name: Verify Libbox framework before build
|
||||
run: |
|
||||
echo "========================================"
|
||||
echo "Checking Libbox.xcframework..."
|
||||
echo "========================================"
|
||||
cd iOS-SwiftUI-Code
|
||||
|
||||
if [ -d "Libbox.xcframework" ]; then
|
||||
echo "✅ Libbox.xcframework directory exists"
|
||||
ls -lh Libbox.xcframework/
|
||||
|
||||
# 检查模拟器版本
|
||||
if [ -d "Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A" ]; then
|
||||
echo "✅ Simulator framework structure exists"
|
||||
|
||||
# 检查二进制文件
|
||||
LIBBOX_BINARY="Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/Libbox"
|
||||
if [ -f "$LIBBOX_BINARY" ]; then
|
||||
echo "✅ Libbox binary file exists"
|
||||
|
||||
# 获取文件大小 (macOS 和 Linux 兼容)
|
||||
FILE_SIZE=$(stat -f%z "$LIBBOX_BINARY" 2>/dev/null || stat -c%s "$LIBBOX_BINARY" 2>/dev/null)
|
||||
echo "Binary file size: $FILE_SIZE bytes ($(( FILE_SIZE / 1024 / 1024 )) MB)"
|
||||
|
||||
# 检查文件是否是真实的二进制文件 (不是 Git placeholder)
|
||||
if [ "$FILE_SIZE" -lt 1000 ]; then
|
||||
echo "❌ ERROR: File size is too small! This is likely a Git placeholder"
|
||||
echo "File content (first 200 bytes):"
|
||||
head -c 200 "$LIBBOX_BINARY"
|
||||
echo ""
|
||||
echo "This means Git did not download the actual binary file."
|
||||
exit 1
|
||||
else
|
||||
echo "✅ File size is normal, binary appears to be downloaded correctly"
|
||||
echo "File type:"
|
||||
file "$LIBBOX_BINARY" || echo "Binary file exists"
|
||||
fi
|
||||
else
|
||||
echo "❌ ERROR: Libbox binary file NOT found at: $LIBBOX_BINARY"
|
||||
echo "Listing directory contents:"
|
||||
ls -la Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/ || true
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ ERROR: Simulator framework structure NOT found"
|
||||
echo "Listing Libbox.xcframework contents:"
|
||||
find Libbox.xcframework -type d -name "*.framework" || true
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ ERROR: Libbox.xcframework directory NOT found!"
|
||||
echo "Listing iOS-SwiftUI-Code directory:"
|
||||
ls -la
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Setup Xcode
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: '26.3'
|
||||
|
||||
- name: Show Xcode version
|
||||
run: |
|
||||
xcodebuild -version
|
||||
swift --version
|
||||
|
||||
- name: Resolve Swift Package Dependencies
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code
|
||||
xcodebuild -resolvePackageDependencies -project uuvpn.xcodeproj -scheme SFI
|
||||
|
||||
- name: List available schemes
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code
|
||||
xcodebuild -list -project uuvpn.xcodeproj
|
||||
|
||||
- name: Diagnose Libbox module
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code
|
||||
echo "=== Libbox.xcframework Info.plist ==="
|
||||
cat Libbox.xcframework/Info.plist
|
||||
echo ""
|
||||
echo "=== Simulator module.modulemap ==="
|
||||
cat Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/Modules/module.modulemap
|
||||
echo ""
|
||||
echo "=== Simulator Headers ==="
|
||||
ls -la Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/Headers/
|
||||
echo ""
|
||||
echo "=== Check for Swift module interface ==="
|
||||
find Libbox.xcframework/ios-arm64_x86_64-simulator -name "*.swiftmodule" -o -name "*.swiftinterface" 2>/dev/null || echo "No Swift module interface found"
|
||||
echo ""
|
||||
echo "=== Check Modules directory ==="
|
||||
ls -la Libbox.xcframework/ios-arm64_x86_64-simulator/Libbox.framework/Versions/A/Modules/
|
||||
|
||||
- name: Build iOS Debug App
|
||||
id: build
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code
|
||||
xcodebuild clean build \
|
||||
-project uuvpn.xcodeproj \
|
||||
-scheme SFI \
|
||||
-sdk iphonesimulator \
|
||||
-destination 'platform=iOS Simulator,name=iPhone Air,OS=26.2' \
|
||||
-configuration Debug \
|
||||
CODE_SIGN_IDENTITY="" \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
2>&1 | tee build_output.log
|
||||
|
||||
# 检查构建结果
|
||||
if grep -q "BUILD SUCCEEDED" build_output.log; then
|
||||
echo "✅ BUILD SUCCEEDED"
|
||||
echo "build_status=succeeded" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "❌ BUILD FAILED"
|
||||
echo "=== Error lines from build log ==="
|
||||
grep -i "error:" build_output.log || echo "No 'error:' lines found"
|
||||
echo ""
|
||||
echo "=== Last 100 lines of build log ==="
|
||||
tail -100 build_output.log
|
||||
echo "build_status=failed" >> $GITHUB_OUTPUT
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Find and upload iOS Debug App
|
||||
if: success()
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code
|
||||
|
||||
# 查找 .app 文件
|
||||
echo "Searching for .app files in DerivedData..."
|
||||
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "SFI.app" -type d | head -n 1)
|
||||
|
||||
if [ -z "$APP_PATH" ]; then
|
||||
APP_PATH=$(find ~/Library/Developer/Xcode/DerivedData -name "*.app" -type d | head -n 1)
|
||||
fi
|
||||
|
||||
if [ -n "$APP_PATH" ] && [ -d "$APP_PATH" ]; then
|
||||
echo "✅ Found app at: $APP_PATH"
|
||||
echo "App size:"
|
||||
du -sh "$APP_PATH"
|
||||
|
||||
# 复制到 build 目录
|
||||
mkdir -p build
|
||||
cp -R "$APP_PATH" build/
|
||||
|
||||
# 创建 zip 文件
|
||||
cd build
|
||||
APP_NAME=$(basename "$APP_PATH")
|
||||
zip -r ios-debug-app.zip "$APP_NAME"
|
||||
|
||||
echo "✅ Created zip file: ios-debug-app.zip"
|
||||
ls -lh ios-debug-app.zip
|
||||
else
|
||||
echo "❌ No .app file found in DerivedData"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Upload iOS Debug App
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ios-debug-app
|
||||
path: iOS-SwiftUI-Code/build/ios-debug-app.zip
|
||||
retention-days: 7
|
||||
@@ -0,0 +1,283 @@
|
||||
name: Build iOS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build_debug:
|
||||
description: 'Build Debug IPA'
|
||||
required: false
|
||||
default: true
|
||||
type: boolean
|
||||
build_release:
|
||||
description: 'Build Release IPA'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
IOS_XCODE_VERSION: "16.0"
|
||||
IOS_DEPLOYMENT_TARGET: "15.0"
|
||||
|
||||
jobs:
|
||||
build-ios:
|
||||
name: Build iOS IPA
|
||||
runs-on: ubuntu
|
||||
env:
|
||||
RUNNER_TOOL_CACHE: /toolcache
|
||||
|
||||
steps:
|
||||
- name: Install dependencies (Alpine)
|
||||
run: |
|
||||
# 添加 community 仓库
|
||||
echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories
|
||||
apk update
|
||||
|
||||
# 安装基础依赖
|
||||
apk add --no-cache \
|
||||
wget \
|
||||
curl \
|
||||
git-lfs \
|
||||
bash \
|
||||
python3 \
|
||||
py3-pip \
|
||||
docker \
|
||||
openrc \
|
||||
sshpass \
|
||||
sshfs
|
||||
|
||||
# 启动 docker 服务
|
||||
rc-service docker start || true
|
||||
docker --version || echo "Docker not available"
|
||||
|
||||
- name: Check virtualization support
|
||||
run: |
|
||||
echo "========================================"
|
||||
echo "Checking virtualization support..."
|
||||
echo "========================================"
|
||||
|
||||
# 检查 KVM
|
||||
ls -la /dev/kvm 2>/dev/null || echo "KVM device not found"
|
||||
cat /proc/cpuinfo | grep -E "vmx|svm" | head -5 || echo "No hardware virtualization detected"
|
||||
|
||||
echo ""
|
||||
echo "Docker version:"
|
||||
docker --version || echo "Docker not found"
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Git LFS
|
||||
run: |
|
||||
git lfs install
|
||||
|
||||
# 配置 LFS 认证
|
||||
git config --global lfs.url "https://admin:73ffc0f4391a26bb327fbed379d63b5a087e5f10@git.viaeon.com/admin/UUVPN.git/info/lfs"
|
||||
|
||||
echo "Attempting LFS pull..."
|
||||
git lfs pull 2>&1 || echo "LFS pull failed, trying alternative methods..."
|
||||
|
||||
# 如果 LFS pull 失败,尝试直接 fetch 和 checkout
|
||||
git lfs fetch origin 2>&1 || echo "LFS fetch failed"
|
||||
git lfs checkout 2>&1 || echo "LFS checkout failed"
|
||||
|
||||
- name: Check if Libbox framework exists
|
||||
id: check_lfs
|
||||
run: |
|
||||
echo "========================================"
|
||||
echo "Checking LFS files..."
|
||||
echo "========================================"
|
||||
|
||||
echo "Libbox.xcframework contents:"
|
||||
ls -la iOS-SwiftUI-Code/Libbox.xcframework/ 2>/dev/null || echo "Directory not found or empty"
|
||||
|
||||
# 检查关键文件是否是真正的二进制文件(不是 LFS 指针)
|
||||
if [ -f "iOS-SwiftUI-Code/Libbox.xcframework/ios-arm64/Libbox.framework/Libbox" ]; then
|
||||
file_size=$(stat -c%s "iOS-SwiftUI-Code/Libbox.xcframework/ios-arm64/Libbox.framework/Libbox" 2>/dev/null || stat -f%z "iOS-SwiftUI-Code/Libbox.xcframework/ios-arm64/Libbox.framework/Libbox" 2>/dev/null)
|
||||
if [ "$file_size" -gt 100 ]; then
|
||||
echo "lfs_ready=true" >> $GITHUB_OUTPUT
|
||||
echo "✅ LFS files downloaded successfully (file size: ${file_size} bytes)"
|
||||
else
|
||||
echo "lfs_ready=false" >> $GITHUB_OUTPUT
|
||||
echo "❌ LFS files are pointers, not actual binaries"
|
||||
fi
|
||||
else
|
||||
echo "lfs_ready=false" >> $GITHUB_OUTPUT
|
||||
echo "❌ LFS files not available"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
- name: Pull Docker-OSX image
|
||||
if: ${{ steps.check_lfs.outputs.lfs_ready == 'true' }}
|
||||
run: |
|
||||
echo "Pulling Docker-OSX image..."
|
||||
docker pull sickcodes/docker-osx:latest || echo "Failed to pull image"
|
||||
|
||||
- name: Start macOS VM (Sonoma)
|
||||
if: ${{ steps.check_lfs.outputs.lfs_ready == 'true' }}
|
||||
run: |
|
||||
echo "========================================"
|
||||
echo "Starting macOS Sonoma VM with Docker-OSX..."
|
||||
echo "========================================"
|
||||
echo ""
|
||||
echo "⚠️ 注意: 首次启动需要下载 macOS 安装镜像 (~15GB)"
|
||||
echo "⚠️ 这可能需要 30-60 分钟"
|
||||
echo ""
|
||||
|
||||
# 使用正确的 Docker-OSX 启动命令
|
||||
# 注意: 需要 --device /dev/kvm 来传递 KVM 设备
|
||||
# 注意: 需要 -it 交互式模式
|
||||
# 注意: Sonoma 需要特殊的 CPU 配置
|
||||
|
||||
# 检查 KVM 是否可用
|
||||
if [ -e "/dev/kvm" ]; then
|
||||
echo "✅ KVM is available"
|
||||
KVM_DEVICE="--device /dev/kvm"
|
||||
else
|
||||
echo "❌ KVM not available, will use QEMU emulation (very slow)"
|
||||
KVM_DEVICE=""
|
||||
fi
|
||||
|
||||
# 启动 macOS Sonoma 容器
|
||||
# 使用 -d 后台运行,并设置环境变量
|
||||
docker run -d \
|
||||
--name macos-vm \
|
||||
$KVM_DEVICE \
|
||||
--privileged \
|
||||
-p 50922:10022 \
|
||||
-e RAM=8192 \
|
||||
-e SMP=4 \
|
||||
-e CPU='Haswell-noTSX' \
|
||||
-e CPUID_FLAGS='kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on' \
|
||||
-e GENERATE_UNIQUE=true \
|
||||
-e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom-sonoma.plist' \
|
||||
-e SHORTNAME=sonoma \
|
||||
-e DISPLAY=dummy \
|
||||
sickcodes/docker-osx:latest || echo "Failed to start VM"
|
||||
|
||||
echo ""
|
||||
echo "VM started in background"
|
||||
echo "Waiting for macOS to boot (this may take several minutes)..."
|
||||
|
||||
# 等待 SSH 可用
|
||||
max_wait=600 # 10 分钟
|
||||
wait_count=0
|
||||
while [ $wait_count -lt $max_wait ]; do
|
||||
if sshpass -p "user" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -p 50922 user@localhost "echo 'SSH ready'" 2>/dev/null; then
|
||||
echo "✅ SSH is ready!"
|
||||
break
|
||||
fi
|
||||
echo "Waiting for SSH... ($wait_count/$max_wait)"
|
||||
sleep 10
|
||||
wait_count=$((wait_count + 10))
|
||||
done
|
||||
|
||||
if [ $wait_count -ge $max_wait ]; then
|
||||
echo "❌ SSH not available after $max_wait seconds"
|
||||
docker logs macos-vm 2>/dev/null | tail -50 || echo "No VM logs"
|
||||
fi
|
||||
|
||||
- name: Check macOS VM status
|
||||
if: ${{ steps.check_lfs.outputs.lfs_ready == 'true' }}
|
||||
run: |
|
||||
echo "========================================"
|
||||
echo "macOS VM Status"
|
||||
echo "========================================"
|
||||
|
||||
# 通过 SSH 连接到 macOS
|
||||
echo "Checking macOS via SSH..."
|
||||
|
||||
# 尝试连接 SSH
|
||||
sshpass -p "user" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 -p 50922 user@localhost "uname -a" 2>/dev/null || echo "Cannot connect via SSH"
|
||||
|
||||
# 检查 xcodebuild
|
||||
sshpass -p "user" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 -p 50922 user@localhost "xcodebuild -version" 2>/dev/null || echo "xcodebuild not found"
|
||||
|
||||
# 检查容器日志
|
||||
echo ""
|
||||
echo "Container logs (last 30 lines):"
|
||||
docker logs macos-vm 2>/dev/null | tail -30 || echo "No VM logs"
|
||||
|
||||
- name: Build iOS app (attempt)
|
||||
if: ${{ steps.check_lfs.outputs.lfs_ready == 'true' }}
|
||||
run: |
|
||||
echo "========================================"
|
||||
echo "Attempting iOS build..."
|
||||
echo "========================================"
|
||||
|
||||
# 通过 SSHFS 挂载 macOS 文件系统,或者通过 SSH 直接执行命令
|
||||
# 默认用户: user, 密码: user
|
||||
|
||||
# 检查 SSH 是否可用
|
||||
if sshpass -p "user" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 -p 50922 user@localhost "echo 'SSH ready'" 2>/dev/null; then
|
||||
echo "✅ SSH connection available"
|
||||
|
||||
# 将代码复制到 macOS
|
||||
echo "Copying code to macOS..."
|
||||
sshpass -p "user" scp -o StrictHostKeyChecking=no -P 50922 -r iOS-SwiftUI-Code user@localhost:/tmp/ 2>/dev/null || echo "Failed to copy code"
|
||||
|
||||
# 检查代码是否存在
|
||||
sshpass -p "user" ssh -o StrictHostKeyChecking=no -p 50922 user@localhost "ls -la /tmp/iOS-SwiftUI-Code/" 2>/dev/null || echo "Code not copied"
|
||||
|
||||
# 尝试构建
|
||||
echo ""
|
||||
echo "Building iOS app..."
|
||||
sshpass -p "user" ssh -o StrictHostKeyChecking=no -p 50922 user@localhost "
|
||||
cd /tmp/iOS-SwiftUI-Code || exit 1
|
||||
|
||||
# 检查 xcodebuild
|
||||
xcodebuild -version || echo 'xcodebuild not found'
|
||||
|
||||
# 尝试构建
|
||||
xcodebuild \
|
||||
-project uuvpn.xcodeproj \
|
||||
-scheme SFI \
|
||||
-sdk iphoneos \
|
||||
-configuration Debug \
|
||||
-derivedDataPath build \
|
||||
CODE_SIGN_IDENTITY='' \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
build 2>&1 || echo 'Build failed'
|
||||
" 2>&1 || echo "SSH command failed"
|
||||
|
||||
else
|
||||
echo "❌ SSH not available, cannot build"
|
||||
echo ""
|
||||
echo "Docker-OSX 问题总结:"
|
||||
echo "1. 首次启动需要下载 macOS 安装镜像 (~15GB)"
|
||||
echo "2. 需要等待 macOS 安装完成 (可能需要 1 小时+)"
|
||||
echo "3. 需要手动安装 Xcode"
|
||||
echo ""
|
||||
echo "建议:"
|
||||
echo "- 使用 GitHub Actions 的托管 macOS runner (免费)"
|
||||
echo "- 或者预先准备好 macOS 虚拟机镜像"
|
||||
fi
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: |
|
||||
echo "Cleaning up..."
|
||||
docker stop macos-vm 2>/dev/null || true
|
||||
docker rm macos-vm 2>/dev/null || true
|
||||
|
||||
- name: Build summary
|
||||
run: |
|
||||
echo "========================================"
|
||||
echo "iOS Build Summary"
|
||||
echo "========================================"
|
||||
echo "LFS ready: ${{ steps.check_lfs.outputs.lfs_ready }}"
|
||||
echo ""
|
||||
if [ "${{ steps.check_lfs.outputs.lfs_ready }}" != "true" ]; then
|
||||
echo "❌ Cannot build iOS without Libbox.xcframework"
|
||||
else
|
||||
echo "✅ LFS files available"
|
||||
echo "Build was attempted - check logs above for results"
|
||||
fi
|
||||
+98
-214
@@ -37,38 +37,96 @@ env:
|
||||
ANDROID_COMPILE_SDK: "33"
|
||||
ANDROID_BUILD_TOOLS: "33.0.0"
|
||||
ANDROID_TARGET_SDK: "33"
|
||||
ANDROID_JDK_VERSION: "11"
|
||||
ANDROID_JDK_VERSION: "17"
|
||||
|
||||
# iOS 配置
|
||||
IOS_XCODE_VERSION: "15.0"
|
||||
IOS_XCODE_VERSION: "16.0"
|
||||
IOS_DEPLOYMENT_TARGET: "15.0"
|
||||
|
||||
jobs:
|
||||
# ==================== Android 构建 ====================
|
||||
build-android:
|
||||
name: Build Android APK
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.inputs.build_android != 'false' }}
|
||||
runs-on: ubuntu
|
||||
# 暂时禁用 Android 构建,使用 build-android.yml
|
||||
if: ${{ false && github.event.inputs.build_android != 'false' }}
|
||||
env:
|
||||
RUNNER_TOOL_CACHE: /toolcache
|
||||
|
||||
steps:
|
||||
- name: Install Node.js
|
||||
run: |
|
||||
export PATH="/toolcache/bin:$PATH"
|
||||
if ! command -v node &> /dev/null; then
|
||||
if command -v apk &> /dev/null; then
|
||||
apk add --no-cache nodejs npm
|
||||
else
|
||||
curl -fsSL https://nodejs.org/dist/v20.0.0/node-v20.0.0-linux-x64.tar.xz | tar -xJ -C /tmp
|
||||
mkdir -p /toolcache
|
||||
cp -r /tmp/node-v20.0.0-linux-x64/{bin,lib,share} /toolcache/
|
||||
fi
|
||||
fi
|
||||
node --version
|
||||
|
||||
- name: Install Git LFS
|
||||
run: |
|
||||
if command -v apk &> /dev/null; then
|
||||
apk add --no-cache git-lfs
|
||||
elif command -v apt-get &> /dev/null; then
|
||||
apt-get update && apt-get install -y git-lfs
|
||||
else
|
||||
curl -sL https://github.com/git-lfs/git-lfs/releases/download/v3.5.1/git-lfs-linux-amd64-v3.5.1.tar.gz | tar xz -C /tmp
|
||||
mv /tmp/git-lfs-3.5.1/git-lfs /toolcache/bin/
|
||||
fi
|
||||
git lfs install
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: ${{ env.ANDROID_JDK_VERSION }}
|
||||
distribution: 'temurin'
|
||||
cache: 'gradle'
|
||||
- name: Pull Git LFS files
|
||||
run: |
|
||||
git lfs pull || echo "LFS pull failed, continuing without LFS files (Android build doesn't need them)"
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
cache: true
|
||||
- name: Install Java 17
|
||||
run: |
|
||||
if command -v apk &> /dev/null; then
|
||||
# Enable community repository for openjdk17-jdk
|
||||
echo "https://dl-cdn.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories
|
||||
apk update
|
||||
apk add --no-cache openjdk17-jdk
|
||||
echo "JAVA_HOME=/usr/lib/jvm/java-17-openjdk" >> $GITHUB_ENV
|
||||
elif command -v apt-get &> /dev/null; then
|
||||
apt-get update && apt-get install -y openjdk-17-jdk
|
||||
echo "JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64" >> $GITHUB_ENV
|
||||
else
|
||||
curl -sL https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz | tar xz -C /toolcache
|
||||
echo "JAVA_HOME=/toolcache/jdk-17.0.9+9" >> $GITHUB_ENV
|
||||
echo "/toolcache/jdk-17.0.9+9/bin" >> $GITHUB_PATH
|
||||
fi
|
||||
java -version
|
||||
|
||||
- name: Install Go 1.23
|
||||
run: |
|
||||
mkdir -p /toolcache
|
||||
if ! command -v curl &> /dev/null; then
|
||||
if command -v apk &> /dev/null; then
|
||||
apk add --no-cache curl
|
||||
fi
|
||||
fi
|
||||
curl -sL https://go.dev/dl/go1.23.0.linux-amd64.tar.gz | tar xz -C /toolcache
|
||||
echo "/toolcache/go/bin" >> $GITHUB_PATH
|
||||
echo "GOROOT=/toolcache/go" >> $GITHUB_ENV
|
||||
/toolcache/go/bin/go version
|
||||
|
||||
- name: Install gcompat (for NDK on Alpine)
|
||||
run: |
|
||||
# Install gcompat for running glibc binaries on Alpine (required for NDK clang)
|
||||
if command -v apk &> /dev/null; then
|
||||
apk add --no-cache gcompat libstdc++
|
||||
fi
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
@@ -111,28 +169,27 @@ jobs:
|
||||
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' }}
|
||||
run: |
|
||||
cd Android-kotlin-Code
|
||||
./gradlew app:assembleMeta-AlphaDebug --stacktrace
|
||||
./gradlew assembleAlphaDebug --stacktrace
|
||||
|
||||
- name: Build Android Release APK
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: |
|
||||
cd Android-kotlin-Code
|
||||
./gradlew app:assembleMeta-AlphaRelease --stacktrace
|
||||
./gradlew assembleAlphaRelease --stacktrace
|
||||
|
||||
- name: Build Android APK (Default)
|
||||
if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/v') && github.ref != 'refs/heads/develop' }}
|
||||
run: |
|
||||
cd Android-kotlin-Code
|
||||
./gradlew app:assembleMeta-AlphaRelease --stacktrace
|
||||
./gradlew assembleAlphaRelease --stacktrace
|
||||
|
||||
- name: Upload Android APK Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: android-apk-${{ github.sha }}
|
||||
path: |
|
||||
Android-kotlin-Code/app/build/outputs/apk/**/*.apk
|
||||
Android-kotlin-Code/app/build/outputs/apk/**/*.json
|
||||
retention-days: 30
|
||||
run: |
|
||||
# Copy APK to a known location for artifact upload
|
||||
mkdir -p /tmp/artifacts
|
||||
find Android-kotlin-Code/app/build/outputs/apk -name "*.apk" -type f -exec cp {} /tmp/artifacts/ \;
|
||||
ls -la /tmp/artifacts/
|
||||
echo "APK files copied to /tmp/artifacts"
|
||||
|
||||
- name: Get APK filename
|
||||
id: apk_name
|
||||
@@ -143,6 +200,10 @@ jobs:
|
||||
APK_NAME="UUVPN-Android-${{ github.sha }}.apk"
|
||||
fi
|
||||
echo "apk_name=$APK_NAME" >> $GITHUB_OUTPUT
|
||||
# Find the APK file
|
||||
APK_PATH=$(find Android-kotlin-Code/app/build/outputs/apk -name "*.apk" -type f | head -1)
|
||||
echo "apk_path=$APK_PATH" >> $GITHUB_OUTPUT
|
||||
echo "Found APK: $APK_PATH"
|
||||
|
||||
- name: Rename APK for release
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
@@ -150,139 +211,20 @@ jobs:
|
||||
cd Android-kotlin-Code/app/build/outputs/apk
|
||||
find . -name "*.apk" -type f -exec mv {} "${{ steps.apk_name.outputs.apk_name }}" \;
|
||||
|
||||
# ==================== iOS 构建 ====================
|
||||
# ==================== iOS 构建 (Docker-OSX) ====================
|
||||
# 已移至 build-ios.yml
|
||||
build-ios:
|
||||
name: Build iOS IPA
|
||||
runs-on: macos-latest
|
||||
if: ${{ github.event.inputs.build_ios != 'false' }}
|
||||
|
||||
runs-on: ubuntu
|
||||
if: ${{ false }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Xcode
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: ${{ env.IOS_XCODE_VERSION }}
|
||||
|
||||
- name: Show Xcode version
|
||||
run: |
|
||||
xcodebuild -version
|
||||
swift --version
|
||||
|
||||
- name: Install Apple Certificate
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: apple-actions/import-codesign-certs@v2
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.IOS_CERTIFICATES_P12 }}
|
||||
p12-password: ${{ secrets.IOS_CERTIFICATES_PASSWORD }}
|
||||
|
||||
- name: Install Provisioning Profile
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: |
|
||||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
|
||||
echo "${{ secrets.IOS_PROVISIONING_PROFILE }}" | base64 -d > ~/Library/MobileDevice/Provisioning\ Profiles/uuvpn.mobileprovision
|
||||
|
||||
- name: Resolve Swift Package Dependencies
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code
|
||||
xcodebuild -resolvePackageDependencies -project uuvpn.xcodeproj -scheme SFI | xcpretty
|
||||
|
||||
- name: Build iOS App (Debug)
|
||||
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' }}
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code
|
||||
xcodebuild clean build \
|
||||
-project uuvpn.xcodeproj \
|
||||
-scheme SFI \
|
||||
-sdk iphonesimulator \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \
|
||||
-configuration Debug \
|
||||
CODE_SIGN_IDENTITY="" \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
| xcpretty
|
||||
|
||||
- name: Build and Archive iOS App (Release)
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code
|
||||
xcodebuild clean archive \
|
||||
-project uuvpn.xcodeproj \
|
||||
-scheme SFI \
|
||||
-sdk iphoneos \
|
||||
-configuration Release \
|
||||
-archivePath build/UUVPN.xcarchive \
|
||||
CODE_SIGN_IDENTITY="${{ secrets.IOS_SIGNING_IDENTITY }}" \
|
||||
PROVISIONING_PROFILE_SPECIFIER="uuvpn" \
|
||||
| xcpretty
|
||||
|
||||
- name: Create ExportOptions.plist
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code
|
||||
cat > ExportOptions.plist << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>method</key>
|
||||
<string>app-store</string>
|
||||
<key>teamID</key>
|
||||
<string>${{ secrets.IOS_TEAM_ID }}</string>
|
||||
<key>uploadSymbols</key>
|
||||
<true/>
|
||||
<key>compileBitcode</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
- name: Export IPA
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code
|
||||
xcodebuild -exportArchive \
|
||||
-archivePath build/UUVPN.xcarchive \
|
||||
-exportPath build/ipa \
|
||||
-exportOptionsPlist ExportOptions.plist \
|
||||
| xcpretty
|
||||
|
||||
- name: Upload iOS IPA Artifact
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ios-ipa-${{ github.sha }}
|
||||
path: iOS-SwiftUI-Code/build/ipa/*.ipa
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload iOS App Artifact (Debug)
|
||||
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ios-app-debug-${{ github.sha }}
|
||||
path: iOS-SwiftUI-Code/build/**/*.app
|
||||
retention-days: 7
|
||||
|
||||
- name: Get IPA filename
|
||||
id: ipa_name
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: |
|
||||
IPA_NAME="UUVPN-iOS-${{ github.ref_name }}.ipa"
|
||||
echo "ipa_name=$IPA_NAME" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Rename IPA for release
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
run: |
|
||||
cd iOS-SwiftUI-Code/build/ipa
|
||||
find . -name "*.ipa" -type f -exec mv {} "${{ steps.ipa_name.outputs.ipa_name }}" \;
|
||||
- name: Disabled
|
||||
run: echo "iOS build moved to build-ios.yml"
|
||||
|
||||
# ==================== 发布到 GitHub Releases ====================
|
||||
release:
|
||||
name: Create GitHub Release
|
||||
needs: [build-android, build-ios]
|
||||
needs: [build-android]
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
|
||||
@@ -296,12 +238,6 @@ jobs:
|
||||
name: android-apk-${{ github.sha }}
|
||||
path: artifacts/android
|
||||
|
||||
- name: Download iOS IPA
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ios-ipa-${{ github.sha }}
|
||||
path: artifacts/ios
|
||||
|
||||
- name: Get version from tag
|
||||
id: get_version
|
||||
run: |
|
||||
@@ -353,71 +289,19 @@ jobs:
|
||||
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') }}
|
||||
files: |
|
||||
artifacts/android/*.apk
|
||||
artifacts/ios/*.ipa
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# ==================== 上传到 TestFlight (iOS) ====================
|
||||
upload-testflight:
|
||||
name: Upload to TestFlight
|
||||
needs: [build-ios]
|
||||
runs-on: macos-latest
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, 'alpha') }}
|
||||
|
||||
steps:
|
||||
- name: Download iOS IPA
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ios-ipa-${{ github.sha }}
|
||||
path: artifacts/ios
|
||||
|
||||
- name: Upload to TestFlight
|
||||
uses: apple-actions/upload-testflight-build@v1
|
||||
with:
|
||||
app-path: artifacts/ios/*.ipa
|
||||
issuer-id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
|
||||
api-key-id: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }}
|
||||
api-private-key: ${{ secrets.APP_STORE_CONNECT_API_PRIVATE_KEY }}
|
||||
|
||||
# ==================== 清理旧构建产物 ====================
|
||||
cleanup:
|
||||
name: Cleanup old artifacts
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
|
||||
steps:
|
||||
- name: Delete old artifacts
|
||||
uses: c-hive/gha-remove-artifacts@v1
|
||||
with:
|
||||
age: '30 days'
|
||||
skip-recent: 5
|
||||
|
||||
# ==================== 通知 ====================
|
||||
notify:
|
||||
name: Send Notification
|
||||
needs: [build-android, build-ios]
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-android]
|
||||
runs-on: ubuntu
|
||||
if: ${{ always() && github.event_name == 'push' }}
|
||||
|
||||
steps:
|
||||
- name: Send Telegram Notification
|
||||
uses: appleboy/telegram-action@master
|
||||
if: ${{ secrets.TELEGRAM_BOT_TOKEN != '' }}
|
||||
with:
|
||||
to: ${{ secrets.TELEGRAM_CHAT_ID }}
|
||||
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
format: markdown
|
||||
message: |
|
||||
*UUVPN Build Notification*
|
||||
|
||||
📦 **Repository**: ${{ github.repository }}
|
||||
🌿 **Branch**: ${{ github.ref_name }}
|
||||
🔄 **Commit**: ${{ github.sha }}
|
||||
✅ **Status**:
|
||||
- Android: ${{ needs.build-android.result }}
|
||||
- iOS: ${{ needs.build-ios.result }}
|
||||
|
||||
👤 **Author**: ${{ github.actor }}
|
||||
💬 **Message**: ${{ github.event.head_commit.message }}
|
||||
|
||||
[View Build](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
|
||||
run: |
|
||||
echo "Telegram notification would be sent here"
|
||||
echo "Build status: ${{ needs.build-android.result }}"
|
||||
@@ -1,6 +1,9 @@
|
||||
app-profile.apk
|
||||
.DS_Store
|
||||
|
||||
# Exclude kankanjiao project
|
||||
/kankanjiao/
|
||||
|
||||
# Do not remove or rename entries in this file, only add new ones
|
||||
# See https://github.com/flutter/flutter/issues/128635 for more context.
|
||||
|
||||
|
||||
@@ -49,7 +49,8 @@
|
||||
android:configChanges="uiMode"
|
||||
android:exported="true"
|
||||
android:label="@string/launch_name"
|
||||
android:launchMode="singleTop" >
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/SplashTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ abstract class BaseActivity<D : Design<*>> : AppCompatActivity(),
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
setTheme(R.style.BootstrapTheme)
|
||||
super.onCreate(savedInstanceState)
|
||||
applyDayNight()
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.github.kr328.clash
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.lifecycle.LiveData
|
||||
@@ -26,7 +24,6 @@ import com.github.kr328.clash.design.PreferenceLiveData
|
||||
import com.github.kr328.clash.design.PreferenceManager
|
||||
import com.github.kr328.clash.design.R
|
||||
import com.github.kr328.clash.design.component.ProxyMenu
|
||||
import com.github.kr328.clash.design.databinding.ActivitySplashBinding
|
||||
import com.github.kr328.clash.design.dialog.requestModelTextInput
|
||||
import com.github.kr328.clash.design.dialog.withModelProgressBar
|
||||
import com.github.kr328.clash.design.network.APIGlobalObject
|
||||
@@ -111,7 +108,7 @@ class MainActivity : BaseActivity<MainDesign>() {
|
||||
//存储到本地
|
||||
val plainid = subcache.data.plan_id ?: 0
|
||||
// 或者检查使用量
|
||||
val guoqi = (subcache.data.u ) + (subcache.data.d) > (subcache.data.transfer_enable ?: 0) && (subcache.data.transfer_enable ?: 0) > 0
|
||||
val guoqi = (subcache.data.u ?: 0) + (subcache.data.d ?: 0) > (subcache.data.transfer_enable ?: 0) && (subcache.data.transfer_enable ?: 0) > 0
|
||||
if ( plainid == 0 || guoqi ) {
|
||||
//提示到期
|
||||
//删除所有节点
|
||||
@@ -280,15 +277,8 @@ class MainActivity : BaseActivity<MainDesign>() {
|
||||
|
||||
|
||||
}else{
|
||||
val binding = ActivitySplashBinding
|
||||
.inflate(this.layoutInflater, this.root, false)
|
||||
|
||||
setContentView(binding.root)
|
||||
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
startActivity(LoginActivity::class.intent)
|
||||
|
||||
}, 1000) // Simulating a network delay
|
||||
startActivity(LoginActivity::class.intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/white" />
|
||||
<item>
|
||||
<bitmap
|
||||
android:src="@drawable/appstore"
|
||||
android:gravity="center" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="BootstrapTheme" parent="AppThemeDark" />
|
||||
|
||||
<style name="SplashTheme" parent="BootstrapTheme" />
|
||||
</resources>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="SplashTheme" parent="BootstrapTheme">
|
||||
<item name="android:windowSplashScreenBackground">@color/white</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/appstore</item>
|
||||
<item name="android:windowSplashScreenIconBackgroundColor">@color/white</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="BootstrapTheme" parent="AppThemeLight" />
|
||||
|
||||
<style name="SplashTheme" parent="BootstrapTheme" />
|
||||
</resources>
|
||||
|
||||
@@ -51,8 +51,7 @@ subprojects {
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
|
||||
abiFilters("arm64-v8a", "armeabi-v7a",)
|
||||
abiFilters("arm64-v8a", "armeabi-v7a", "x86", "x86_64")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -83,8 +83,15 @@ class ProfileDesign (context: Context) : Design<ProfileDesign.Request>(context)
|
||||
|
||||
if ( APIGlobalObject.subData == null){
|
||||
val gson = Gson()
|
||||
val cached_userSubscritedata = gson.fromJson(PreferenceManager.cached_userSubscritedata, SubscribeResponse::class.java)
|
||||
APIGlobalObject.subData = cached_userSubscritedata.data
|
||||
val cachedStr = PreferenceManager.cached_userSubscritedata
|
||||
if (!cachedStr.isNullOrEmpty()) {
|
||||
try {
|
||||
val cached_userSubscritedata = gson.fromJson(cachedStr, SubscribeResponse::class.java)
|
||||
APIGlobalObject.subData = cached_userSubscritedata?.data
|
||||
} catch (e: Exception) {
|
||||
// 缓存数据格式不匹配,忽略
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.accountEmail = PreferenceManager.loginemail
|
||||
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ object ApiClient {
|
||||
get() {
|
||||
val url = PreferenceManager.baseURL
|
||||
return if (url.isNullOrEmpty()) {
|
||||
"https://vungles.com/" // Default fallback URL to prevent crash
|
||||
"https://x.161777.xyz/" // Default fallback URL to prevent crash
|
||||
} else {
|
||||
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
||||
"https://$url"
|
||||
@@ -44,7 +44,7 @@ object ApiClient {
|
||||
}
|
||||
|
||||
object ApiClientConfig {
|
||||
private const val ConfigURL = "https://vungles.com/api/test/" // BASE 请求配置文件地址 见说明文档
|
||||
private const val ConfigURL = "https://cg.161777.xyz/" // BASE 请求配置文件地址 见说明文档
|
||||
// private const val ConfigURL = "https://uuvpn.oss-cn-hongkong.aliyuncs.com/api/test/" // BASE 请求配置文件地址 见说明文档
|
||||
//这个链接主要是为了配置转化,一般有的订阅地址被墙之后国内无法访问,这里就是了防止被墙,使用我们的香港服务器进行顶级域名防护
|
||||
//const val ConfigNodeURL = "https://api.xxxx.com/api/parseyamlclash.php?target=clashmeta&url=" //通过香港服务器转接一次Clash转化的订阅地址
|
||||
|
||||
+27
-13
@@ -350,42 +350,56 @@ data class SubscribeResponse (
|
||||
data class SubscribeData (
|
||||
|
||||
@SerializedName("plan_id") val plan_id : Int?,
|
||||
@SerializedName("token") val token : String,
|
||||
@SerializedName("token") val token : String?,
|
||||
@SerializedName("expired_at") val expired_at : Long?,
|
||||
@SerializedName("u") val u : Long,
|
||||
@SerializedName("d") val d : Long,
|
||||
@SerializedName("u") val u : Long?,
|
||||
@SerializedName("d") val d : Long?,
|
||||
@SerializedName("transfer_enable") val transfer_enable : Long?,
|
||||
@SerializedName("email") val email : String,
|
||||
@SerializedName("uuid") val uuid : String,
|
||||
@SerializedName("email") val email : String?,
|
||||
@SerializedName("uuid") val uuid : String?,
|
||||
@SerializedName("device_limit") val device_limit : Int?,
|
||||
@SerializedName("speed_limit") val speed_limit : Int?,
|
||||
@SerializedName("next_reset_at") val next_reset_at : Long?,
|
||||
@SerializedName("plan") val plan : PlanData?,
|
||||
@SerializedName("subscribe_url") val subscribe_url : String,
|
||||
@SerializedName("subscribe_url") val subscribe_url : String?,
|
||||
@SerializedName("reset_day") val reset_day : String?
|
||||
|
||||
)
|
||||
|
||||
data class PlanData (
|
||||
@SerializedName("id") val id : Int,
|
||||
@SerializedName("id") val id : Int?,
|
||||
@SerializedName("group_id") val group_id : Int?,
|
||||
@SerializedName("transfer_enable") val transfer_enable : Long?,
|
||||
@SerializedName("name") val name : String,
|
||||
@SerializedName("name") val name : String?,
|
||||
@SerializedName("speed_limit") val speed_limit : Long?,
|
||||
@SerializedName("show") val show : Int?,
|
||||
@SerializedName("device_limit") val device_limit : Int?,
|
||||
@SerializedName("show") val show : Boolean?,
|
||||
@SerializedName("sell") val sell : Any?,
|
||||
@SerializedName("sort") val sort : Int?,
|
||||
@SerializedName("renew") val renew : Int?,
|
||||
@SerializedName("content") val content : String,
|
||||
@SerializedName("renew") val renew : Boolean?,
|
||||
@SerializedName("content") val content : String?,
|
||||
@SerializedName("month_price") val month_price : Long?,
|
||||
@SerializedName("quarter_price") val quarter_price : Long?,
|
||||
@SerializedName("half_year_price") val half_year_price : Long?,
|
||||
@SerializedName("year_price") val year_price : Long?,
|
||||
@SerializedName("two_year_price") val two_year_price : Long?,
|
||||
@SerializedName("three_year_price") val three_year_price : Long?,
|
||||
@SerializedName("onetime_price") val onetime_price : Int?,
|
||||
@SerializedName("onetime_price") val onetime_price : Long?,
|
||||
@SerializedName("reset_price") val reset_price : Long?,
|
||||
@SerializedName("reset_traffic_method") val reset_traffic_method : String?,
|
||||
@SerializedName("capacity_limit") val capacity_limit : Long?,
|
||||
@SerializedName("created_at") val created_at : Long?,
|
||||
@SerializedName("updated_at") val updated_at : Long?
|
||||
) : Serializable // 添加 Serializable 接口
|
||||
) : Serializable {
|
||||
// 辅助属性:将 sell 转换为布尔值(兼容整数和布尔类型)
|
||||
val isSell: Boolean
|
||||
get() = when (sell) {
|
||||
is Boolean -> sell as Boolean
|
||||
is Number -> (sell as Number).toInt() != 0
|
||||
null -> false
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
# UUVPN API 字段类型说明
|
||||
|
||||
## 问题背景
|
||||
|
||||
在对接 Xboard 后端 API 时,发现部分字段在不同接口返回的类型不一致,需要在客户端代码中做兼容处理。
|
||||
|
||||
---
|
||||
|
||||
## 字段类型不一致问题
|
||||
|
||||
### `sell` 字段
|
||||
|
||||
| 接口 | 返回类型 | 示例值 |
|
||||
|------|---------|--------|
|
||||
| `/api/v1/user/getSubscribe` | `Int` | `"sell": 1` |
|
||||
| `/api/v1/user/plan/fetch` | `Boolean` | `"sell": true` |
|
||||
|
||||
**解决方案:**
|
||||
|
||||
在 `PlanData` 数据类中:
|
||||
- 字段类型定义为 `Any?`
|
||||
- 添加辅助属性 `isSell` 进行类型转换
|
||||
|
||||
```kotlin
|
||||
@SerializedName("sell") val sell : Any?
|
||||
|
||||
// 辅助属性:将 sell 转换为布尔值(兼容整数和布尔类型)
|
||||
val isSell: Boolean
|
||||
get() = when (sell) {
|
||||
is Boolean -> sell as Boolean
|
||||
is Number -> (sell as Number).toInt() != 0
|
||||
null -> false
|
||||
else -> false
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 其他注意事项
|
||||
|
||||
### `PlanData` 字段
|
||||
|
||||
为确保 JSON 解析稳定性,以下字段定义为可空类型:
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| `id` | `Int?` | 套餐ID |
|
||||
| `name` | `String?` | 套餐名称 |
|
||||
| `show` | `Boolean?` | 是否显示 |
|
||||
| `renew` | `Boolean?` | 是否可续费 |
|
||||
| `sell` | `Any?` | 是否可购买(类型不一致) |
|
||||
|
||||
### `SubscribeData` 字段
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| `device_limit` | `Int?` | 设备限制数 |
|
||||
| `speed_limit` | `Int?` | 速度限制 |
|
||||
| `next_reset_at` | `Long?` | 下次重置时间 |
|
||||
|
||||
---
|
||||
|
||||
## 相关文件
|
||||
|
||||
- [ApiService.kt](Android-kotlin-Code/design/src/main/java/com/github/kr328/clash/design/network/ApiService.kt) - API 接口和数据类定义
|
||||
- [ApiClient.kt](Android-kotlin-Code/design/src/main/java/com/github/kr328/clash/design/network/ApiClient.kt) - Retrofit 客户端配置
|
||||
|
||||
---
|
||||
|
||||
## 更新日志
|
||||
|
||||
- 2026-07-03: 发现并修复 `sell` 字段类型不一致问题
|
||||
- 2026-07-03: 添加 `SubscribeData` 缺失字段
|
||||
- 2026-07-03: 修复 Retrofit baseUrl 必须以 `/` 结尾的问题
|
||||
@@ -0,0 +1,512 @@
|
||||
# GitHub Secrets 详细说明和获取方法
|
||||
|
||||
本文档详细说明 UUVPN CI/CD 所需的每个 Secret 的含义和获取方法。
|
||||
|
||||
---
|
||||
|
||||
## 📋 Secrets 清单总览
|
||||
|
||||
| Secret 名称 | 平台 | 必需程度 | 说明 |
|
||||
|------------|------|---------|------|
|
||||
| ANDROID_KEYSTORE_BASE64 | Android | Release 必需 | 签名密钥库的 Base64 编码 |
|
||||
| ANDROID_KEYSTORE_PASSWORD | Android | Release 必需 | 密钥库密码 |
|
||||
| ANDROID_KEY_ALIAS | Android | Release 必需 | 密钥别名 |
|
||||
| ANDROID_KEY_PASSWORD | Android | Release 必需 | 密钥密码 |
|
||||
| IOS_CERTIFICATES_P12 | iOS | Release 必需 | 开发者证书的 Base64 编码 |
|
||||
| IOS_CERTIFICATES_PASSWORD | iOS | Release 必需 | 证书密码 |
|
||||
| IOS_TEAM_ID | iOS | Release 必需 | Apple Team ID |
|
||||
| IOS_SIGNING_IDENTITY | iOS | Release 必需 | 签名身份 |
|
||||
| IOS_PROVISIONING_PROFILE | iOS | Release 必需 | Provisioning Profile 的 Base64 编码 |
|
||||
| APP_STORE_CONNECT_ISSUER_ID | iOS | 可选 | App Store Connect API Issuer ID |
|
||||
| APP_STORE_CONNECT_API_KEY_ID | iOS | 可选 | App Store Connect API Key ID |
|
||||
| APP_STORE_CONNECT_API_PRIVATE_KEY | iOS | 可选 | App Store Connect API 私钥 |
|
||||
| TELEGRAM_BOT_TOKEN | 通知 | 可选 | Telegram Bot Token |
|
||||
| TELEGRAM_CHAT_ID | 通知 | 可选 | Telegram Chat ID |
|
||||
|
||||
---
|
||||
|
||||
## 🤖 Android Secrets
|
||||
|
||||
### 1. ANDROID_KEYSTORE_BASE64
|
||||
|
||||
**含义**: Android 应用签名密钥库文件的 Base64 编码字符串
|
||||
|
||||
**为什么需要**: Android 要求所有 APK 在发布前必须签名。Release 版本需要使用你自己的签名密钥,而不是 Debug 密钥。
|
||||
|
||||
**获取方法**:
|
||||
|
||||
#### 步骤 1: 生成签名密钥库
|
||||
|
||||
如果你还没有签名密钥库,需要先创建:
|
||||
|
||||
**Windows (PowerShell)**:
|
||||
```powershell
|
||||
keytool -genkey -v -keystore release.keystore -alias uuvpn -keyalg RSA -keysize 2048 -validity 10000
|
||||
```
|
||||
|
||||
**macOS/Linux**:
|
||||
```bash
|
||||
keytool -genkey -v -keystore release.keystore -alias uuvpn -keyalg RSA -keysize 2048 -validity 10000
|
||||
```
|
||||
|
||||
按提示输入:
|
||||
- 密钥库密码 (记住这个密码,后面要用)
|
||||
- 个人信息 (姓名、组织、城市等)
|
||||
- 密钥密码 (可以直接回车使用与密钥库相同的密码)
|
||||
|
||||
**重要**: 请妥善保管 `release.keystore` 文件,丢失后无法恢复,已发布的应用将无法更新!
|
||||
|
||||
#### 步骤 2: 转换为 Base64
|
||||
|
||||
**Windows (PowerShell)**:
|
||||
```powershell
|
||||
[Convert]::ToBase64String([IO.File]::ReadAllBytes("release.keystore")) | Out-File release.keystore.base64 -Encoding UTF8
|
||||
```
|
||||
|
||||
**macOS/Linux**:
|
||||
```bash
|
||||
base64 -i release.keystore -o release.keystore.base64
|
||||
```
|
||||
|
||||
#### 步骤 3: 添加到 GitHub
|
||||
|
||||
1. 打开生成的 `release.keystore.base64` 文件
|
||||
2. 复制全部内容
|
||||
3. 在 GitHub 仓库中添加 Secret,名称为 `ANDROID_KEYSTORE_BASE64`,值为复制的内容
|
||||
|
||||
---
|
||||
|
||||
### 2. ANDROID_KEYSTORE_PASSWORD
|
||||
|
||||
**含义**: 签名密钥库的密码
|
||||
|
||||
**获取方法**: 这就是你在步骤 1 生成密钥库时设置的密码
|
||||
|
||||
**添加到 GitHub**: 直接输入密码字符串
|
||||
|
||||
---
|
||||
|
||||
### 3. ANDROID_KEY_ALIAS
|
||||
|
||||
**含义**: 密钥库中的密钥别名
|
||||
|
||||
**获取方法**: 这是你在生成密钥库时指定的别名,在上面的例子中是 `uuvpn`
|
||||
|
||||
如果你忘记了别名,可以查看密钥库内容:
|
||||
|
||||
**Windows (PowerShell)**:
|
||||
```powershell
|
||||
keytool -list -keystore release.keystore
|
||||
```
|
||||
|
||||
**macOS/Linux**:
|
||||
```bash
|
||||
keytool -list -keystore release.keystore
|
||||
```
|
||||
|
||||
输入密钥库密码后,会显示类似:
|
||||
```
|
||||
Keystore type: PKCS12
|
||||
Keystore provider: SUN
|
||||
|
||||
Your keystore contains 1 entry
|
||||
|
||||
uuvpn, 2026-07-01, PrivateKeyEntry,
|
||||
Certificate fingerprint (SHA-256): ...
|
||||
```
|
||||
|
||||
这里的 `uuvpn` 就是别名。
|
||||
|
||||
**添加到 GitHub**: 输入别名,例如 `uuvpn`
|
||||
|
||||
---
|
||||
|
||||
### 4. ANDROID_KEY_PASSWORD
|
||||
|
||||
**含义**: 密钥的密码
|
||||
|
||||
**获取方法**: 这是你在生成密钥库时设置的密钥密码。如果你在生成时直接按回车,那么它和密钥库密码相同。
|
||||
|
||||
**添加到 GitHub**: 输入密码字符串
|
||||
|
||||
---
|
||||
|
||||
## 🍎 iOS Secrets
|
||||
|
||||
### 1. IOS_CERTIFICATES_P12
|
||||
|
||||
**含义**: Apple 开发者证书的 Base64 编码
|
||||
|
||||
**为什么需要**: iOS 应用在真机运行或发布到 App Store 时,必须有有效的签名证书。
|
||||
|
||||
**前置要求**:
|
||||
- Apple Developer 账号 ($99/年)
|
||||
- 已创建 App ID
|
||||
- 已创建开发/发布证书
|
||||
|
||||
**获取方法**:
|
||||
|
||||
#### 步骤 1: 在 Apple Developer 网站创建证书
|
||||
|
||||
1. 登录 [Apple Developer](https://developer.apple.com/account/)
|
||||
2. 进入 "Certificates, Identifiers & Profiles"
|
||||
3. 点击 "Certificates" → "+" 创建新证书
|
||||
4. 选择 "Apple Distribution" (用于发布到 App Store)
|
||||
5. 按提示上传 CSR 文件 (Certificate Signing Request)
|
||||
- 在 Mac 上打开 "钥匙串访问" → "证书助理" → "从证书颁发机构请求证书"
|
||||
- 填写信息,选择 "保存到磁盘"
|
||||
- 上传生成的 CSR 文件
|
||||
6. 下载证书 (.cer 文件)
|
||||
|
||||
#### 步骤 2: 导出为 .p12 文件
|
||||
|
||||
**在 Mac 上**:
|
||||
1. 双击下载的 .cer 文件,将其添加到钥匙串
|
||||
2. 打开 "钥匙串访问" 应用
|
||||
3. 在 "我的证书" 分类中找到刚添加的证书
|
||||
- 名称类似: "Apple Distribution: Your Name (TEAM_ID)"
|
||||
4. 右键点击证书 → "导出..."
|
||||
5. 选择保存位置,格式选择 "个人信息交换 (.p12)"
|
||||
6. 设置密码 (记住这个密码,后面要用)
|
||||
|
||||
**在 Windows 上**:
|
||||
如果你没有 Mac,可以:
|
||||
1. 使用虚拟机安装 macOS
|
||||
2. 使用云端 Mac 服务
|
||||
3. 找有 Mac 的朋友帮忙
|
||||
|
||||
#### 步骤 3: 转换为 Base64
|
||||
|
||||
**macOS/Linux**:
|
||||
```bash
|
||||
base64 -i certificate.p12 -o certificate.p12.base64
|
||||
```
|
||||
|
||||
**Windows (PowerShell)**:
|
||||
```powershell
|
||||
[Convert]::ToBase64String([IO.File]::ReadAllBytes("certificate.p12")) | Out-File certificate.p12.base64 -Encoding UTF8
|
||||
```
|
||||
|
||||
#### 步骤 4: 添加到 GitHub
|
||||
|
||||
1. 打开生成的 `certificate.p12.base64` 文件
|
||||
2. 复制全部内容
|
||||
3. 在 GitHub 仓库中添加 Secret,名称为 `IOS_CERTIFICATES_P12`
|
||||
|
||||
---
|
||||
|
||||
### 2. IOS_CERTIFICATES_PASSWORD
|
||||
|
||||
**含义**: 导出 .p12 证书时设置的密码
|
||||
|
||||
**获取方法**: 这就是你在步骤 2 导出证书时设置的密码
|
||||
|
||||
**添加到 GitHub**: 直接输入密码字符串
|
||||
|
||||
---
|
||||
|
||||
### 3. IOS_TEAM_ID
|
||||
|
||||
**含义**: Apple Developer Team ID,用于标识你的开发者账号
|
||||
|
||||
**获取方法**:
|
||||
|
||||
1. 登录 [Apple Developer](https://developer.apple.com/account/)
|
||||
2. 点击右上角的账户信息
|
||||
3. 在 "Membership" 页面可以看到 "Team ID"
|
||||
- 格式: 10 个字符,例如: `A1B2C3D4E5`
|
||||
|
||||
**添加到 GitHub**: 输入 Team ID,例如 `A1B2C3D4E5`
|
||||
|
||||
---
|
||||
|
||||
### 4. IOS_SIGNING_IDENTITY
|
||||
|
||||
**含义**: 签名身份,即证书在钥匙串中显示的完整名称
|
||||
|
||||
**获取方法**:
|
||||
|
||||
**方法一: 从钥匙串查看**:
|
||||
1. 打开 "钥匙串访问" 应用
|
||||
2. 找到你的 Apple Distribution 证书
|
||||
3. 右键点击 → "显示简介"
|
||||
4. 查看完整名称,类似:
|
||||
- `Apple Distribution: Your Name (A1B2C3D4E5)`
|
||||
- 或 `iPhone Distribution: Your Name (A1B2C3D4E5)`
|
||||
|
||||
**方法二: 使用命令行**:
|
||||
```bash
|
||||
security find-identity -v -p codesigning
|
||||
```
|
||||
|
||||
输出类似:
|
||||
```
|
||||
1) ABC123DEF456 "Apple Distribution: Your Name (A1B2C3D4E5)"
|
||||
```
|
||||
|
||||
引号中的内容就是 Signing Identity。
|
||||
|
||||
**添加到 GitHub**: 输入完整名称,例如:
|
||||
```
|
||||
Apple Distribution: Your Name (A1B2C3D4E5)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 5. IOS_PROVISIONING_PROFILE
|
||||
|
||||
**含义**: Provisioning Profile 的 Base64 编码,用于授权应用在特定设备上运行
|
||||
|
||||
**为什么需要**: Provisioning Profile 包含了应用 ID、开发者证书和设备 UDID 的绑定关系。
|
||||
|
||||
**获取方法**:
|
||||
|
||||
#### 步骤 1: 创建 Provisioning Profile
|
||||
|
||||
1. 登录 [Apple Developer](https://developer.apple.com/account/)
|
||||
2. 进入 "Certificates, Identifiers & Profiles"
|
||||
3. 点击 "Profiles" → "+" 创建新的 Profile
|
||||
4. 选择类型:
|
||||
- "App Store" 用于发布到 App Store
|
||||
- "Ad Hoc" 用于内部测试
|
||||
5. 选择 App ID (你的应用 Bundle ID)
|
||||
6. 选择证书
|
||||
7. 选择设备 (Ad Hoc 需要,App Store 不需要)
|
||||
8. 命名并下载 Profile (.mobileprovision 文件)
|
||||
|
||||
#### 步骤 2: 转换为 Base64
|
||||
|
||||
**macOS/Linux**:
|
||||
```bash
|
||||
base64 -i UUVPN.mobileprovision -o profile.base64
|
||||
```
|
||||
|
||||
**Windows (PowerShell)**:
|
||||
```powershell
|
||||
[Convert]::ToBase64String([IO.File]::ReadAllBytes("UUVPN.mobileprovision")) | Out-File profile.base64 -Encoding UTF8
|
||||
```
|
||||
|
||||
#### 步骤 3: 添加到 GitHub
|
||||
|
||||
1. 打开生成的 `profile.base64` 文件
|
||||
2. 复制全部内容
|
||||
3. 在 GitHub 仓库中添加 Secret,名称为 `IOS_PROVISIONING_PROFILE`
|
||||
|
||||
---
|
||||
|
||||
## 🚀 App Store Connect Secrets (可选)
|
||||
|
||||
这些 Secrets 用于自动上传 IPA 到 TestFlight。
|
||||
|
||||
### 1. APP_STORE_CONNECT_ISSUER_ID
|
||||
|
||||
**含义**: App Store Connect API 的 Issuer ID
|
||||
|
||||
**获取方法**:
|
||||
|
||||
1. 登录 [App Store Connect](https://appstoreconnect.apple.com/)
|
||||
2. 点击右上角用户名 → "Access"
|
||||
3. 选择 "Keys" 标签
|
||||
4. 在页面顶部可以看到 "Issuer ID"
|
||||
- 格式类似: `12345678-1234-1234-1234-123456789012`
|
||||
|
||||
**添加到 GitHub**: 输入 Issuer ID
|
||||
|
||||
---
|
||||
|
||||
### 2. APP_STORE_CONNECT_API_KEY_ID
|
||||
|
||||
**含义**: App Store Connect API Key ID
|
||||
|
||||
**获取方法**:
|
||||
|
||||
1. 在 App Store Connect 的 "Keys" 页面
|
||||
2. 点击 "+" 创建新的 API Key
|
||||
3. 输入名称,选择权限:
|
||||
- "App Manager" 权限足够用于上传构建版本
|
||||
4. 创建后会显示 Key ID
|
||||
- 格式类似: `AB12CD34EF`
|
||||
|
||||
**添加到 GitHub**: 输入 Key ID
|
||||
|
||||
---
|
||||
|
||||
### 3. APP_STORE_CONNECT_API_PRIVATE_KEY
|
||||
|
||||
**含义**: App Store Connect API 的私钥内容
|
||||
|
||||
**获取方法**:
|
||||
|
||||
1. 创建 API Key 后,会提供下载 .p8 文件的机会
|
||||
2. **注意**: 私钥只能下载一次,请妥善保管!
|
||||
3. 下载后打开 .p8 文件,内容格式如下:
|
||||
```
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQg...
|
||||
(多行 Base64 编码内容)
|
||||
-----END PRIVATE KEY-----
|
||||
```
|
||||
|
||||
**添加到 GitHub**: 复制 .p8 文件的全部内容,包括开始和结束标记
|
||||
|
||||
---
|
||||
|
||||
## 📢 Telegram Secrets (可选)
|
||||
|
||||
这些 Secrets 用于发送构建通知到 Telegram。
|
||||
|
||||
### 1. TELEGRAM_BOT_TOKEN
|
||||
|
||||
**含义**: Telegram Bot 的访问令牌
|
||||
|
||||
**获取方法**:
|
||||
|
||||
1. 在 Telegram 中搜索 `@BotFather`
|
||||
2. 发送 `/newbot` 命令
|
||||
3. 按提示输入 Bot 名称和用户名
|
||||
4. 创建成功后,会收到 Bot Token
|
||||
- 格式类似: `1234567890:ABCdefGHIjklMNOpqrsTUVwxyz`
|
||||
|
||||
**添加到 GitHub**: 输入 Bot Token
|
||||
|
||||
---
|
||||
|
||||
### 2. TELEGRAM_CHAT_ID
|
||||
|
||||
**含义**: 接收通知的 Telegram 群组或频道 ID
|
||||
|
||||
**获取方法**:
|
||||
|
||||
#### 步骤 1: 创建群组或频道
|
||||
|
||||
1. 在 Telegram 中创建群组或频道
|
||||
2. 邀请你的 Bot 加入群组/频道
|
||||
3. 给 Bot 发送管理员权限
|
||||
|
||||
#### 步骤 2: 获取 Chat ID
|
||||
|
||||
**方法一: 使用 API**:
|
||||
1. 在群组中发送一条消息
|
||||
2. 在浏览器访问:
|
||||
```
|
||||
https://api.telegram.org/bot<你的BOT_TOKEN>/getUpdates
|
||||
```
|
||||
3. 在返回的 JSON 中找到 `"chat":{"id": -123456789}`
|
||||
4. 这个 ID 就是 Chat ID
|
||||
|
||||
**方法二: 使用 @userinfobot**:
|
||||
1. 在 Telegram 中搜索 `@userinfobot`
|
||||
2. 将其加入群组
|
||||
3. 它会自动发送群组信息,包含 Chat ID
|
||||
|
||||
**添加到 GitHub**: 输入 Chat ID (注意负号,例如 `-123456789`)
|
||||
|
||||
---
|
||||
|
||||
## 📝 快速配置清单
|
||||
|
||||
### Debug 构建 (测试用)
|
||||
|
||||
**Android Debug 构建**: ✅ 无需配置任何 Secrets
|
||||
|
||||
**iOS Debug 构建**: ✅ 无需配置任何 Secrets
|
||||
|
||||
### Release 构建 (发布用)
|
||||
|
||||
**Android Release**:
|
||||
- [ ] ANDROID_KEYSTORE_BASE64
|
||||
- [ ] ANDROID_KEYSTORE_PASSWORD
|
||||
- [ ] ANDROID_KEY_ALIAS
|
||||
- [ ] ANDROID_KEY_PASSWORD
|
||||
|
||||
**iOS Release**:
|
||||
- [ ] IOS_CERTIFICATES_P12
|
||||
- [ ] IOS_CERTIFICATES_PASSWORD
|
||||
- [ ] IOS_TEAM_ID
|
||||
- [ ] IOS_SIGNING_IDENTITY
|
||||
- [ ] IOS_PROVISIONING_PROFILE
|
||||
|
||||
**TestFlight 自动上传 (可选)**:
|
||||
- [ ] APP_STORE_CONNECT_ISSUER_ID
|
||||
- [ ] APP_STORE_CONNECT_API_KEY_ID
|
||||
- [ ] APP_STORE_CONNECT_API_PRIVATE_KEY
|
||||
|
||||
**通知 (可选)**:
|
||||
- [ ] TELEGRAM_BOT_TOKEN
|
||||
- [ ] TELEGRAM_CHAT_ID
|
||||
|
||||
---
|
||||
|
||||
## 🔐 安全建议
|
||||
|
||||
1. **定期更新密钥**:
|
||||
- 建议每年更新一次签名密钥和证书
|
||||
- API Key 如果泄露,立即撤销并重新生成
|
||||
|
||||
2. **限制权限**:
|
||||
- App Store Connect API Key 使用 "App Manager" 权限即可,不要使用更高权限
|
||||
|
||||
3. **妥善保管**:
|
||||
- 签名密钥库 (.keystore) 要备份到安全的地方
|
||||
- 私钥文件 (.p8) 丢失后无法恢复
|
||||
|
||||
4. **不要泄露**:
|
||||
- 不要在代码中硬编码任何密钥
|
||||
- 不要将密钥文件提交到公开仓库
|
||||
|
||||
5. **使用 GitHub Environments**:
|
||||
- 可以为不同的环境 (开发/测试/生产) 配置不同的 Secrets
|
||||
- 可以设置需要审批才能使用生产环境的 Secrets
|
||||
|
||||
---
|
||||
|
||||
## ❓ 常见问题
|
||||
|
||||
### Q1: 我没有 Apple Developer 账号,可以构建 iOS 应用吗?
|
||||
|
||||
**A**: 可以构建 Debug 版本(模拟器运行),但无法:
|
||||
- 在真机上运行
|
||||
- 发布到 App Store
|
||||
- 上传到 TestFlight
|
||||
|
||||
### Q2: Android 签名密钥丢失了怎么办?
|
||||
|
||||
**A**: 无法恢复!必须:
|
||||
1. 生成新的签名密钥
|
||||
2. 更新应用包名 (否则无法更新已发布的应用)
|
||||
3. 重新发布应用
|
||||
|
||||
所以请务必备份密钥库文件!
|
||||
|
||||
### Q3: iOS 证书过期了怎么办?
|
||||
|
||||
**A**: 需要重新:
|
||||
1. 创建新的证书
|
||||
2. 创建新的 Provisioning Profile
|
||||
3. 更新 GitHub Secrets
|
||||
|
||||
### Q4: 可以使用同一个签名密钥发布多个应用吗?
|
||||
|
||||
**A**: 可以,但建议:
|
||||
- 每个应用使用不同的签名密钥
|
||||
- 提高安全性
|
||||
- 避免一个密钥泄露影响所有应用
|
||||
|
||||
### Q5: Provisioning Profile 需要包含哪些设备?
|
||||
|
||||
**A**:
|
||||
- **App Store Profile**: 不需要包含设备,任何设备都可以从 App Store 下载
|
||||
- **Ad Hoc Profile**: 需要包含用于测试的设备 UDID
|
||||
|
||||
---
|
||||
|
||||
## 📚 相关文档
|
||||
|
||||
- [Apple Developer Documentation](https://developer.apple.com/documentation/)
|
||||
- [Android App Signing](https://developer.android.com/studio/publish/app-signing)
|
||||
- [GitHub Actions Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets)
|
||||
- [App Store Connect API](https://developer.apple.com/documentation/appstoreconnectapi)
|
||||
|
||||
---
|
||||
|
||||
**配置完成后,就可以享受自动化的 CI/CD 流程了! 🎉**
|
||||
Binary file not shown.
Binary file not shown.
+4
-6
@@ -1,8 +1,6 @@
|
||||
framework module "Libbox" {
|
||||
framework module Libbox {
|
||||
header "ref.h"
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "Libbox.h"
|
||||
|
||||
export *
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
export *
|
||||
}
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+4
-6
@@ -1,8 +1,6 @@
|
||||
framework module "Libbox" {
|
||||
framework module Libbox {
|
||||
header "ref.h"
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "Libbox.h"
|
||||
|
||||
export *
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
export *
|
||||
}
|
||||
Binary file not shown.
BIN
Binary file not shown.
+4
-6
@@ -1,8 +1,6 @@
|
||||
framework module "Libbox" {
|
||||
framework module Libbox {
|
||||
header "ref.h"
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "Libbox.h"
|
||||
|
||||
export *
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
export *
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
+4
-6
@@ -1,8 +1,6 @@
|
||||
framework module "Libbox" {
|
||||
framework module Libbox {
|
||||
header "ref.h"
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "Libbox.h"
|
||||
|
||||
export *
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
export *
|
||||
}
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+4
-6
@@ -1,8 +1,6 @@
|
||||
framework module "Libbox" {
|
||||
framework module Libbox {
|
||||
header "ref.h"
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "Libbox.h"
|
||||
|
||||
export *
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
export *
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AvailableLibraries</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>Libbox.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64_x86_64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>Libbox.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>simulator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>tvos-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>Libbox.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>tvos</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>macos-arm64_x86_64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>Libbox.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>macos</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>tvos-arm64_x86_64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>Libbox.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>tvos</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>simulator</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XFWK</string>
|
||||
<key>XCFrameworkFormatVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Headers
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Libbox
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Modules
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Resources
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/sagernet/sing-box/experimental/libbox
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __Libbox_FRAMEWORK_H__
|
||||
#define __Libbox_FRAMEWORK_H__
|
||||
|
||||
#include "Libbox.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
+811
@@ -0,0 +1,811 @@
|
||||
// Objective-C API for talking to github.com/sagernet/sing-box/experimental/libbox Go package.
|
||||
// gobind -lang=objc github.com/sagernet/sing-box/experimental/libbox
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Libbox_H__
|
||||
#define __Libbox_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class LibboxBoxService;
|
||||
@class LibboxCommandClient;
|
||||
@class LibboxCommandClientOptions;
|
||||
@class LibboxCommandServer;
|
||||
@class LibboxErrorMessage;
|
||||
@class LibboxExchangeContext;
|
||||
@class LibboxImportRemoteProfile;
|
||||
@class LibboxNetworkInterface;
|
||||
@class LibboxOutboundGroup;
|
||||
@class LibboxOutboundGroupItem;
|
||||
@class LibboxPProfServer;
|
||||
@class LibboxProfileContent;
|
||||
@class LibboxProfileContentRequest;
|
||||
@class LibboxProfileDecoder;
|
||||
@class LibboxProfileEncoder;
|
||||
@class LibboxProfilePreview;
|
||||
@class LibboxRoutePrefix;
|
||||
@class LibboxStatusMessage;
|
||||
@class LibboxSystemProxyStatus;
|
||||
@class LibboxWIFIState;
|
||||
@protocol LibboxCommandClientHandler;
|
||||
@class LibboxCommandClientHandler;
|
||||
@protocol LibboxCommandServerHandler;
|
||||
@class LibboxCommandServerHandler;
|
||||
@protocol LibboxFunc;
|
||||
@class LibboxFunc;
|
||||
@protocol LibboxHTTPClient;
|
||||
@class LibboxHTTPClient;
|
||||
@protocol LibboxHTTPRequest;
|
||||
@class LibboxHTTPRequest;
|
||||
@protocol LibboxHTTPResponse;
|
||||
@class LibboxHTTPResponse;
|
||||
@protocol LibboxInterfaceUpdateListener;
|
||||
@class LibboxInterfaceUpdateListener;
|
||||
@protocol LibboxLocalDNSTransport;
|
||||
@class LibboxLocalDNSTransport;
|
||||
@protocol LibboxNetworkInterfaceIterator;
|
||||
@class LibboxNetworkInterfaceIterator;
|
||||
@protocol LibboxOnDemandRule;
|
||||
@class LibboxOnDemandRule;
|
||||
@protocol LibboxOnDemandRuleIterator;
|
||||
@class LibboxOnDemandRuleIterator;
|
||||
@protocol LibboxOutboundGroupItemIterator;
|
||||
@class LibboxOutboundGroupItemIterator;
|
||||
@protocol LibboxOutboundGroupIterator;
|
||||
@class LibboxOutboundGroupIterator;
|
||||
@protocol LibboxPlatformInterface;
|
||||
@class LibboxPlatformInterface;
|
||||
@protocol LibboxProfilePreviewIterator;
|
||||
@class LibboxProfilePreviewIterator;
|
||||
@protocol LibboxRoutePrefixIterator;
|
||||
@class LibboxRoutePrefixIterator;
|
||||
@protocol LibboxStringIterator;
|
||||
@class LibboxStringIterator;
|
||||
@protocol LibboxTunInterface;
|
||||
@class LibboxTunInterface;
|
||||
@protocol LibboxTunOptions;
|
||||
@class LibboxTunOptions;
|
||||
|
||||
@protocol LibboxCommandClientHandler <NSObject>
|
||||
- (void)clearLog;
|
||||
- (void)connected;
|
||||
- (void)disconnected:(NSString* _Nullable)message;
|
||||
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
|
||||
- (void)updateClashMode:(NSString* _Nullable)newMode;
|
||||
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
|
||||
@end
|
||||
|
||||
@protocol LibboxCommandServerHandler <NSObject>
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
|
||||
- (void)postServiceClose;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxFunc <NSObject>
|
||||
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPClient <NSObject>
|
||||
- (void)close;
|
||||
- (void)keepAlive;
|
||||
- (void)modernTLS;
|
||||
- (id<LibboxHTTPRequest> _Nullable)newRequest;
|
||||
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
|
||||
- (void)pinnedTLS12;
|
||||
- (void)restrictedTLS;
|
||||
- (void)trySocks5:(int32_t)port;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPRequest <NSObject>
|
||||
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)randomUserAgent;
|
||||
- (void)setContent:(NSData* _Nullable)content;
|
||||
- (void)setContentString:(NSString* _Nullable)content;
|
||||
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
|
||||
- (void)setMethod:(NSString* _Nullable)method;
|
||||
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)setUserAgent:(NSString* _Nullable)userAgent;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPResponse <NSObject>
|
||||
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxInterfaceUpdateListener <NSObject>
|
||||
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
|
||||
@end
|
||||
|
||||
@protocol LibboxLocalDNSTransport <NSObject>
|
||||
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)raw;
|
||||
@end
|
||||
|
||||
@protocol LibboxNetworkInterfaceIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxNetworkInterface* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOnDemandRule <NSObject>
|
||||
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
|
||||
- (int32_t)interfaceTypeMatch;
|
||||
- (NSString* _Nonnull)probeURL;
|
||||
- (id<LibboxStringIterator> _Nullable)ssidMatch;
|
||||
- (int32_t)target;
|
||||
@end
|
||||
|
||||
@protocol LibboxOnDemandRuleIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (id<LibboxOnDemandRule> _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOutboundGroupItemIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroupItem* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOutboundGroupIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroup* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxPlatformInterface <NSObject>
|
||||
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)clearDNSCache;
|
||||
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)includeAllNetworks;
|
||||
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxWIFIState* _Nullable)readWIFIState;
|
||||
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)underNetworkExtension;
|
||||
- (BOOL)usePlatformAutoDetectInterfaceControl;
|
||||
- (BOOL)usePlatformDefaultInterfaceMonitor;
|
||||
- (BOOL)usePlatformInterfaceGetter;
|
||||
- (BOOL)useProcFS;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@protocol LibboxProfilePreviewIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxProfilePreview* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxRoutePrefixIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxRoutePrefix* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxStringIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (NSString* _Nonnull)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxTunInterface <NSObject>
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (int32_t)fileDescriptor;
|
||||
@end
|
||||
|
||||
@protocol LibboxTunOptions <NSObject>
|
||||
- (BOOL)getAutoRoute;
|
||||
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
|
||||
- (NSString* _Nonnull)getHTTPProxyServer;
|
||||
- (int32_t)getHTTPProxyServerPort;
|
||||
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
|
||||
- (int32_t)getMTU;
|
||||
- (BOOL)getStrictRoute;
|
||||
- (BOOL)isHTTPProxyEnabled;
|
||||
@end
|
||||
|
||||
@interface LibboxBoxService : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)needWIFIState;
|
||||
- (void)pause;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)wake;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandClient : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(id<LibboxCommandClientHandler> _Nullable)handler options:(LibboxCommandClientOptions* _Nullable)options;
|
||||
- (BOOL)closeConnections:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)connect:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)disconnect:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)selectOutbound:(NSString* _Nullable)groupTag outboundTag:(NSString* _Nullable)outboundTag error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)serviceClose:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setClashMode:(NSString* _Nullable)newMode error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setGroupExpand:(NSString* _Nullable)groupTag isExpand:(BOOL)isExpand error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)urlTest:(NSString* _Nullable)groupTag error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandClientOptions : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int32_t command;
|
||||
@property (nonatomic) int64_t statusInterval;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(id<LibboxCommandServerHandler> _Nullable)handler maxLines:(int32_t)maxLines;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)resetLog;
|
||||
- (void)setService:(LibboxBoxService* _Nullable)newService;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)writeMessage:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxErrorMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull message;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxExchangeContext : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (void)errnoCode:(int32_t)code;
|
||||
- (void)errorCode:(int32_t)code;
|
||||
- (void)onCancel:(id<LibboxFunc> _Nullable)callback;
|
||||
- (void)rawSuccess:(NSData* _Nullable)result;
|
||||
- (void)success:(NSString* _Nullable)result;
|
||||
@end
|
||||
|
||||
@interface LibboxImportRemoteProfile : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) NSString* _Nonnull url;
|
||||
@property (nonatomic) NSString* _Nonnull host;
|
||||
@end
|
||||
|
||||
@interface LibboxNetworkInterface : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int32_t index;
|
||||
@property (nonatomic) int32_t mtu;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) id<LibboxStringIterator> _Nullable addresses;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroup : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull tag;
|
||||
@property (nonatomic) NSString* _Nonnull type;
|
||||
@property (nonatomic) BOOL selectable;
|
||||
@property (nonatomic) NSString* _Nonnull selected;
|
||||
@property (nonatomic) BOOL isExpand;
|
||||
- (id<LibboxOutboundGroupItemIterator> _Nullable)getItems;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupItem : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull tag;
|
||||
@property (nonatomic) NSString* _Nonnull type;
|
||||
@property (nonatomic) int64_t urlTestTime;
|
||||
@property (nonatomic) int32_t urlTestDelay;
|
||||
@end
|
||||
|
||||
@interface LibboxPProfServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(long)port;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileContent : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) int32_t type;
|
||||
@property (nonatomic) NSString* _Nonnull config;
|
||||
@property (nonatomic) NSString* _Nonnull remotePath;
|
||||
@property (nonatomic) BOOL autoUpdate;
|
||||
@property (nonatomic) int32_t autoUpdateInterval;
|
||||
@property (nonatomic) int64_t lastUpdated;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileContentRequest : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t profileID;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileDecoder : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (BOOL)decode:(NSData* _Nullable)data error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxProfilePreviewIterator> _Nullable)iterator;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileEncoder : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (void)append:(LibboxProfilePreview* _Nullable)profile;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfilePreview : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t profileID;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) int32_t type;
|
||||
@end
|
||||
|
||||
@interface LibboxRoutePrefix : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (NSString* _Nonnull)address;
|
||||
- (NSString* _Nonnull)mask;
|
||||
- (int32_t)prefix;
|
||||
- (NSString* _Nonnull)string;
|
||||
@end
|
||||
|
||||
@interface LibboxStatusMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t memory;
|
||||
@property (nonatomic) int32_t goroutines;
|
||||
@property (nonatomic) int32_t connectionsIn;
|
||||
@property (nonatomic) int32_t connectionsOut;
|
||||
@property (nonatomic) BOOL trafficAvailable;
|
||||
@property (nonatomic) int64_t uplink;
|
||||
@property (nonatomic) int64_t downlink;
|
||||
@property (nonatomic) int64_t uplinkTotal;
|
||||
@property (nonatomic) int64_t downlinkTotal;
|
||||
@end
|
||||
|
||||
@interface LibboxSystemProxyStatus : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) BOOL available;
|
||||
@property (nonatomic) BOOL enabled;
|
||||
@end
|
||||
|
||||
@interface LibboxWIFIState : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(NSString* _Nullable)wifiSSID wifiBSSID:(NSString* _Nullable)wifiBSSID;
|
||||
@property (nonatomic) NSString* _Nonnull ssid;
|
||||
@property (nonatomic) NSString* _Nonnull bssid;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandClashMode;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandCloseConnections;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGetSystemProxyStatus;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGroup;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGroupExpand;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandLog;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSelectOutbound;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandServiceClose;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandServiceReload;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSetClashMode;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSetSystemProxyEnabled;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandStatus;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandURLTest;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeError;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContent;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContentRequest;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileList;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeLocal;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeRemote;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeiCloud;
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxCheckConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxClearServiceError(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxErrorMessage* _Nullable LibboxDecodeErrorMessage(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT int32_t LibboxDecodeLengthChunk(NSData* _Nullable data);
|
||||
|
||||
FOUNDATION_EXPORT LibboxProfileContent* _Nullable LibboxDecodeProfileContent(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT LibboxProfileContentRequest* _Nullable LibboxDecodeProfileContentRequest(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable LibboxEncodeChunkedMessage(NSData* _Nullable data);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatBytes(int64_t length);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatMemoryBytes(int64_t length);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxGenerateRemoteProfileImportLink(NSString* _Nullable name, NSString* _Nullable remoteURL);
|
||||
|
||||
FOUNDATION_EXPORT int32_t LibboxGetTunnelFileDescriptor(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewCommandClient(id<LibboxCommandClientHandler> _Nullable handler, LibboxCommandClientOptions* _Nullable options);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandServer* _Nullable LibboxNewCommandServer(id<LibboxCommandServerHandler> _Nullable handler, int32_t maxLines);
|
||||
|
||||
FOUNDATION_EXPORT id<LibboxHTTPClient> _Nullable LibboxNewHTTPClient(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxPProfServer* _Nullable LibboxNewPProfServer(long port);
|
||||
|
||||
FOUNDATION_EXPORT LibboxBoxService* _Nullable LibboxNewService(NSString* _Nullable configContent, id<LibboxPlatformInterface> _Nullable platformInterface, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewStandaloneCommandClient(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxWIFIState* _Nullable LibboxNewWIFIState(NSString* _Nullable wifiSSID, NSString* _Nullable wifiBSSID);
|
||||
|
||||
FOUNDATION_EXPORT LibboxImportRemoteProfile* _Nullable LibboxParseRemoteProfileImportLink(NSString* _Nullable importLink, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxProxyDisplayType(NSString* _Nullable proxyType);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxReadServiceError(NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxRedirectStderr(NSString* _Nullable path, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxRegisterLocalDNSTransport(id<LibboxLocalDNSTransport> _Nullable transport);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxSetMemoryLimit(BOOL enabled);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxSetup(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, BOOL isTVOS);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxSetupWithUsername(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, NSString* _Nullable username, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxVersion(void);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxWriteServiceError(NSString* _Nullable message, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class LibboxCommandClientHandler;
|
||||
|
||||
@class LibboxCommandServerHandler;
|
||||
|
||||
@class LibboxFunc;
|
||||
|
||||
@class LibboxHTTPClient;
|
||||
|
||||
@class LibboxHTTPRequest;
|
||||
|
||||
@class LibboxHTTPResponse;
|
||||
|
||||
@class LibboxInterfaceUpdateListener;
|
||||
|
||||
@class LibboxLocalDNSTransport;
|
||||
|
||||
@class LibboxNetworkInterfaceIterator;
|
||||
|
||||
@class LibboxOnDemandRule;
|
||||
|
||||
@class LibboxOnDemandRuleIterator;
|
||||
|
||||
@class LibboxOutboundGroupItemIterator;
|
||||
|
||||
@class LibboxOutboundGroupIterator;
|
||||
|
||||
@class LibboxPlatformInterface;
|
||||
|
||||
@class LibboxProfilePreviewIterator;
|
||||
|
||||
@class LibboxRoutePrefixIterator;
|
||||
|
||||
@class LibboxStringIterator;
|
||||
|
||||
@class LibboxTunInterface;
|
||||
|
||||
@class LibboxTunOptions;
|
||||
|
||||
@interface LibboxCommandClientHandler : NSObject <goSeqRefInterface, LibboxCommandClientHandler> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)clearLog;
|
||||
- (void)connected;
|
||||
- (void)disconnected:(NSString* _Nullable)message;
|
||||
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
|
||||
- (void)updateClashMode:(NSString* _Nullable)newMode;
|
||||
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandServerHandler : NSObject <goSeqRefInterface, LibboxCommandServerHandler> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
|
||||
- (void)postServiceClose;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxFunc : NSObject <goSeqRefInterface, LibboxFunc> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPClient : NSObject <goSeqRefInterface, LibboxHTTPClient> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)close;
|
||||
- (void)keepAlive;
|
||||
- (void)modernTLS;
|
||||
- (id<LibboxHTTPRequest> _Nullable)newRequest;
|
||||
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
|
||||
- (void)pinnedTLS12;
|
||||
- (void)restrictedTLS;
|
||||
- (void)trySocks5:(int32_t)port;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPRequest : NSObject <goSeqRefInterface, LibboxHTTPRequest> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)randomUserAgent;
|
||||
- (void)setContent:(NSData* _Nullable)content;
|
||||
- (void)setContentString:(NSString* _Nullable)content;
|
||||
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
|
||||
- (void)setMethod:(NSString* _Nullable)method;
|
||||
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)setUserAgent:(NSString* _Nullable)userAgent;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPResponse : NSObject <goSeqRefInterface, LibboxHTTPResponse> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxInterfaceUpdateListener : NSObject <goSeqRefInterface, LibboxInterfaceUpdateListener> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
|
||||
@end
|
||||
|
||||
@interface LibboxLocalDNSTransport : NSObject <goSeqRefInterface, LibboxLocalDNSTransport> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)raw;
|
||||
@end
|
||||
|
||||
@interface LibboxNetworkInterfaceIterator : NSObject <goSeqRefInterface, LibboxNetworkInterfaceIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxNetworkInterface* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOnDemandRule : NSObject <goSeqRefInterface, LibboxOnDemandRule> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
|
||||
- (int32_t)interfaceTypeMatch;
|
||||
- (NSString* _Nonnull)probeURL;
|
||||
- (id<LibboxStringIterator> _Nullable)ssidMatch;
|
||||
- (int32_t)target;
|
||||
@end
|
||||
|
||||
@interface LibboxOnDemandRuleIterator : NSObject <goSeqRefInterface, LibboxOnDemandRuleIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (id<LibboxOnDemandRule> _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupItemIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupItemIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroupItem* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroup* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxPlatformInterface : NSObject <goSeqRefInterface, LibboxPlatformInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)clearDNSCache;
|
||||
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)includeAllNetworks;
|
||||
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxWIFIState* _Nullable)readWIFIState;
|
||||
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)underNetworkExtension;
|
||||
- (BOOL)usePlatformAutoDetectInterfaceControl;
|
||||
- (BOOL)usePlatformDefaultInterfaceMonitor;
|
||||
- (BOOL)usePlatformInterfaceGetter;
|
||||
- (BOOL)useProcFS;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxProfilePreviewIterator : NSObject <goSeqRefInterface, LibboxProfilePreviewIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxProfilePreview* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxRoutePrefixIterator : NSObject <goSeqRefInterface, LibboxRoutePrefixIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxRoutePrefix* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxStringIterator : NSObject <goSeqRefInterface, LibboxStringIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (NSString* _Nonnull)next;
|
||||
@end
|
||||
|
||||
@interface LibboxTunInterface : NSObject <goSeqRefInterface, LibboxTunInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (int32_t)fileDescriptor;
|
||||
@end
|
||||
|
||||
@interface LibboxTunOptions : NSObject <goSeqRefInterface, LibboxTunOptions> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)getAutoRoute;
|
||||
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
|
||||
- (NSString* _Nonnull)getHTTPProxyServer;
|
||||
- (int32_t)getHTTPProxyServerPort;
|
||||
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
|
||||
- (int32_t)getMTU;
|
||||
- (BOOL)getStrictRoute;
|
||||
- (BOOL)isHTTPProxyEnabled;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
framework module Libbox {
|
||||
header "ref.h"
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
export *
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
||||
+1
@@ -0,0 +1 @@
|
||||
A
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Headers
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Libbox
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Modules
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Resources
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/sagernet/sing-box/experimental/libbox
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __Libbox_FRAMEWORK_H__
|
||||
#define __Libbox_FRAMEWORK_H__
|
||||
|
||||
#include "Libbox.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
+811
@@ -0,0 +1,811 @@
|
||||
// Objective-C API for talking to github.com/sagernet/sing-box/experimental/libbox Go package.
|
||||
// gobind -lang=objc github.com/sagernet/sing-box/experimental/libbox
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Libbox_H__
|
||||
#define __Libbox_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class LibboxBoxService;
|
||||
@class LibboxCommandClient;
|
||||
@class LibboxCommandClientOptions;
|
||||
@class LibboxCommandServer;
|
||||
@class LibboxErrorMessage;
|
||||
@class LibboxExchangeContext;
|
||||
@class LibboxImportRemoteProfile;
|
||||
@class LibboxNetworkInterface;
|
||||
@class LibboxOutboundGroup;
|
||||
@class LibboxOutboundGroupItem;
|
||||
@class LibboxPProfServer;
|
||||
@class LibboxProfileContent;
|
||||
@class LibboxProfileContentRequest;
|
||||
@class LibboxProfileDecoder;
|
||||
@class LibboxProfileEncoder;
|
||||
@class LibboxProfilePreview;
|
||||
@class LibboxRoutePrefix;
|
||||
@class LibboxStatusMessage;
|
||||
@class LibboxSystemProxyStatus;
|
||||
@class LibboxWIFIState;
|
||||
@protocol LibboxCommandClientHandler;
|
||||
@class LibboxCommandClientHandler;
|
||||
@protocol LibboxCommandServerHandler;
|
||||
@class LibboxCommandServerHandler;
|
||||
@protocol LibboxFunc;
|
||||
@class LibboxFunc;
|
||||
@protocol LibboxHTTPClient;
|
||||
@class LibboxHTTPClient;
|
||||
@protocol LibboxHTTPRequest;
|
||||
@class LibboxHTTPRequest;
|
||||
@protocol LibboxHTTPResponse;
|
||||
@class LibboxHTTPResponse;
|
||||
@protocol LibboxInterfaceUpdateListener;
|
||||
@class LibboxInterfaceUpdateListener;
|
||||
@protocol LibboxLocalDNSTransport;
|
||||
@class LibboxLocalDNSTransport;
|
||||
@protocol LibboxNetworkInterfaceIterator;
|
||||
@class LibboxNetworkInterfaceIterator;
|
||||
@protocol LibboxOnDemandRule;
|
||||
@class LibboxOnDemandRule;
|
||||
@protocol LibboxOnDemandRuleIterator;
|
||||
@class LibboxOnDemandRuleIterator;
|
||||
@protocol LibboxOutboundGroupItemIterator;
|
||||
@class LibboxOutboundGroupItemIterator;
|
||||
@protocol LibboxOutboundGroupIterator;
|
||||
@class LibboxOutboundGroupIterator;
|
||||
@protocol LibboxPlatformInterface;
|
||||
@class LibboxPlatformInterface;
|
||||
@protocol LibboxProfilePreviewIterator;
|
||||
@class LibboxProfilePreviewIterator;
|
||||
@protocol LibboxRoutePrefixIterator;
|
||||
@class LibboxRoutePrefixIterator;
|
||||
@protocol LibboxStringIterator;
|
||||
@class LibboxStringIterator;
|
||||
@protocol LibboxTunInterface;
|
||||
@class LibboxTunInterface;
|
||||
@protocol LibboxTunOptions;
|
||||
@class LibboxTunOptions;
|
||||
|
||||
@protocol LibboxCommandClientHandler <NSObject>
|
||||
- (void)clearLog;
|
||||
- (void)connected;
|
||||
- (void)disconnected:(NSString* _Nullable)message;
|
||||
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
|
||||
- (void)updateClashMode:(NSString* _Nullable)newMode;
|
||||
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
|
||||
@end
|
||||
|
||||
@protocol LibboxCommandServerHandler <NSObject>
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
|
||||
- (void)postServiceClose;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxFunc <NSObject>
|
||||
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPClient <NSObject>
|
||||
- (void)close;
|
||||
- (void)keepAlive;
|
||||
- (void)modernTLS;
|
||||
- (id<LibboxHTTPRequest> _Nullable)newRequest;
|
||||
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
|
||||
- (void)pinnedTLS12;
|
||||
- (void)restrictedTLS;
|
||||
- (void)trySocks5:(int32_t)port;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPRequest <NSObject>
|
||||
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)randomUserAgent;
|
||||
- (void)setContent:(NSData* _Nullable)content;
|
||||
- (void)setContentString:(NSString* _Nullable)content;
|
||||
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
|
||||
- (void)setMethod:(NSString* _Nullable)method;
|
||||
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)setUserAgent:(NSString* _Nullable)userAgent;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPResponse <NSObject>
|
||||
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxInterfaceUpdateListener <NSObject>
|
||||
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
|
||||
@end
|
||||
|
||||
@protocol LibboxLocalDNSTransport <NSObject>
|
||||
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)raw;
|
||||
@end
|
||||
|
||||
@protocol LibboxNetworkInterfaceIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxNetworkInterface* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOnDemandRule <NSObject>
|
||||
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
|
||||
- (int32_t)interfaceTypeMatch;
|
||||
- (NSString* _Nonnull)probeURL;
|
||||
- (id<LibboxStringIterator> _Nullable)ssidMatch;
|
||||
- (int32_t)target;
|
||||
@end
|
||||
|
||||
@protocol LibboxOnDemandRuleIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (id<LibboxOnDemandRule> _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOutboundGroupItemIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroupItem* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOutboundGroupIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroup* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxPlatformInterface <NSObject>
|
||||
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)clearDNSCache;
|
||||
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)includeAllNetworks;
|
||||
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxWIFIState* _Nullable)readWIFIState;
|
||||
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)underNetworkExtension;
|
||||
- (BOOL)usePlatformAutoDetectInterfaceControl;
|
||||
- (BOOL)usePlatformDefaultInterfaceMonitor;
|
||||
- (BOOL)usePlatformInterfaceGetter;
|
||||
- (BOOL)useProcFS;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@protocol LibboxProfilePreviewIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxProfilePreview* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxRoutePrefixIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxRoutePrefix* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxStringIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (NSString* _Nonnull)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxTunInterface <NSObject>
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (int32_t)fileDescriptor;
|
||||
@end
|
||||
|
||||
@protocol LibboxTunOptions <NSObject>
|
||||
- (BOOL)getAutoRoute;
|
||||
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
|
||||
- (NSString* _Nonnull)getHTTPProxyServer;
|
||||
- (int32_t)getHTTPProxyServerPort;
|
||||
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
|
||||
- (int32_t)getMTU;
|
||||
- (BOOL)getStrictRoute;
|
||||
- (BOOL)isHTTPProxyEnabled;
|
||||
@end
|
||||
|
||||
@interface LibboxBoxService : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)needWIFIState;
|
||||
- (void)pause;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)wake;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandClient : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(id<LibboxCommandClientHandler> _Nullable)handler options:(LibboxCommandClientOptions* _Nullable)options;
|
||||
- (BOOL)closeConnections:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)connect:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)disconnect:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)selectOutbound:(NSString* _Nullable)groupTag outboundTag:(NSString* _Nullable)outboundTag error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)serviceClose:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setClashMode:(NSString* _Nullable)newMode error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setGroupExpand:(NSString* _Nullable)groupTag isExpand:(BOOL)isExpand error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)urlTest:(NSString* _Nullable)groupTag error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandClientOptions : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int32_t command;
|
||||
@property (nonatomic) int64_t statusInterval;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(id<LibboxCommandServerHandler> _Nullable)handler maxLines:(int32_t)maxLines;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)resetLog;
|
||||
- (void)setService:(LibboxBoxService* _Nullable)newService;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)writeMessage:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxErrorMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull message;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxExchangeContext : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (void)errnoCode:(int32_t)code;
|
||||
- (void)errorCode:(int32_t)code;
|
||||
- (void)onCancel:(id<LibboxFunc> _Nullable)callback;
|
||||
- (void)rawSuccess:(NSData* _Nullable)result;
|
||||
- (void)success:(NSString* _Nullable)result;
|
||||
@end
|
||||
|
||||
@interface LibboxImportRemoteProfile : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) NSString* _Nonnull url;
|
||||
@property (nonatomic) NSString* _Nonnull host;
|
||||
@end
|
||||
|
||||
@interface LibboxNetworkInterface : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int32_t index;
|
||||
@property (nonatomic) int32_t mtu;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) id<LibboxStringIterator> _Nullable addresses;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroup : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull tag;
|
||||
@property (nonatomic) NSString* _Nonnull type;
|
||||
@property (nonatomic) BOOL selectable;
|
||||
@property (nonatomic) NSString* _Nonnull selected;
|
||||
@property (nonatomic) BOOL isExpand;
|
||||
- (id<LibboxOutboundGroupItemIterator> _Nullable)getItems;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupItem : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull tag;
|
||||
@property (nonatomic) NSString* _Nonnull type;
|
||||
@property (nonatomic) int64_t urlTestTime;
|
||||
@property (nonatomic) int32_t urlTestDelay;
|
||||
@end
|
||||
|
||||
@interface LibboxPProfServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(long)port;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileContent : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) int32_t type;
|
||||
@property (nonatomic) NSString* _Nonnull config;
|
||||
@property (nonatomic) NSString* _Nonnull remotePath;
|
||||
@property (nonatomic) BOOL autoUpdate;
|
||||
@property (nonatomic) int32_t autoUpdateInterval;
|
||||
@property (nonatomic) int64_t lastUpdated;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileContentRequest : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t profileID;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileDecoder : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (BOOL)decode:(NSData* _Nullable)data error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxProfilePreviewIterator> _Nullable)iterator;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileEncoder : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (void)append:(LibboxProfilePreview* _Nullable)profile;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfilePreview : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t profileID;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) int32_t type;
|
||||
@end
|
||||
|
||||
@interface LibboxRoutePrefix : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (NSString* _Nonnull)address;
|
||||
- (NSString* _Nonnull)mask;
|
||||
- (int32_t)prefix;
|
||||
- (NSString* _Nonnull)string;
|
||||
@end
|
||||
|
||||
@interface LibboxStatusMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t memory;
|
||||
@property (nonatomic) int32_t goroutines;
|
||||
@property (nonatomic) int32_t connectionsIn;
|
||||
@property (nonatomic) int32_t connectionsOut;
|
||||
@property (nonatomic) BOOL trafficAvailable;
|
||||
@property (nonatomic) int64_t uplink;
|
||||
@property (nonatomic) int64_t downlink;
|
||||
@property (nonatomic) int64_t uplinkTotal;
|
||||
@property (nonatomic) int64_t downlinkTotal;
|
||||
@end
|
||||
|
||||
@interface LibboxSystemProxyStatus : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) BOOL available;
|
||||
@property (nonatomic) BOOL enabled;
|
||||
@end
|
||||
|
||||
@interface LibboxWIFIState : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(NSString* _Nullable)wifiSSID wifiBSSID:(NSString* _Nullable)wifiBSSID;
|
||||
@property (nonatomic) NSString* _Nonnull ssid;
|
||||
@property (nonatomic) NSString* _Nonnull bssid;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandClashMode;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandCloseConnections;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGetSystemProxyStatus;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGroup;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGroupExpand;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandLog;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSelectOutbound;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandServiceClose;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandServiceReload;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSetClashMode;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSetSystemProxyEnabled;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandStatus;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandURLTest;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeError;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContent;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContentRequest;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileList;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeLocal;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeRemote;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeiCloud;
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxCheckConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxClearServiceError(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxErrorMessage* _Nullable LibboxDecodeErrorMessage(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT int32_t LibboxDecodeLengthChunk(NSData* _Nullable data);
|
||||
|
||||
FOUNDATION_EXPORT LibboxProfileContent* _Nullable LibboxDecodeProfileContent(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT LibboxProfileContentRequest* _Nullable LibboxDecodeProfileContentRequest(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable LibboxEncodeChunkedMessage(NSData* _Nullable data);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatBytes(int64_t length);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatMemoryBytes(int64_t length);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxGenerateRemoteProfileImportLink(NSString* _Nullable name, NSString* _Nullable remoteURL);
|
||||
|
||||
FOUNDATION_EXPORT int32_t LibboxGetTunnelFileDescriptor(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewCommandClient(id<LibboxCommandClientHandler> _Nullable handler, LibboxCommandClientOptions* _Nullable options);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandServer* _Nullable LibboxNewCommandServer(id<LibboxCommandServerHandler> _Nullable handler, int32_t maxLines);
|
||||
|
||||
FOUNDATION_EXPORT id<LibboxHTTPClient> _Nullable LibboxNewHTTPClient(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxPProfServer* _Nullable LibboxNewPProfServer(long port);
|
||||
|
||||
FOUNDATION_EXPORT LibboxBoxService* _Nullable LibboxNewService(NSString* _Nullable configContent, id<LibboxPlatformInterface> _Nullable platformInterface, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewStandaloneCommandClient(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxWIFIState* _Nullable LibboxNewWIFIState(NSString* _Nullable wifiSSID, NSString* _Nullable wifiBSSID);
|
||||
|
||||
FOUNDATION_EXPORT LibboxImportRemoteProfile* _Nullable LibboxParseRemoteProfileImportLink(NSString* _Nullable importLink, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxProxyDisplayType(NSString* _Nullable proxyType);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxReadServiceError(NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxRedirectStderr(NSString* _Nullable path, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxRegisterLocalDNSTransport(id<LibboxLocalDNSTransport> _Nullable transport);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxSetMemoryLimit(BOOL enabled);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxSetup(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, BOOL isTVOS);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxSetupWithUsername(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, NSString* _Nullable username, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxVersion(void);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxWriteServiceError(NSString* _Nullable message, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class LibboxCommandClientHandler;
|
||||
|
||||
@class LibboxCommandServerHandler;
|
||||
|
||||
@class LibboxFunc;
|
||||
|
||||
@class LibboxHTTPClient;
|
||||
|
||||
@class LibboxHTTPRequest;
|
||||
|
||||
@class LibboxHTTPResponse;
|
||||
|
||||
@class LibboxInterfaceUpdateListener;
|
||||
|
||||
@class LibboxLocalDNSTransport;
|
||||
|
||||
@class LibboxNetworkInterfaceIterator;
|
||||
|
||||
@class LibboxOnDemandRule;
|
||||
|
||||
@class LibboxOnDemandRuleIterator;
|
||||
|
||||
@class LibboxOutboundGroupItemIterator;
|
||||
|
||||
@class LibboxOutboundGroupIterator;
|
||||
|
||||
@class LibboxPlatformInterface;
|
||||
|
||||
@class LibboxProfilePreviewIterator;
|
||||
|
||||
@class LibboxRoutePrefixIterator;
|
||||
|
||||
@class LibboxStringIterator;
|
||||
|
||||
@class LibboxTunInterface;
|
||||
|
||||
@class LibboxTunOptions;
|
||||
|
||||
@interface LibboxCommandClientHandler : NSObject <goSeqRefInterface, LibboxCommandClientHandler> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)clearLog;
|
||||
- (void)connected;
|
||||
- (void)disconnected:(NSString* _Nullable)message;
|
||||
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
|
||||
- (void)updateClashMode:(NSString* _Nullable)newMode;
|
||||
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandServerHandler : NSObject <goSeqRefInterface, LibboxCommandServerHandler> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
|
||||
- (void)postServiceClose;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxFunc : NSObject <goSeqRefInterface, LibboxFunc> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPClient : NSObject <goSeqRefInterface, LibboxHTTPClient> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)close;
|
||||
- (void)keepAlive;
|
||||
- (void)modernTLS;
|
||||
- (id<LibboxHTTPRequest> _Nullable)newRequest;
|
||||
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
|
||||
- (void)pinnedTLS12;
|
||||
- (void)restrictedTLS;
|
||||
- (void)trySocks5:(int32_t)port;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPRequest : NSObject <goSeqRefInterface, LibboxHTTPRequest> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)randomUserAgent;
|
||||
- (void)setContent:(NSData* _Nullable)content;
|
||||
- (void)setContentString:(NSString* _Nullable)content;
|
||||
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
|
||||
- (void)setMethod:(NSString* _Nullable)method;
|
||||
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)setUserAgent:(NSString* _Nullable)userAgent;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPResponse : NSObject <goSeqRefInterface, LibboxHTTPResponse> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxInterfaceUpdateListener : NSObject <goSeqRefInterface, LibboxInterfaceUpdateListener> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
|
||||
@end
|
||||
|
||||
@interface LibboxLocalDNSTransport : NSObject <goSeqRefInterface, LibboxLocalDNSTransport> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)raw;
|
||||
@end
|
||||
|
||||
@interface LibboxNetworkInterfaceIterator : NSObject <goSeqRefInterface, LibboxNetworkInterfaceIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxNetworkInterface* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOnDemandRule : NSObject <goSeqRefInterface, LibboxOnDemandRule> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
|
||||
- (int32_t)interfaceTypeMatch;
|
||||
- (NSString* _Nonnull)probeURL;
|
||||
- (id<LibboxStringIterator> _Nullable)ssidMatch;
|
||||
- (int32_t)target;
|
||||
@end
|
||||
|
||||
@interface LibboxOnDemandRuleIterator : NSObject <goSeqRefInterface, LibboxOnDemandRuleIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (id<LibboxOnDemandRule> _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupItemIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupItemIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroupItem* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroup* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxPlatformInterface : NSObject <goSeqRefInterface, LibboxPlatformInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)clearDNSCache;
|
||||
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)includeAllNetworks;
|
||||
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxWIFIState* _Nullable)readWIFIState;
|
||||
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)underNetworkExtension;
|
||||
- (BOOL)usePlatformAutoDetectInterfaceControl;
|
||||
- (BOOL)usePlatformDefaultInterfaceMonitor;
|
||||
- (BOOL)usePlatformInterfaceGetter;
|
||||
- (BOOL)useProcFS;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxProfilePreviewIterator : NSObject <goSeqRefInterface, LibboxProfilePreviewIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxProfilePreview* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxRoutePrefixIterator : NSObject <goSeqRefInterface, LibboxRoutePrefixIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxRoutePrefix* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxStringIterator : NSObject <goSeqRefInterface, LibboxStringIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (NSString* _Nonnull)next;
|
||||
@end
|
||||
|
||||
@interface LibboxTunInterface : NSObject <goSeqRefInterface, LibboxTunInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (int32_t)fileDescriptor;
|
||||
@end
|
||||
|
||||
@interface LibboxTunOptions : NSObject <goSeqRefInterface, LibboxTunOptions> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)getAutoRoute;
|
||||
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
|
||||
- (NSString* _Nonnull)getHTTPProxyServer;
|
||||
- (int32_t)getHTTPProxyServerPort;
|
||||
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
|
||||
- (int32_t)getMTU;
|
||||
- (BOOL)getStrictRoute;
|
||||
- (BOOL)isHTTPProxyEnabled;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
framework module Libbox {
|
||||
header "ref.h"
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
export *
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
||||
+1
@@ -0,0 +1 @@
|
||||
A
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Headers
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Libbox
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Modules
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Resources
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/sagernet/sing-box/experimental/libbox
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __Libbox_FRAMEWORK_H__
|
||||
#define __Libbox_FRAMEWORK_H__
|
||||
|
||||
#include "Libbox.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
+811
@@ -0,0 +1,811 @@
|
||||
// Objective-C API for talking to github.com/sagernet/sing-box/experimental/libbox Go package.
|
||||
// gobind -lang=objc github.com/sagernet/sing-box/experimental/libbox
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Libbox_H__
|
||||
#define __Libbox_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class LibboxBoxService;
|
||||
@class LibboxCommandClient;
|
||||
@class LibboxCommandClientOptions;
|
||||
@class LibboxCommandServer;
|
||||
@class LibboxErrorMessage;
|
||||
@class LibboxExchangeContext;
|
||||
@class LibboxImportRemoteProfile;
|
||||
@class LibboxNetworkInterface;
|
||||
@class LibboxOutboundGroup;
|
||||
@class LibboxOutboundGroupItem;
|
||||
@class LibboxPProfServer;
|
||||
@class LibboxProfileContent;
|
||||
@class LibboxProfileContentRequest;
|
||||
@class LibboxProfileDecoder;
|
||||
@class LibboxProfileEncoder;
|
||||
@class LibboxProfilePreview;
|
||||
@class LibboxRoutePrefix;
|
||||
@class LibboxStatusMessage;
|
||||
@class LibboxSystemProxyStatus;
|
||||
@class LibboxWIFIState;
|
||||
@protocol LibboxCommandClientHandler;
|
||||
@class LibboxCommandClientHandler;
|
||||
@protocol LibboxCommandServerHandler;
|
||||
@class LibboxCommandServerHandler;
|
||||
@protocol LibboxFunc;
|
||||
@class LibboxFunc;
|
||||
@protocol LibboxHTTPClient;
|
||||
@class LibboxHTTPClient;
|
||||
@protocol LibboxHTTPRequest;
|
||||
@class LibboxHTTPRequest;
|
||||
@protocol LibboxHTTPResponse;
|
||||
@class LibboxHTTPResponse;
|
||||
@protocol LibboxInterfaceUpdateListener;
|
||||
@class LibboxInterfaceUpdateListener;
|
||||
@protocol LibboxLocalDNSTransport;
|
||||
@class LibboxLocalDNSTransport;
|
||||
@protocol LibboxNetworkInterfaceIterator;
|
||||
@class LibboxNetworkInterfaceIterator;
|
||||
@protocol LibboxOnDemandRule;
|
||||
@class LibboxOnDemandRule;
|
||||
@protocol LibboxOnDemandRuleIterator;
|
||||
@class LibboxOnDemandRuleIterator;
|
||||
@protocol LibboxOutboundGroupItemIterator;
|
||||
@class LibboxOutboundGroupItemIterator;
|
||||
@protocol LibboxOutboundGroupIterator;
|
||||
@class LibboxOutboundGroupIterator;
|
||||
@protocol LibboxPlatformInterface;
|
||||
@class LibboxPlatformInterface;
|
||||
@protocol LibboxProfilePreviewIterator;
|
||||
@class LibboxProfilePreviewIterator;
|
||||
@protocol LibboxRoutePrefixIterator;
|
||||
@class LibboxRoutePrefixIterator;
|
||||
@protocol LibboxStringIterator;
|
||||
@class LibboxStringIterator;
|
||||
@protocol LibboxTunInterface;
|
||||
@class LibboxTunInterface;
|
||||
@protocol LibboxTunOptions;
|
||||
@class LibboxTunOptions;
|
||||
|
||||
@protocol LibboxCommandClientHandler <NSObject>
|
||||
- (void)clearLog;
|
||||
- (void)connected;
|
||||
- (void)disconnected:(NSString* _Nullable)message;
|
||||
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
|
||||
- (void)updateClashMode:(NSString* _Nullable)newMode;
|
||||
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
|
||||
@end
|
||||
|
||||
@protocol LibboxCommandServerHandler <NSObject>
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
|
||||
- (void)postServiceClose;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxFunc <NSObject>
|
||||
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPClient <NSObject>
|
||||
- (void)close;
|
||||
- (void)keepAlive;
|
||||
- (void)modernTLS;
|
||||
- (id<LibboxHTTPRequest> _Nullable)newRequest;
|
||||
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
|
||||
- (void)pinnedTLS12;
|
||||
- (void)restrictedTLS;
|
||||
- (void)trySocks5:(int32_t)port;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPRequest <NSObject>
|
||||
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)randomUserAgent;
|
||||
- (void)setContent:(NSData* _Nullable)content;
|
||||
- (void)setContentString:(NSString* _Nullable)content;
|
||||
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
|
||||
- (void)setMethod:(NSString* _Nullable)method;
|
||||
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)setUserAgent:(NSString* _Nullable)userAgent;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPResponse <NSObject>
|
||||
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxInterfaceUpdateListener <NSObject>
|
||||
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
|
||||
@end
|
||||
|
||||
@protocol LibboxLocalDNSTransport <NSObject>
|
||||
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)raw;
|
||||
@end
|
||||
|
||||
@protocol LibboxNetworkInterfaceIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxNetworkInterface* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOnDemandRule <NSObject>
|
||||
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
|
||||
- (int32_t)interfaceTypeMatch;
|
||||
- (NSString* _Nonnull)probeURL;
|
||||
- (id<LibboxStringIterator> _Nullable)ssidMatch;
|
||||
- (int32_t)target;
|
||||
@end
|
||||
|
||||
@protocol LibboxOnDemandRuleIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (id<LibboxOnDemandRule> _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOutboundGroupItemIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroupItem* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOutboundGroupIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroup* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxPlatformInterface <NSObject>
|
||||
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)clearDNSCache;
|
||||
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)includeAllNetworks;
|
||||
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxWIFIState* _Nullable)readWIFIState;
|
||||
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)underNetworkExtension;
|
||||
- (BOOL)usePlatformAutoDetectInterfaceControl;
|
||||
- (BOOL)usePlatformDefaultInterfaceMonitor;
|
||||
- (BOOL)usePlatformInterfaceGetter;
|
||||
- (BOOL)useProcFS;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@protocol LibboxProfilePreviewIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxProfilePreview* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxRoutePrefixIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxRoutePrefix* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxStringIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (NSString* _Nonnull)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxTunInterface <NSObject>
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (int32_t)fileDescriptor;
|
||||
@end
|
||||
|
||||
@protocol LibboxTunOptions <NSObject>
|
||||
- (BOOL)getAutoRoute;
|
||||
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
|
||||
- (NSString* _Nonnull)getHTTPProxyServer;
|
||||
- (int32_t)getHTTPProxyServerPort;
|
||||
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
|
||||
- (int32_t)getMTU;
|
||||
- (BOOL)getStrictRoute;
|
||||
- (BOOL)isHTTPProxyEnabled;
|
||||
@end
|
||||
|
||||
@interface LibboxBoxService : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)needWIFIState;
|
||||
- (void)pause;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)wake;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandClient : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(id<LibboxCommandClientHandler> _Nullable)handler options:(LibboxCommandClientOptions* _Nullable)options;
|
||||
- (BOOL)closeConnections:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)connect:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)disconnect:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)selectOutbound:(NSString* _Nullable)groupTag outboundTag:(NSString* _Nullable)outboundTag error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)serviceClose:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setClashMode:(NSString* _Nullable)newMode error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setGroupExpand:(NSString* _Nullable)groupTag isExpand:(BOOL)isExpand error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)urlTest:(NSString* _Nullable)groupTag error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandClientOptions : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int32_t command;
|
||||
@property (nonatomic) int64_t statusInterval;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(id<LibboxCommandServerHandler> _Nullable)handler maxLines:(int32_t)maxLines;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)resetLog;
|
||||
- (void)setService:(LibboxBoxService* _Nullable)newService;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)writeMessage:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxErrorMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull message;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxExchangeContext : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (void)errnoCode:(int32_t)code;
|
||||
- (void)errorCode:(int32_t)code;
|
||||
- (void)onCancel:(id<LibboxFunc> _Nullable)callback;
|
||||
- (void)rawSuccess:(NSData* _Nullable)result;
|
||||
- (void)success:(NSString* _Nullable)result;
|
||||
@end
|
||||
|
||||
@interface LibboxImportRemoteProfile : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) NSString* _Nonnull url;
|
||||
@property (nonatomic) NSString* _Nonnull host;
|
||||
@end
|
||||
|
||||
@interface LibboxNetworkInterface : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int32_t index;
|
||||
@property (nonatomic) int32_t mtu;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) id<LibboxStringIterator> _Nullable addresses;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroup : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull tag;
|
||||
@property (nonatomic) NSString* _Nonnull type;
|
||||
@property (nonatomic) BOOL selectable;
|
||||
@property (nonatomic) NSString* _Nonnull selected;
|
||||
@property (nonatomic) BOOL isExpand;
|
||||
- (id<LibboxOutboundGroupItemIterator> _Nullable)getItems;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupItem : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull tag;
|
||||
@property (nonatomic) NSString* _Nonnull type;
|
||||
@property (nonatomic) int64_t urlTestTime;
|
||||
@property (nonatomic) int32_t urlTestDelay;
|
||||
@end
|
||||
|
||||
@interface LibboxPProfServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(long)port;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileContent : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) int32_t type;
|
||||
@property (nonatomic) NSString* _Nonnull config;
|
||||
@property (nonatomic) NSString* _Nonnull remotePath;
|
||||
@property (nonatomic) BOOL autoUpdate;
|
||||
@property (nonatomic) int32_t autoUpdateInterval;
|
||||
@property (nonatomic) int64_t lastUpdated;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileContentRequest : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t profileID;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileDecoder : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (BOOL)decode:(NSData* _Nullable)data error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxProfilePreviewIterator> _Nullable)iterator;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileEncoder : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (void)append:(LibboxProfilePreview* _Nullable)profile;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfilePreview : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t profileID;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) int32_t type;
|
||||
@end
|
||||
|
||||
@interface LibboxRoutePrefix : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (NSString* _Nonnull)address;
|
||||
- (NSString* _Nonnull)mask;
|
||||
- (int32_t)prefix;
|
||||
- (NSString* _Nonnull)string;
|
||||
@end
|
||||
|
||||
@interface LibboxStatusMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t memory;
|
||||
@property (nonatomic) int32_t goroutines;
|
||||
@property (nonatomic) int32_t connectionsIn;
|
||||
@property (nonatomic) int32_t connectionsOut;
|
||||
@property (nonatomic) BOOL trafficAvailable;
|
||||
@property (nonatomic) int64_t uplink;
|
||||
@property (nonatomic) int64_t downlink;
|
||||
@property (nonatomic) int64_t uplinkTotal;
|
||||
@property (nonatomic) int64_t downlinkTotal;
|
||||
@end
|
||||
|
||||
@interface LibboxSystemProxyStatus : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) BOOL available;
|
||||
@property (nonatomic) BOOL enabled;
|
||||
@end
|
||||
|
||||
@interface LibboxWIFIState : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(NSString* _Nullable)wifiSSID wifiBSSID:(NSString* _Nullable)wifiBSSID;
|
||||
@property (nonatomic) NSString* _Nonnull ssid;
|
||||
@property (nonatomic) NSString* _Nonnull bssid;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandClashMode;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandCloseConnections;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGetSystemProxyStatus;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGroup;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGroupExpand;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandLog;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSelectOutbound;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandServiceClose;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandServiceReload;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSetClashMode;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSetSystemProxyEnabled;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandStatus;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandURLTest;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeError;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContent;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContentRequest;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileList;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeLocal;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeRemote;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeiCloud;
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxCheckConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxClearServiceError(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxErrorMessage* _Nullable LibboxDecodeErrorMessage(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT int32_t LibboxDecodeLengthChunk(NSData* _Nullable data);
|
||||
|
||||
FOUNDATION_EXPORT LibboxProfileContent* _Nullable LibboxDecodeProfileContent(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT LibboxProfileContentRequest* _Nullable LibboxDecodeProfileContentRequest(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable LibboxEncodeChunkedMessage(NSData* _Nullable data);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatBytes(int64_t length);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatMemoryBytes(int64_t length);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxGenerateRemoteProfileImportLink(NSString* _Nullable name, NSString* _Nullable remoteURL);
|
||||
|
||||
FOUNDATION_EXPORT int32_t LibboxGetTunnelFileDescriptor(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewCommandClient(id<LibboxCommandClientHandler> _Nullable handler, LibboxCommandClientOptions* _Nullable options);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandServer* _Nullable LibboxNewCommandServer(id<LibboxCommandServerHandler> _Nullable handler, int32_t maxLines);
|
||||
|
||||
FOUNDATION_EXPORT id<LibboxHTTPClient> _Nullable LibboxNewHTTPClient(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxPProfServer* _Nullable LibboxNewPProfServer(long port);
|
||||
|
||||
FOUNDATION_EXPORT LibboxBoxService* _Nullable LibboxNewService(NSString* _Nullable configContent, id<LibboxPlatformInterface> _Nullable platformInterface, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewStandaloneCommandClient(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxWIFIState* _Nullable LibboxNewWIFIState(NSString* _Nullable wifiSSID, NSString* _Nullable wifiBSSID);
|
||||
|
||||
FOUNDATION_EXPORT LibboxImportRemoteProfile* _Nullable LibboxParseRemoteProfileImportLink(NSString* _Nullable importLink, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxProxyDisplayType(NSString* _Nullable proxyType);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxReadServiceError(NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxRedirectStderr(NSString* _Nullable path, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxRegisterLocalDNSTransport(id<LibboxLocalDNSTransport> _Nullable transport);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxSetMemoryLimit(BOOL enabled);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxSetup(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, BOOL isTVOS);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxSetupWithUsername(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, NSString* _Nullable username, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxVersion(void);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxWriteServiceError(NSString* _Nullable message, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class LibboxCommandClientHandler;
|
||||
|
||||
@class LibboxCommandServerHandler;
|
||||
|
||||
@class LibboxFunc;
|
||||
|
||||
@class LibboxHTTPClient;
|
||||
|
||||
@class LibboxHTTPRequest;
|
||||
|
||||
@class LibboxHTTPResponse;
|
||||
|
||||
@class LibboxInterfaceUpdateListener;
|
||||
|
||||
@class LibboxLocalDNSTransport;
|
||||
|
||||
@class LibboxNetworkInterfaceIterator;
|
||||
|
||||
@class LibboxOnDemandRule;
|
||||
|
||||
@class LibboxOnDemandRuleIterator;
|
||||
|
||||
@class LibboxOutboundGroupItemIterator;
|
||||
|
||||
@class LibboxOutboundGroupIterator;
|
||||
|
||||
@class LibboxPlatformInterface;
|
||||
|
||||
@class LibboxProfilePreviewIterator;
|
||||
|
||||
@class LibboxRoutePrefixIterator;
|
||||
|
||||
@class LibboxStringIterator;
|
||||
|
||||
@class LibboxTunInterface;
|
||||
|
||||
@class LibboxTunOptions;
|
||||
|
||||
@interface LibboxCommandClientHandler : NSObject <goSeqRefInterface, LibboxCommandClientHandler> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)clearLog;
|
||||
- (void)connected;
|
||||
- (void)disconnected:(NSString* _Nullable)message;
|
||||
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
|
||||
- (void)updateClashMode:(NSString* _Nullable)newMode;
|
||||
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandServerHandler : NSObject <goSeqRefInterface, LibboxCommandServerHandler> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
|
||||
- (void)postServiceClose;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxFunc : NSObject <goSeqRefInterface, LibboxFunc> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPClient : NSObject <goSeqRefInterface, LibboxHTTPClient> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)close;
|
||||
- (void)keepAlive;
|
||||
- (void)modernTLS;
|
||||
- (id<LibboxHTTPRequest> _Nullable)newRequest;
|
||||
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
|
||||
- (void)pinnedTLS12;
|
||||
- (void)restrictedTLS;
|
||||
- (void)trySocks5:(int32_t)port;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPRequest : NSObject <goSeqRefInterface, LibboxHTTPRequest> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)randomUserAgent;
|
||||
- (void)setContent:(NSData* _Nullable)content;
|
||||
- (void)setContentString:(NSString* _Nullable)content;
|
||||
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
|
||||
- (void)setMethod:(NSString* _Nullable)method;
|
||||
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)setUserAgent:(NSString* _Nullable)userAgent;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPResponse : NSObject <goSeqRefInterface, LibboxHTTPResponse> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxInterfaceUpdateListener : NSObject <goSeqRefInterface, LibboxInterfaceUpdateListener> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
|
||||
@end
|
||||
|
||||
@interface LibboxLocalDNSTransport : NSObject <goSeqRefInterface, LibboxLocalDNSTransport> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)raw;
|
||||
@end
|
||||
|
||||
@interface LibboxNetworkInterfaceIterator : NSObject <goSeqRefInterface, LibboxNetworkInterfaceIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxNetworkInterface* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOnDemandRule : NSObject <goSeqRefInterface, LibboxOnDemandRule> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
|
||||
- (int32_t)interfaceTypeMatch;
|
||||
- (NSString* _Nonnull)probeURL;
|
||||
- (id<LibboxStringIterator> _Nullable)ssidMatch;
|
||||
- (int32_t)target;
|
||||
@end
|
||||
|
||||
@interface LibboxOnDemandRuleIterator : NSObject <goSeqRefInterface, LibboxOnDemandRuleIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (id<LibboxOnDemandRule> _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupItemIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupItemIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroupItem* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroup* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxPlatformInterface : NSObject <goSeqRefInterface, LibboxPlatformInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)clearDNSCache;
|
||||
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)includeAllNetworks;
|
||||
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxWIFIState* _Nullable)readWIFIState;
|
||||
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)underNetworkExtension;
|
||||
- (BOOL)usePlatformAutoDetectInterfaceControl;
|
||||
- (BOOL)usePlatformDefaultInterfaceMonitor;
|
||||
- (BOOL)usePlatformInterfaceGetter;
|
||||
- (BOOL)useProcFS;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxProfilePreviewIterator : NSObject <goSeqRefInterface, LibboxProfilePreviewIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxProfilePreview* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxRoutePrefixIterator : NSObject <goSeqRefInterface, LibboxRoutePrefixIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxRoutePrefix* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxStringIterator : NSObject <goSeqRefInterface, LibboxStringIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (NSString* _Nonnull)next;
|
||||
@end
|
||||
|
||||
@interface LibboxTunInterface : NSObject <goSeqRefInterface, LibboxTunInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (int32_t)fileDescriptor;
|
||||
@end
|
||||
|
||||
@interface LibboxTunOptions : NSObject <goSeqRefInterface, LibboxTunOptions> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)getAutoRoute;
|
||||
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
|
||||
- (NSString* _Nonnull)getHTTPProxyServer;
|
||||
- (int32_t)getHTTPProxyServerPort;
|
||||
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
|
||||
- (int32_t)getMTU;
|
||||
- (BOOL)getStrictRoute;
|
||||
- (BOOL)isHTTPProxyEnabled;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
framework module Libbox {
|
||||
header "ref.h"
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
export *
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
||||
+1
@@ -0,0 +1 @@
|
||||
A
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Headers
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Libbox
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Modules
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Resources
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/sagernet/sing-box/experimental/libbox
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __Libbox_FRAMEWORK_H__
|
||||
#define __Libbox_FRAMEWORK_H__
|
||||
|
||||
#include "Libbox.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
+811
@@ -0,0 +1,811 @@
|
||||
// Objective-C API for talking to github.com/sagernet/sing-box/experimental/libbox Go package.
|
||||
// gobind -lang=objc github.com/sagernet/sing-box/experimental/libbox
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Libbox_H__
|
||||
#define __Libbox_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class LibboxBoxService;
|
||||
@class LibboxCommandClient;
|
||||
@class LibboxCommandClientOptions;
|
||||
@class LibboxCommandServer;
|
||||
@class LibboxErrorMessage;
|
||||
@class LibboxExchangeContext;
|
||||
@class LibboxImportRemoteProfile;
|
||||
@class LibboxNetworkInterface;
|
||||
@class LibboxOutboundGroup;
|
||||
@class LibboxOutboundGroupItem;
|
||||
@class LibboxPProfServer;
|
||||
@class LibboxProfileContent;
|
||||
@class LibboxProfileContentRequest;
|
||||
@class LibboxProfileDecoder;
|
||||
@class LibboxProfileEncoder;
|
||||
@class LibboxProfilePreview;
|
||||
@class LibboxRoutePrefix;
|
||||
@class LibboxStatusMessage;
|
||||
@class LibboxSystemProxyStatus;
|
||||
@class LibboxWIFIState;
|
||||
@protocol LibboxCommandClientHandler;
|
||||
@class LibboxCommandClientHandler;
|
||||
@protocol LibboxCommandServerHandler;
|
||||
@class LibboxCommandServerHandler;
|
||||
@protocol LibboxFunc;
|
||||
@class LibboxFunc;
|
||||
@protocol LibboxHTTPClient;
|
||||
@class LibboxHTTPClient;
|
||||
@protocol LibboxHTTPRequest;
|
||||
@class LibboxHTTPRequest;
|
||||
@protocol LibboxHTTPResponse;
|
||||
@class LibboxHTTPResponse;
|
||||
@protocol LibboxInterfaceUpdateListener;
|
||||
@class LibboxInterfaceUpdateListener;
|
||||
@protocol LibboxLocalDNSTransport;
|
||||
@class LibboxLocalDNSTransport;
|
||||
@protocol LibboxNetworkInterfaceIterator;
|
||||
@class LibboxNetworkInterfaceIterator;
|
||||
@protocol LibboxOnDemandRule;
|
||||
@class LibboxOnDemandRule;
|
||||
@protocol LibboxOnDemandRuleIterator;
|
||||
@class LibboxOnDemandRuleIterator;
|
||||
@protocol LibboxOutboundGroupItemIterator;
|
||||
@class LibboxOutboundGroupItemIterator;
|
||||
@protocol LibboxOutboundGroupIterator;
|
||||
@class LibboxOutboundGroupIterator;
|
||||
@protocol LibboxPlatformInterface;
|
||||
@class LibboxPlatformInterface;
|
||||
@protocol LibboxProfilePreviewIterator;
|
||||
@class LibboxProfilePreviewIterator;
|
||||
@protocol LibboxRoutePrefixIterator;
|
||||
@class LibboxRoutePrefixIterator;
|
||||
@protocol LibboxStringIterator;
|
||||
@class LibboxStringIterator;
|
||||
@protocol LibboxTunInterface;
|
||||
@class LibboxTunInterface;
|
||||
@protocol LibboxTunOptions;
|
||||
@class LibboxTunOptions;
|
||||
|
||||
@protocol LibboxCommandClientHandler <NSObject>
|
||||
- (void)clearLog;
|
||||
- (void)connected;
|
||||
- (void)disconnected:(NSString* _Nullable)message;
|
||||
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
|
||||
- (void)updateClashMode:(NSString* _Nullable)newMode;
|
||||
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
|
||||
@end
|
||||
|
||||
@protocol LibboxCommandServerHandler <NSObject>
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
|
||||
- (void)postServiceClose;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxFunc <NSObject>
|
||||
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPClient <NSObject>
|
||||
- (void)close;
|
||||
- (void)keepAlive;
|
||||
- (void)modernTLS;
|
||||
- (id<LibboxHTTPRequest> _Nullable)newRequest;
|
||||
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
|
||||
- (void)pinnedTLS12;
|
||||
- (void)restrictedTLS;
|
||||
- (void)trySocks5:(int32_t)port;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPRequest <NSObject>
|
||||
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)randomUserAgent;
|
||||
- (void)setContent:(NSData* _Nullable)content;
|
||||
- (void)setContentString:(NSString* _Nullable)content;
|
||||
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
|
||||
- (void)setMethod:(NSString* _Nullable)method;
|
||||
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)setUserAgent:(NSString* _Nullable)userAgent;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPResponse <NSObject>
|
||||
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxInterfaceUpdateListener <NSObject>
|
||||
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
|
||||
@end
|
||||
|
||||
@protocol LibboxLocalDNSTransport <NSObject>
|
||||
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)raw;
|
||||
@end
|
||||
|
||||
@protocol LibboxNetworkInterfaceIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxNetworkInterface* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOnDemandRule <NSObject>
|
||||
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
|
||||
- (int32_t)interfaceTypeMatch;
|
||||
- (NSString* _Nonnull)probeURL;
|
||||
- (id<LibboxStringIterator> _Nullable)ssidMatch;
|
||||
- (int32_t)target;
|
||||
@end
|
||||
|
||||
@protocol LibboxOnDemandRuleIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (id<LibboxOnDemandRule> _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOutboundGroupItemIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroupItem* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOutboundGroupIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroup* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxPlatformInterface <NSObject>
|
||||
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)clearDNSCache;
|
||||
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)includeAllNetworks;
|
||||
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxWIFIState* _Nullable)readWIFIState;
|
||||
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)underNetworkExtension;
|
||||
- (BOOL)usePlatformAutoDetectInterfaceControl;
|
||||
- (BOOL)usePlatformDefaultInterfaceMonitor;
|
||||
- (BOOL)usePlatformInterfaceGetter;
|
||||
- (BOOL)useProcFS;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@protocol LibboxProfilePreviewIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxProfilePreview* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxRoutePrefixIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxRoutePrefix* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxStringIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (NSString* _Nonnull)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxTunInterface <NSObject>
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (int32_t)fileDescriptor;
|
||||
@end
|
||||
|
||||
@protocol LibboxTunOptions <NSObject>
|
||||
- (BOOL)getAutoRoute;
|
||||
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
|
||||
- (NSString* _Nonnull)getHTTPProxyServer;
|
||||
- (int32_t)getHTTPProxyServerPort;
|
||||
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
|
||||
- (int32_t)getMTU;
|
||||
- (BOOL)getStrictRoute;
|
||||
- (BOOL)isHTTPProxyEnabled;
|
||||
@end
|
||||
|
||||
@interface LibboxBoxService : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)needWIFIState;
|
||||
- (void)pause;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)wake;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandClient : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(id<LibboxCommandClientHandler> _Nullable)handler options:(LibboxCommandClientOptions* _Nullable)options;
|
||||
- (BOOL)closeConnections:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)connect:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)disconnect:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)selectOutbound:(NSString* _Nullable)groupTag outboundTag:(NSString* _Nullable)outboundTag error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)serviceClose:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setClashMode:(NSString* _Nullable)newMode error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setGroupExpand:(NSString* _Nullable)groupTag isExpand:(BOOL)isExpand error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)urlTest:(NSString* _Nullable)groupTag error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandClientOptions : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int32_t command;
|
||||
@property (nonatomic) int64_t statusInterval;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(id<LibboxCommandServerHandler> _Nullable)handler maxLines:(int32_t)maxLines;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)resetLog;
|
||||
- (void)setService:(LibboxBoxService* _Nullable)newService;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)writeMessage:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxErrorMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull message;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxExchangeContext : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (void)errnoCode:(int32_t)code;
|
||||
- (void)errorCode:(int32_t)code;
|
||||
- (void)onCancel:(id<LibboxFunc> _Nullable)callback;
|
||||
- (void)rawSuccess:(NSData* _Nullable)result;
|
||||
- (void)success:(NSString* _Nullable)result;
|
||||
@end
|
||||
|
||||
@interface LibboxImportRemoteProfile : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) NSString* _Nonnull url;
|
||||
@property (nonatomic) NSString* _Nonnull host;
|
||||
@end
|
||||
|
||||
@interface LibboxNetworkInterface : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int32_t index;
|
||||
@property (nonatomic) int32_t mtu;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) id<LibboxStringIterator> _Nullable addresses;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroup : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull tag;
|
||||
@property (nonatomic) NSString* _Nonnull type;
|
||||
@property (nonatomic) BOOL selectable;
|
||||
@property (nonatomic) NSString* _Nonnull selected;
|
||||
@property (nonatomic) BOOL isExpand;
|
||||
- (id<LibboxOutboundGroupItemIterator> _Nullable)getItems;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupItem : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull tag;
|
||||
@property (nonatomic) NSString* _Nonnull type;
|
||||
@property (nonatomic) int64_t urlTestTime;
|
||||
@property (nonatomic) int32_t urlTestDelay;
|
||||
@end
|
||||
|
||||
@interface LibboxPProfServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(long)port;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileContent : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) int32_t type;
|
||||
@property (nonatomic) NSString* _Nonnull config;
|
||||
@property (nonatomic) NSString* _Nonnull remotePath;
|
||||
@property (nonatomic) BOOL autoUpdate;
|
||||
@property (nonatomic) int32_t autoUpdateInterval;
|
||||
@property (nonatomic) int64_t lastUpdated;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileContentRequest : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t profileID;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileDecoder : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (BOOL)decode:(NSData* _Nullable)data error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxProfilePreviewIterator> _Nullable)iterator;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileEncoder : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (void)append:(LibboxProfilePreview* _Nullable)profile;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfilePreview : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t profileID;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) int32_t type;
|
||||
@end
|
||||
|
||||
@interface LibboxRoutePrefix : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (NSString* _Nonnull)address;
|
||||
- (NSString* _Nonnull)mask;
|
||||
- (int32_t)prefix;
|
||||
- (NSString* _Nonnull)string;
|
||||
@end
|
||||
|
||||
@interface LibboxStatusMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t memory;
|
||||
@property (nonatomic) int32_t goroutines;
|
||||
@property (nonatomic) int32_t connectionsIn;
|
||||
@property (nonatomic) int32_t connectionsOut;
|
||||
@property (nonatomic) BOOL trafficAvailable;
|
||||
@property (nonatomic) int64_t uplink;
|
||||
@property (nonatomic) int64_t downlink;
|
||||
@property (nonatomic) int64_t uplinkTotal;
|
||||
@property (nonatomic) int64_t downlinkTotal;
|
||||
@end
|
||||
|
||||
@interface LibboxSystemProxyStatus : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) BOOL available;
|
||||
@property (nonatomic) BOOL enabled;
|
||||
@end
|
||||
|
||||
@interface LibboxWIFIState : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(NSString* _Nullable)wifiSSID wifiBSSID:(NSString* _Nullable)wifiBSSID;
|
||||
@property (nonatomic) NSString* _Nonnull ssid;
|
||||
@property (nonatomic) NSString* _Nonnull bssid;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandClashMode;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandCloseConnections;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGetSystemProxyStatus;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGroup;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGroupExpand;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandLog;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSelectOutbound;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandServiceClose;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandServiceReload;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSetClashMode;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSetSystemProxyEnabled;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandStatus;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandURLTest;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeError;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContent;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContentRequest;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileList;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeLocal;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeRemote;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeiCloud;
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxCheckConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxClearServiceError(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxErrorMessage* _Nullable LibboxDecodeErrorMessage(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT int32_t LibboxDecodeLengthChunk(NSData* _Nullable data);
|
||||
|
||||
FOUNDATION_EXPORT LibboxProfileContent* _Nullable LibboxDecodeProfileContent(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT LibboxProfileContentRequest* _Nullable LibboxDecodeProfileContentRequest(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable LibboxEncodeChunkedMessage(NSData* _Nullable data);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatBytes(int64_t length);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatMemoryBytes(int64_t length);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxGenerateRemoteProfileImportLink(NSString* _Nullable name, NSString* _Nullable remoteURL);
|
||||
|
||||
FOUNDATION_EXPORT int32_t LibboxGetTunnelFileDescriptor(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewCommandClient(id<LibboxCommandClientHandler> _Nullable handler, LibboxCommandClientOptions* _Nullable options);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandServer* _Nullable LibboxNewCommandServer(id<LibboxCommandServerHandler> _Nullable handler, int32_t maxLines);
|
||||
|
||||
FOUNDATION_EXPORT id<LibboxHTTPClient> _Nullable LibboxNewHTTPClient(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxPProfServer* _Nullable LibboxNewPProfServer(long port);
|
||||
|
||||
FOUNDATION_EXPORT LibboxBoxService* _Nullable LibboxNewService(NSString* _Nullable configContent, id<LibboxPlatformInterface> _Nullable platformInterface, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewStandaloneCommandClient(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxWIFIState* _Nullable LibboxNewWIFIState(NSString* _Nullable wifiSSID, NSString* _Nullable wifiBSSID);
|
||||
|
||||
FOUNDATION_EXPORT LibboxImportRemoteProfile* _Nullable LibboxParseRemoteProfileImportLink(NSString* _Nullable importLink, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxProxyDisplayType(NSString* _Nullable proxyType);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxReadServiceError(NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxRedirectStderr(NSString* _Nullable path, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxRegisterLocalDNSTransport(id<LibboxLocalDNSTransport> _Nullable transport);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxSetMemoryLimit(BOOL enabled);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxSetup(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, BOOL isTVOS);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxSetupWithUsername(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, NSString* _Nullable username, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxVersion(void);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxWriteServiceError(NSString* _Nullable message, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class LibboxCommandClientHandler;
|
||||
|
||||
@class LibboxCommandServerHandler;
|
||||
|
||||
@class LibboxFunc;
|
||||
|
||||
@class LibboxHTTPClient;
|
||||
|
||||
@class LibboxHTTPRequest;
|
||||
|
||||
@class LibboxHTTPResponse;
|
||||
|
||||
@class LibboxInterfaceUpdateListener;
|
||||
|
||||
@class LibboxLocalDNSTransport;
|
||||
|
||||
@class LibboxNetworkInterfaceIterator;
|
||||
|
||||
@class LibboxOnDemandRule;
|
||||
|
||||
@class LibboxOnDemandRuleIterator;
|
||||
|
||||
@class LibboxOutboundGroupItemIterator;
|
||||
|
||||
@class LibboxOutboundGroupIterator;
|
||||
|
||||
@class LibboxPlatformInterface;
|
||||
|
||||
@class LibboxProfilePreviewIterator;
|
||||
|
||||
@class LibboxRoutePrefixIterator;
|
||||
|
||||
@class LibboxStringIterator;
|
||||
|
||||
@class LibboxTunInterface;
|
||||
|
||||
@class LibboxTunOptions;
|
||||
|
||||
@interface LibboxCommandClientHandler : NSObject <goSeqRefInterface, LibboxCommandClientHandler> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)clearLog;
|
||||
- (void)connected;
|
||||
- (void)disconnected:(NSString* _Nullable)message;
|
||||
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
|
||||
- (void)updateClashMode:(NSString* _Nullable)newMode;
|
||||
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandServerHandler : NSObject <goSeqRefInterface, LibboxCommandServerHandler> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
|
||||
- (void)postServiceClose;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxFunc : NSObject <goSeqRefInterface, LibboxFunc> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPClient : NSObject <goSeqRefInterface, LibboxHTTPClient> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)close;
|
||||
- (void)keepAlive;
|
||||
- (void)modernTLS;
|
||||
- (id<LibboxHTTPRequest> _Nullable)newRequest;
|
||||
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
|
||||
- (void)pinnedTLS12;
|
||||
- (void)restrictedTLS;
|
||||
- (void)trySocks5:(int32_t)port;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPRequest : NSObject <goSeqRefInterface, LibboxHTTPRequest> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)randomUserAgent;
|
||||
- (void)setContent:(NSData* _Nullable)content;
|
||||
- (void)setContentString:(NSString* _Nullable)content;
|
||||
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
|
||||
- (void)setMethod:(NSString* _Nullable)method;
|
||||
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)setUserAgent:(NSString* _Nullable)userAgent;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPResponse : NSObject <goSeqRefInterface, LibboxHTTPResponse> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxInterfaceUpdateListener : NSObject <goSeqRefInterface, LibboxInterfaceUpdateListener> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
|
||||
@end
|
||||
|
||||
@interface LibboxLocalDNSTransport : NSObject <goSeqRefInterface, LibboxLocalDNSTransport> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)raw;
|
||||
@end
|
||||
|
||||
@interface LibboxNetworkInterfaceIterator : NSObject <goSeqRefInterface, LibboxNetworkInterfaceIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxNetworkInterface* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOnDemandRule : NSObject <goSeqRefInterface, LibboxOnDemandRule> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
|
||||
- (int32_t)interfaceTypeMatch;
|
||||
- (NSString* _Nonnull)probeURL;
|
||||
- (id<LibboxStringIterator> _Nullable)ssidMatch;
|
||||
- (int32_t)target;
|
||||
@end
|
||||
|
||||
@interface LibboxOnDemandRuleIterator : NSObject <goSeqRefInterface, LibboxOnDemandRuleIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (id<LibboxOnDemandRule> _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupItemIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupItemIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroupItem* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroup* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxPlatformInterface : NSObject <goSeqRefInterface, LibboxPlatformInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)clearDNSCache;
|
||||
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)includeAllNetworks;
|
||||
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxWIFIState* _Nullable)readWIFIState;
|
||||
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)underNetworkExtension;
|
||||
- (BOOL)usePlatformAutoDetectInterfaceControl;
|
||||
- (BOOL)usePlatformDefaultInterfaceMonitor;
|
||||
- (BOOL)usePlatformInterfaceGetter;
|
||||
- (BOOL)useProcFS;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxProfilePreviewIterator : NSObject <goSeqRefInterface, LibboxProfilePreviewIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxProfilePreview* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxRoutePrefixIterator : NSObject <goSeqRefInterface, LibboxRoutePrefixIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxRoutePrefix* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxStringIterator : NSObject <goSeqRefInterface, LibboxStringIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (NSString* _Nonnull)next;
|
||||
@end
|
||||
|
||||
@interface LibboxTunInterface : NSObject <goSeqRefInterface, LibboxTunInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (int32_t)fileDescriptor;
|
||||
@end
|
||||
|
||||
@interface LibboxTunOptions : NSObject <goSeqRefInterface, LibboxTunOptions> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)getAutoRoute;
|
||||
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
|
||||
- (NSString* _Nonnull)getHTTPProxyServer;
|
||||
- (int32_t)getHTTPProxyServerPort;
|
||||
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
|
||||
- (int32_t)getMTU;
|
||||
- (BOOL)getStrictRoute;
|
||||
- (BOOL)isHTTPProxyEnabled;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
framework module Libbox {
|
||||
header "ref.h"
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
export *
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
||||
+1
@@ -0,0 +1 @@
|
||||
A
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Headers
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Libbox
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Modules
|
||||
+1
@@ -0,0 +1 @@
|
||||
Versions/Current/Resources
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/sagernet/sing-box/experimental/libbox
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __Libbox_FRAMEWORK_H__
|
||||
#define __Libbox_FRAMEWORK_H__
|
||||
|
||||
#include "Libbox.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
+811
@@ -0,0 +1,811 @@
|
||||
// Objective-C API for talking to github.com/sagernet/sing-box/experimental/libbox Go package.
|
||||
// gobind -lang=objc github.com/sagernet/sing-box/experimental/libbox
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Libbox_H__
|
||||
#define __Libbox_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class LibboxBoxService;
|
||||
@class LibboxCommandClient;
|
||||
@class LibboxCommandClientOptions;
|
||||
@class LibboxCommandServer;
|
||||
@class LibboxErrorMessage;
|
||||
@class LibboxExchangeContext;
|
||||
@class LibboxImportRemoteProfile;
|
||||
@class LibboxNetworkInterface;
|
||||
@class LibboxOutboundGroup;
|
||||
@class LibboxOutboundGroupItem;
|
||||
@class LibboxPProfServer;
|
||||
@class LibboxProfileContent;
|
||||
@class LibboxProfileContentRequest;
|
||||
@class LibboxProfileDecoder;
|
||||
@class LibboxProfileEncoder;
|
||||
@class LibboxProfilePreview;
|
||||
@class LibboxRoutePrefix;
|
||||
@class LibboxStatusMessage;
|
||||
@class LibboxSystemProxyStatus;
|
||||
@class LibboxWIFIState;
|
||||
@protocol LibboxCommandClientHandler;
|
||||
@class LibboxCommandClientHandler;
|
||||
@protocol LibboxCommandServerHandler;
|
||||
@class LibboxCommandServerHandler;
|
||||
@protocol LibboxFunc;
|
||||
@class LibboxFunc;
|
||||
@protocol LibboxHTTPClient;
|
||||
@class LibboxHTTPClient;
|
||||
@protocol LibboxHTTPRequest;
|
||||
@class LibboxHTTPRequest;
|
||||
@protocol LibboxHTTPResponse;
|
||||
@class LibboxHTTPResponse;
|
||||
@protocol LibboxInterfaceUpdateListener;
|
||||
@class LibboxInterfaceUpdateListener;
|
||||
@protocol LibboxLocalDNSTransport;
|
||||
@class LibboxLocalDNSTransport;
|
||||
@protocol LibboxNetworkInterfaceIterator;
|
||||
@class LibboxNetworkInterfaceIterator;
|
||||
@protocol LibboxOnDemandRule;
|
||||
@class LibboxOnDemandRule;
|
||||
@protocol LibboxOnDemandRuleIterator;
|
||||
@class LibboxOnDemandRuleIterator;
|
||||
@protocol LibboxOutboundGroupItemIterator;
|
||||
@class LibboxOutboundGroupItemIterator;
|
||||
@protocol LibboxOutboundGroupIterator;
|
||||
@class LibboxOutboundGroupIterator;
|
||||
@protocol LibboxPlatformInterface;
|
||||
@class LibboxPlatformInterface;
|
||||
@protocol LibboxProfilePreviewIterator;
|
||||
@class LibboxProfilePreviewIterator;
|
||||
@protocol LibboxRoutePrefixIterator;
|
||||
@class LibboxRoutePrefixIterator;
|
||||
@protocol LibboxStringIterator;
|
||||
@class LibboxStringIterator;
|
||||
@protocol LibboxTunInterface;
|
||||
@class LibboxTunInterface;
|
||||
@protocol LibboxTunOptions;
|
||||
@class LibboxTunOptions;
|
||||
|
||||
@protocol LibboxCommandClientHandler <NSObject>
|
||||
- (void)clearLog;
|
||||
- (void)connected;
|
||||
- (void)disconnected:(NSString* _Nullable)message;
|
||||
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
|
||||
- (void)updateClashMode:(NSString* _Nullable)newMode;
|
||||
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
|
||||
@end
|
||||
|
||||
@protocol LibboxCommandServerHandler <NSObject>
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
|
||||
- (void)postServiceClose;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxFunc <NSObject>
|
||||
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPClient <NSObject>
|
||||
- (void)close;
|
||||
- (void)keepAlive;
|
||||
- (void)modernTLS;
|
||||
- (id<LibboxHTTPRequest> _Nullable)newRequest;
|
||||
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
|
||||
- (void)pinnedTLS12;
|
||||
- (void)restrictedTLS;
|
||||
- (void)trySocks5:(int32_t)port;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPRequest <NSObject>
|
||||
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)randomUserAgent;
|
||||
- (void)setContent:(NSData* _Nullable)content;
|
||||
- (void)setContentString:(NSString* _Nullable)content;
|
||||
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
|
||||
- (void)setMethod:(NSString* _Nullable)method;
|
||||
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)setUserAgent:(NSString* _Nullable)userAgent;
|
||||
@end
|
||||
|
||||
@protocol LibboxHTTPResponse <NSObject>
|
||||
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@protocol LibboxInterfaceUpdateListener <NSObject>
|
||||
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
|
||||
@end
|
||||
|
||||
@protocol LibboxLocalDNSTransport <NSObject>
|
||||
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)raw;
|
||||
@end
|
||||
|
||||
@protocol LibboxNetworkInterfaceIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxNetworkInterface* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOnDemandRule <NSObject>
|
||||
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
|
||||
- (int32_t)interfaceTypeMatch;
|
||||
- (NSString* _Nonnull)probeURL;
|
||||
- (id<LibboxStringIterator> _Nullable)ssidMatch;
|
||||
- (int32_t)target;
|
||||
@end
|
||||
|
||||
@protocol LibboxOnDemandRuleIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (id<LibboxOnDemandRule> _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOutboundGroupItemIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroupItem* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxOutboundGroupIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroup* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxPlatformInterface <NSObject>
|
||||
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)clearDNSCache;
|
||||
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)includeAllNetworks;
|
||||
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxWIFIState* _Nullable)readWIFIState;
|
||||
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)underNetworkExtension;
|
||||
- (BOOL)usePlatformAutoDetectInterfaceControl;
|
||||
- (BOOL)usePlatformDefaultInterfaceMonitor;
|
||||
- (BOOL)usePlatformInterfaceGetter;
|
||||
- (BOOL)useProcFS;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@protocol LibboxProfilePreviewIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxProfilePreview* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxRoutePrefixIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxRoutePrefix* _Nullable)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxStringIterator <NSObject>
|
||||
- (BOOL)hasNext;
|
||||
- (NSString* _Nonnull)next;
|
||||
@end
|
||||
|
||||
@protocol LibboxTunInterface <NSObject>
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (int32_t)fileDescriptor;
|
||||
@end
|
||||
|
||||
@protocol LibboxTunOptions <NSObject>
|
||||
- (BOOL)getAutoRoute;
|
||||
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
|
||||
- (NSString* _Nonnull)getHTTPProxyServer;
|
||||
- (int32_t)getHTTPProxyServerPort;
|
||||
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
|
||||
- (int32_t)getMTU;
|
||||
- (BOOL)getStrictRoute;
|
||||
- (BOOL)isHTTPProxyEnabled;
|
||||
@end
|
||||
|
||||
@interface LibboxBoxService : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)needWIFIState;
|
||||
- (void)pause;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)wake;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandClient : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(id<LibboxCommandClientHandler> _Nullable)handler options:(LibboxCommandClientOptions* _Nullable)options;
|
||||
- (BOOL)closeConnections:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)connect:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)disconnect:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)selectOutbound:(NSString* _Nullable)groupTag outboundTag:(NSString* _Nullable)outboundTag error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)serviceClose:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setClashMode:(NSString* _Nullable)newMode error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setGroupExpand:(NSString* _Nullable)groupTag isExpand:(BOOL)isExpand error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)urlTest:(NSString* _Nullable)groupTag error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandClientOptions : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int32_t command;
|
||||
@property (nonatomic) int64_t statusInterval;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(id<LibboxCommandServerHandler> _Nullable)handler maxLines:(int32_t)maxLines;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)resetLog;
|
||||
- (void)setService:(LibboxBoxService* _Nullable)newService;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)writeMessage:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxErrorMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull message;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxExchangeContext : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (void)errnoCode:(int32_t)code;
|
||||
- (void)errorCode:(int32_t)code;
|
||||
- (void)onCancel:(id<LibboxFunc> _Nullable)callback;
|
||||
- (void)rawSuccess:(NSData* _Nullable)result;
|
||||
- (void)success:(NSString* _Nullable)result;
|
||||
@end
|
||||
|
||||
@interface LibboxImportRemoteProfile : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) NSString* _Nonnull url;
|
||||
@property (nonatomic) NSString* _Nonnull host;
|
||||
@end
|
||||
|
||||
@interface LibboxNetworkInterface : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int32_t index;
|
||||
@property (nonatomic) int32_t mtu;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) id<LibboxStringIterator> _Nullable addresses;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroup : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull tag;
|
||||
@property (nonatomic) NSString* _Nonnull type;
|
||||
@property (nonatomic) BOOL selectable;
|
||||
@property (nonatomic) NSString* _Nonnull selected;
|
||||
@property (nonatomic) BOOL isExpand;
|
||||
- (id<LibboxOutboundGroupItemIterator> _Nullable)getItems;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupItem : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull tag;
|
||||
@property (nonatomic) NSString* _Nonnull type;
|
||||
@property (nonatomic) int64_t urlTestTime;
|
||||
@property (nonatomic) int32_t urlTestDelay;
|
||||
@end
|
||||
|
||||
@interface LibboxPProfServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(long)port;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)start:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileContent : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) int32_t type;
|
||||
@property (nonatomic) NSString* _Nonnull config;
|
||||
@property (nonatomic) NSString* _Nonnull remotePath;
|
||||
@property (nonatomic) BOOL autoUpdate;
|
||||
@property (nonatomic) int32_t autoUpdateInterval;
|
||||
@property (nonatomic) int64_t lastUpdated;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileContentRequest : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t profileID;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileDecoder : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (BOOL)decode:(NSData* _Nullable)data error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxProfilePreviewIterator> _Nullable)iterator;
|
||||
@end
|
||||
|
||||
@interface LibboxProfileEncoder : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (void)append:(LibboxProfilePreview* _Nullable)profile;
|
||||
- (NSData* _Nullable)encode;
|
||||
@end
|
||||
|
||||
@interface LibboxProfilePreview : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t profileID;
|
||||
@property (nonatomic) NSString* _Nonnull name;
|
||||
@property (nonatomic) int32_t type;
|
||||
@end
|
||||
|
||||
@interface LibboxRoutePrefix : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
- (NSString* _Nonnull)address;
|
||||
- (NSString* _Nonnull)mask;
|
||||
- (int32_t)prefix;
|
||||
- (NSString* _Nonnull)string;
|
||||
@end
|
||||
|
||||
@interface LibboxStatusMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) int64_t memory;
|
||||
@property (nonatomic) int32_t goroutines;
|
||||
@property (nonatomic) int32_t connectionsIn;
|
||||
@property (nonatomic) int32_t connectionsOut;
|
||||
@property (nonatomic) BOOL trafficAvailable;
|
||||
@property (nonatomic) int64_t uplink;
|
||||
@property (nonatomic) int64_t downlink;
|
||||
@property (nonatomic) int64_t uplinkTotal;
|
||||
@property (nonatomic) int64_t downlinkTotal;
|
||||
@end
|
||||
|
||||
@interface LibboxSystemProxyStatus : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) BOOL available;
|
||||
@property (nonatomic) BOOL enabled;
|
||||
@end
|
||||
|
||||
@interface LibboxWIFIState : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nullable instancetype)init:(NSString* _Nullable)wifiSSID wifiBSSID:(NSString* _Nullable)wifiBSSID;
|
||||
@property (nonatomic) NSString* _Nonnull ssid;
|
||||
@property (nonatomic) NSString* _Nonnull bssid;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandClashMode;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandCloseConnections;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGetSystemProxyStatus;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGroup;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandGroupExpand;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandLog;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSelectOutbound;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandServiceClose;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandServiceReload;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSetClashMode;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandSetSystemProxyEnabled;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandStatus;
|
||||
FOUNDATION_EXPORT const int32_t LibboxCommandURLTest;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeError;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContent;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileContentRequest;
|
||||
FOUNDATION_EXPORT const int64_t LibboxMessageTypeProfileList;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeLocal;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeRemote;
|
||||
FOUNDATION_EXPORT const int32_t LibboxProfileTypeiCloud;
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxCheckConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxClearServiceError(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxErrorMessage* _Nullable LibboxDecodeErrorMessage(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT int32_t LibboxDecodeLengthChunk(NSData* _Nullable data);
|
||||
|
||||
FOUNDATION_EXPORT LibboxProfileContent* _Nullable LibboxDecodeProfileContent(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT LibboxProfileContentRequest* _Nullable LibboxDecodeProfileContentRequest(NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable LibboxEncodeChunkedMessage(NSData* _Nullable data);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatBytes(int64_t length);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatConfig(NSString* _Nullable configContent, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxFormatMemoryBytes(int64_t length);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxGenerateRemoteProfileImportLink(NSString* _Nullable name, NSString* _Nullable remoteURL);
|
||||
|
||||
FOUNDATION_EXPORT int32_t LibboxGetTunnelFileDescriptor(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewCommandClient(id<LibboxCommandClientHandler> _Nullable handler, LibboxCommandClientOptions* _Nullable options);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandServer* _Nullable LibboxNewCommandServer(id<LibboxCommandServerHandler> _Nullable handler, int32_t maxLines);
|
||||
|
||||
FOUNDATION_EXPORT id<LibboxHTTPClient> _Nullable LibboxNewHTTPClient(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxPProfServer* _Nullable LibboxNewPProfServer(long port);
|
||||
|
||||
FOUNDATION_EXPORT LibboxBoxService* _Nullable LibboxNewService(NSString* _Nullable configContent, id<LibboxPlatformInterface> _Nullable platformInterface, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT LibboxCommandClient* _Nullable LibboxNewStandaloneCommandClient(void);
|
||||
|
||||
FOUNDATION_EXPORT LibboxWIFIState* _Nullable LibboxNewWIFIState(NSString* _Nullable wifiSSID, NSString* _Nullable wifiBSSID);
|
||||
|
||||
FOUNDATION_EXPORT LibboxImportRemoteProfile* _Nullable LibboxParseRemoteProfileImportLink(NSString* _Nullable importLink, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxProxyDisplayType(NSString* _Nullable proxyType);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxReadServiceError(NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxRedirectStderr(NSString* _Nullable path, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxRegisterLocalDNSTransport(id<LibboxLocalDNSTransport> _Nullable transport);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxSetMemoryLimit(BOOL enabled);
|
||||
|
||||
FOUNDATION_EXPORT void LibboxSetup(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, BOOL isTVOS);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxSetupWithUsername(NSString* _Nullable basePath, NSString* _Nullable workingPath, NSString* _Nullable tempPath, NSString* _Nullable username, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull LibboxVersion(void);
|
||||
|
||||
FOUNDATION_EXPORT BOOL LibboxWriteServiceError(NSString* _Nullable message, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class LibboxCommandClientHandler;
|
||||
|
||||
@class LibboxCommandServerHandler;
|
||||
|
||||
@class LibboxFunc;
|
||||
|
||||
@class LibboxHTTPClient;
|
||||
|
||||
@class LibboxHTTPRequest;
|
||||
|
||||
@class LibboxHTTPResponse;
|
||||
|
||||
@class LibboxInterfaceUpdateListener;
|
||||
|
||||
@class LibboxLocalDNSTransport;
|
||||
|
||||
@class LibboxNetworkInterfaceIterator;
|
||||
|
||||
@class LibboxOnDemandRule;
|
||||
|
||||
@class LibboxOnDemandRuleIterator;
|
||||
|
||||
@class LibboxOutboundGroupItemIterator;
|
||||
|
||||
@class LibboxOutboundGroupIterator;
|
||||
|
||||
@class LibboxPlatformInterface;
|
||||
|
||||
@class LibboxProfilePreviewIterator;
|
||||
|
||||
@class LibboxRoutePrefixIterator;
|
||||
|
||||
@class LibboxStringIterator;
|
||||
|
||||
@class LibboxTunInterface;
|
||||
|
||||
@class LibboxTunOptions;
|
||||
|
||||
@interface LibboxCommandClientHandler : NSObject <goSeqRefInterface, LibboxCommandClientHandler> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)clearLog;
|
||||
- (void)connected;
|
||||
- (void)disconnected:(NSString* _Nullable)message;
|
||||
- (void)initializeClashMode:(id<LibboxStringIterator> _Nullable)modeList currentMode:(NSString* _Nullable)currentMode;
|
||||
- (void)updateClashMode:(NSString* _Nullable)newMode;
|
||||
- (void)writeGroups:(id<LibboxOutboundGroupIterator> _Nullable)message;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
- (void)writeStatus:(LibboxStatusMessage* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxCommandServerHandler : NSObject <goSeqRefInterface, LibboxCommandServerHandler> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (LibboxSystemProxyStatus* _Nullable)getSystemProxyStatus;
|
||||
- (void)postServiceClose;
|
||||
- (BOOL)serviceReload:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)setSystemProxyEnabled:(BOOL)isEnabled error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxFunc : NSObject <goSeqRefInterface, LibboxFunc> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)invoke:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPClient : NSObject <goSeqRefInterface, LibboxHTTPClient> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)close;
|
||||
- (void)keepAlive;
|
||||
- (void)modernTLS;
|
||||
- (id<LibboxHTTPRequest> _Nullable)newRequest;
|
||||
- (void)pinnedSHA256:(NSString* _Nullable)sumHex;
|
||||
- (void)pinnedTLS12;
|
||||
- (void)restrictedTLS;
|
||||
- (void)trySocks5:(int32_t)port;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPRequest : NSObject <goSeqRefInterface, LibboxHTTPRequest> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (id<LibboxHTTPResponse> _Nullable)execute:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)randomUserAgent;
|
||||
- (void)setContent:(NSData* _Nullable)content;
|
||||
- (void)setContentString:(NSString* _Nullable)content;
|
||||
- (void)setHeader:(NSString* _Nullable)key value:(NSString* _Nullable)value;
|
||||
- (void)setMethod:(NSString* _Nullable)method;
|
||||
- (BOOL)setURL:(NSString* _Nullable)link error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)setUserAgent:(NSString* _Nullable)userAgent;
|
||||
@end
|
||||
|
||||
@interface LibboxHTTPResponse : NSObject <goSeqRefInterface, LibboxHTTPResponse> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSData* _Nullable)getContent:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)getContentString:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)writeTo:(NSString* _Nullable)path error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface LibboxInterfaceUpdateListener : NSObject <goSeqRefInterface, LibboxInterfaceUpdateListener> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (void)updateDefaultInterface:(NSString* _Nullable)interfaceName interfaceIndex:(int32_t)interfaceIndex;
|
||||
@end
|
||||
|
||||
@interface LibboxLocalDNSTransport : NSObject <goSeqRefInterface, LibboxLocalDNSTransport> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)exchange:(LibboxExchangeContext* _Nullable)ctx message:(NSData* _Nullable)message error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)lookup:(LibboxExchangeContext* _Nullable)ctx network:(NSString* _Nullable)network domain:(NSString* _Nullable)domain error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)raw;
|
||||
@end
|
||||
|
||||
@interface LibboxNetworkInterfaceIterator : NSObject <goSeqRefInterface, LibboxNetworkInterfaceIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxNetworkInterface* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOnDemandRule : NSObject <goSeqRefInterface, LibboxOnDemandRule> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsSearchDomainMatch;
|
||||
- (id<LibboxStringIterator> _Nullable)dnsServerAddressMatch;
|
||||
- (int32_t)interfaceTypeMatch;
|
||||
- (NSString* _Nonnull)probeURL;
|
||||
- (id<LibboxStringIterator> _Nullable)ssidMatch;
|
||||
- (int32_t)target;
|
||||
@end
|
||||
|
||||
@interface LibboxOnDemandRuleIterator : NSObject <goSeqRefInterface, LibboxOnDemandRuleIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (id<LibboxOnDemandRule> _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupItemIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupItemIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroupItem* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxOutboundGroupIterator : NSObject <goSeqRefInterface, LibboxOutboundGroupIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxOutboundGroup* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxPlatformInterface : NSObject <goSeqRefInterface, LibboxPlatformInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)autoDetectInterfaceControl:(int32_t)fd error:(NSError* _Nullable* _Nullable)error;
|
||||
- (void)clearDNSCache;
|
||||
- (BOOL)closeDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)findConnectionOwner:(int32_t)ipProtocol sourceAddress:(NSString* _Nullable)sourceAddress sourcePort:(int32_t)sourcePort destinationAddress:(NSString* _Nullable)destinationAddress destinationPort:(int32_t)destinationPort ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxNetworkInterfaceIterator> _Nullable)getInterfaces:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)includeAllNetworks;
|
||||
- (BOOL)openTun:(id<LibboxTunOptions> _Nullable)options ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (NSString* _Nonnull)packageNameByUid:(int32_t)uid error:(NSError* _Nullable* _Nullable)error;
|
||||
- (LibboxWIFIState* _Nullable)readWIFIState;
|
||||
- (BOOL)startDefaultInterfaceMonitor:(id<LibboxInterfaceUpdateListener> _Nullable)listener error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)uidByPackageName:(NSString* _Nullable)packageName ret0_:(int32_t* _Nullable)ret0_ error:(NSError* _Nullable* _Nullable)error;
|
||||
- (BOOL)underNetworkExtension;
|
||||
- (BOOL)usePlatformAutoDetectInterfaceControl;
|
||||
- (BOOL)usePlatformDefaultInterfaceMonitor;
|
||||
- (BOOL)usePlatformInterfaceGetter;
|
||||
- (BOOL)useProcFS;
|
||||
- (void)writeLog:(NSString* _Nullable)message;
|
||||
@end
|
||||
|
||||
@interface LibboxProfilePreviewIterator : NSObject <goSeqRefInterface, LibboxProfilePreviewIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxProfilePreview* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxRoutePrefixIterator : NSObject <goSeqRefInterface, LibboxRoutePrefixIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (LibboxRoutePrefix* _Nullable)next;
|
||||
@end
|
||||
|
||||
@interface LibboxStringIterator : NSObject <goSeqRefInterface, LibboxStringIterator> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)hasNext;
|
||||
- (NSString* _Nonnull)next;
|
||||
@end
|
||||
|
||||
@interface LibboxTunInterface : NSObject <goSeqRefInterface, LibboxTunInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)close:(NSError* _Nullable* _Nullable)error;
|
||||
- (int32_t)fileDescriptor;
|
||||
@end
|
||||
|
||||
@interface LibboxTunOptions : NSObject <goSeqRefInterface, LibboxTunOptions> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (BOOL)getAutoRoute;
|
||||
- (NSString* _Nonnull)getDNSServerAddress:(NSError* _Nullable* _Nullable)error;
|
||||
- (id<LibboxStringIterator> _Nullable)getExcludePackage;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyBypassDomain;
|
||||
- (id<LibboxStringIterator> _Nullable)getHTTPProxyMatchDomain;
|
||||
- (NSString* _Nonnull)getHTTPProxyServer;
|
||||
- (int32_t)getHTTPProxyServerPort;
|
||||
- (id<LibboxStringIterator> _Nullable)getIncludePackage;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet4RouteRange;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6Address;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteExcludeAddress;
|
||||
- (id<LibboxRoutePrefixIterator> _Nullable)getInet6RouteRange;
|
||||
- (int32_t)getMTU;
|
||||
- (BOOL)getStrictRoute;
|
||||
- (BOOL)isHTTPProxyEnabled;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
||||
framework module Libbox {
|
||||
header "ref.h"
|
||||
header "Libbox.objc.h"
|
||||
header "Universe.objc.h"
|
||||
export *
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
||||
+1
@@ -0,0 +1 @@
|
||||
A
|
||||
@@ -0,0 +1,16 @@
|
||||
// swift-tools-version: 5.9
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "LibboxLocal",
|
||||
platforms: [.iOS(.v15), .macOS(.v13), .tvOS(.v17)],
|
||||
products: [
|
||||
.library(name: "Libbox", targets: ["Libbox"]),
|
||||
],
|
||||
targets: [
|
||||
.binaryTarget(
|
||||
name: "Libbox",
|
||||
path: "Libbox.xcframework"
|
||||
),
|
||||
]
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
import Foundation
|
||||
import Libbox
|
||||
import SwiftUI
|
||||
import UniformTypeIdentifiers
|
||||
import Libbox
|
||||
|
||||
public extension Profile {
|
||||
func toContent() throws -> LibboxProfileContent {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Libbox
|
||||
import Network
|
||||
import Libbox
|
||||
|
||||
public class NWSocket {
|
||||
private let connection: NWConnection
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Libbox
|
||||
import Network
|
||||
import Libbox
|
||||
|
||||
public class ProfileServer {
|
||||
private var listener: NWListener
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import Libbox
|
||||
import NetworkExtension
|
||||
import Libbox
|
||||
|
||||
func runBlocking<T>(_ block: @escaping () async -> T) -> T {
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import Foundation
|
||||
import Libbox
|
||||
import NetworkExtension
|
||||
#if canImport(CoreWLAN)
|
||||
import CoreWLAN
|
||||
#endif
|
||||
import Libbox
|
||||
|
||||
public class ExtensionPlatformInterface: NSObject, LibboxPlatformInterfaceProtocol, LibboxCommandServerHandlerProtocol {
|
||||
private let tunnel: ExtensionProvider
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user