mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-10-28 08:20:49 +08:00
feat(extensions): 使用 EasyFrp 替换 gostc
将扩展配置、接口和设置页切换为 EasyFrp,支持按行填写多个客户端连接 URL,通过 easyfrpc control 启动并校验协议与密钥路径。 旧 gostc 配置不自动启用 EasyFrp,升级后需重新配置;启动日志不再输出命令参数,避免暴露连接信息。 完整 Docker 镜像包含 easyfrpc、easytier-core、easytier-cli 和 frpc,通过独立下载脚本及版本锁定文件校验下载摘要和二进制架构。
This commit is contained in:
@@ -52,7 +52,7 @@ RUN if [ -n "$APT_MIRROR" ]; then \
|
||||
COPY --chmod=755 init.sh /init.sh
|
||||
|
||||
# Copy binaries (these are placed by the build script)
|
||||
COPY --chmod=755 one-kvm ttyd gostc easytier-core /usr/bin/
|
||||
COPY --chmod=755 one-kvm ttyd easyfrpc easytier-core easytier-cli frpc /usr/bin/
|
||||
|
||||
# Copy ventoy resources if they exist
|
||||
COPY ventoy/ /etc/one-kvm/ventoy/
|
||||
|
||||
68
build/download-remote-tools.py
Normal file
68
build/download-remote-tools.py
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fetch the pinned EasyFrp, EasyTier and frp clients for full Docker images."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path, PurePosixPath
|
||||
import shutil
|
||||
import struct
|
||||
import tarfile
|
||||
import tempfile
|
||||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
|
||||
def install(platform, output):
|
||||
architecture = {'linux/amd64': 'x86_64', 'linux/arm64': 'aarch64',
|
||||
'linux/arm/v7': 'arm'}[platform]
|
||||
lock = json.loads(Path(__file__).with_name('remote-access.lock.json').read_text())
|
||||
output.mkdir(parents=True, exist_ok=True)
|
||||
expected = {'arm': (1, 40), 'aarch64': (2, 183), 'x86_64': (2, 62)}[architecture]
|
||||
opener = urllib.request.build_opener(
|
||||
urllib.request.ProxyHandler({'http': os.environ['CURL_PROXY'], 'https': os.environ['CURL_PROXY']})
|
||||
) if os.environ.get('CURL_PROXY') else urllib.request.build_opener()
|
||||
# Validate the entire download before replacing any staged executable.
|
||||
with tempfile.TemporaryDirectory(prefix='one-kvm-remote-tools-') as temporary:
|
||||
staging = Path(temporary)
|
||||
for spec in lock['tools'].values():
|
||||
asset = spec['assets'][architecture]
|
||||
archive = staging / asset['archive']
|
||||
prefix = os.environ.get('GHPROXY_PREFIX', '').rstrip('/')
|
||||
url = prefix + '/' + asset['url'] if prefix else asset['url']
|
||||
with opener.open(url, timeout=120) as response:
|
||||
with archive.open('wb') as stream:
|
||||
shutil.copyfileobj(response, stream)
|
||||
if hashlib.sha256(archive.read_bytes()).hexdigest() != asset['sha256']:
|
||||
raise ValueError('release checksum differs: ' + archive.name)
|
||||
for name in spec['binaries']:
|
||||
if zipfile.is_zipfile(archive):
|
||||
with zipfile.ZipFile(archive) as source:
|
||||
matches = [item for item in source.infolist()
|
||||
if not item.is_dir() and PurePosixPath(item.filename).name == name]
|
||||
if len(matches) != 1:
|
||||
raise ValueError('expected one executable: ' + name)
|
||||
data = source.read(matches[0])
|
||||
else:
|
||||
with tarfile.open(archive, 'r:gz') as source:
|
||||
matches = [item for item in source if item.isfile() and PurePosixPath(item.name).name == name]
|
||||
if len(matches) != 1:
|
||||
raise ValueError('expected one executable: ' + name)
|
||||
data = source.extractfile(matches[0]).read()
|
||||
if (data[:4] != b'\x7fELF' or data[5] != 1
|
||||
or (data[4], struct.unpack('<H', data[18:20])[0]) != expected):
|
||||
raise ValueError('executable architecture differs: ' + name)
|
||||
path = staging / name
|
||||
path.write_bytes(data)
|
||||
path.chmod(0o755)
|
||||
for spec in lock['tools'].values():
|
||||
for name in spec['binaries']:
|
||||
shutil.copy2(staging / name, output / name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--platform', required=True, choices=('linux/amd64', 'linux/arm64', 'linux/arm/v7'))
|
||||
parser.add_argument('--output', required=True, type=Path)
|
||||
args = parser.parse_args()
|
||||
install(args.platform, args.output)
|
||||
@@ -118,7 +118,7 @@ while [[ $# -gt 0 ]]; do
|
||||
echo " # Build for current platform and load locally"
|
||||
echo " $0 --platform linux/arm64 --load"
|
||||
echo ""
|
||||
echo " # Build full image (includes gostc + easytier)"
|
||||
echo " # Build full image (includes EasyFrp + EasyTier + frpc)"
|
||||
echo " $0 --variant full --platform linux/arm64 --load"
|
||||
echo ""
|
||||
echo " # Build and push single platform"
|
||||
@@ -184,21 +184,12 @@ get_tool_urls() {
|
||||
case "$platform" in
|
||||
"linux/amd64")
|
||||
TTYD_URL="https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.x86_64"
|
||||
GOSTC_URL="https://github.com/SianHH/gostc-open/releases/download/v2.0.9/gostc_linux_amd64_v1.tar.gz"
|
||||
EASYTIER_URL="https://github.com/EasyTier/EasyTier/releases/download/v2.4.5/easytier-linux-x86_64-v2.4.5.zip"
|
||||
EASYTIER_DIR="easytier-linux-x86_64"
|
||||
;;
|
||||
"linux/arm64")
|
||||
TTYD_URL="https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.aarch64"
|
||||
GOSTC_URL="https://github.com/SianHH/gostc-open/releases/download/v2.0.9/gostc_linux_arm64_v8.0.tar.gz"
|
||||
EASYTIER_URL="https://github.com/EasyTier/EasyTier/releases/download/v2.4.5/easytier-linux-aarch64-v2.4.5.zip"
|
||||
EASYTIER_DIR="easytier-linux-aarch64"
|
||||
;;
|
||||
"linux/arm/v7")
|
||||
TTYD_URL="https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.armhf"
|
||||
GOSTC_URL="https://github.com/SianHH/gostc-open/releases/download/v2.0.9/gostc_linux_arm_7.tar.gz"
|
||||
EASYTIER_URL="https://github.com/EasyTier/EasyTier/releases/download/v2.4.5/easytier-linux-armv7hf-v2.4.5.zip"
|
||||
EASYTIER_DIR="easytier-linux-armv7hf"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -231,22 +222,9 @@ download_tools() {
|
||||
fi
|
||||
|
||||
if [ "$INCLUDE_THIRD_PARTY" = true ]; then
|
||||
# gostc
|
||||
if [ ! -f "$staging/gostc" ]; then
|
||||
dl "$GOSTC_URL" /tmp/gostc.tar.gz
|
||||
tar -xzf /tmp/gostc.tar.gz -C "$staging"
|
||||
chmod +x "$staging/gostc"
|
||||
rm /tmp/gostc.tar.gz
|
||||
fi
|
||||
python3 "$PROJECT_ROOT/build/download-remote-tools.py" \
|
||||
--platform "$platform" --output "$staging"
|
||||
|
||||
# easytier
|
||||
if [ ! -f "$staging/easytier-core" ]; then
|
||||
dl "$EASYTIER_URL" /tmp/easytier.zip
|
||||
unzip -o /tmp/easytier.zip -d /tmp/easytier
|
||||
cp "/tmp/easytier/$EASYTIER_DIR/easytier-core" "$staging/easytier-core"
|
||||
chmod +x "$staging/easytier-core"
|
||||
rm -rf /tmp/easytier.zip /tmp/easytier
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
74
build/remote-access.lock.json
Normal file
74
build/remote-access.lock.json
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"tools": {
|
||||
"easyfrp": {
|
||||
"version": "v3.1.1",
|
||||
"binaries": [
|
||||
"easyfrpc"
|
||||
],
|
||||
"assets": {
|
||||
"arm": {
|
||||
"archive": "easyfrpc_linux_arm_7.tar.gz",
|
||||
"url": "https://github.com/SianHH/easyfrp/releases/download/v3.1.1/easyfrpc_linux_arm_7.tar.gz",
|
||||
"sha256": "98fa5c95a01295b59043d2869251a63249d286813b66544389f80d6fa3b07ae6"
|
||||
},
|
||||
"aarch64": {
|
||||
"archive": "easyfrpc_linux_arm64_v8.0.tar.gz",
|
||||
"url": "https://github.com/SianHH/easyfrp/releases/download/v3.1.1/easyfrpc_linux_arm64_v8.0.tar.gz",
|
||||
"sha256": "cbd6c21fcd4d1921ee86879a4e90f1abffeb49324cbf8b31b1fc4581523b34d9"
|
||||
},
|
||||
"x86_64": {
|
||||
"archive": "easyfrpc_linux_amd64_v1.tar.gz",
|
||||
"url": "https://github.com/SianHH/easyfrp/releases/download/v3.1.1/easyfrpc_linux_amd64_v1.tar.gz",
|
||||
"sha256": "e744618a57305c3a6a866cc2e08ca09da22dad1cd1a4aa5216ab10ebf7ba16ec"
|
||||
}
|
||||
}
|
||||
},
|
||||
"easytier": {
|
||||
"version": "v2.6.4",
|
||||
"binaries": [
|
||||
"easytier-core",
|
||||
"easytier-cli"
|
||||
],
|
||||
"assets": {
|
||||
"arm": {
|
||||
"archive": "easytier-linux-armv7hf-v2.6.4.zip",
|
||||
"url": "https://github.com/EasyTier/EasyTier/releases/download/v2.6.4/easytier-linux-armv7hf-v2.6.4.zip",
|
||||
"sha256": "af0186ce95ffbe90b0e9dc8df0e9a01563f59e94ea52212651950c34dc35ac37"
|
||||
},
|
||||
"aarch64": {
|
||||
"archive": "easytier-linux-aarch64-v2.6.4.zip",
|
||||
"url": "https://github.com/EasyTier/EasyTier/releases/download/v2.6.4/easytier-linux-aarch64-v2.6.4.zip",
|
||||
"sha256": "f533ec25a7ea714e09f645615012200278058525795cc3bb690ff011aec1a70f"
|
||||
},
|
||||
"x86_64": {
|
||||
"archive": "easytier-linux-x86_64-v2.6.4.zip",
|
||||
"url": "https://github.com/EasyTier/EasyTier/releases/download/v2.6.4/easytier-linux-x86_64-v2.6.4.zip",
|
||||
"sha256": "61b659eaedba658fa66fe47d17e1426cdd77e5d02fa15fed447bb4357c09dfd6"
|
||||
}
|
||||
}
|
||||
},
|
||||
"frp": {
|
||||
"version": "v0.71.1",
|
||||
"binaries": [
|
||||
"frpc"
|
||||
],
|
||||
"assets": {
|
||||
"arm": {
|
||||
"archive": "frp_0.71.1_linux_arm_hf.tar.gz",
|
||||
"url": "https://github.com/fatedier/frp/releases/download/v0.71.1/frp_0.71.1_linux_arm_hf.tar.gz",
|
||||
"sha256": "a40116f15f2a05b7001f985f1f1ccb2570e2aa41329b06de76a82e71495786db"
|
||||
},
|
||||
"aarch64": {
|
||||
"archive": "frp_0.71.1_linux_arm64.tar.gz",
|
||||
"url": "https://github.com/fatedier/frp/releases/download/v0.71.1/frp_0.71.1_linux_arm64.tar.gz",
|
||||
"sha256": "8edf590b0c396fa42f9c147121a76af83cfc2002b08f5aef0ea1008c43482019"
|
||||
},
|
||||
"x86_64": {
|
||||
"archive": "frp_0.71.1_linux_amd64.tar.gz",
|
||||
"url": "https://github.com/fatedier/frp/releases/download/v0.71.1/frp_0.71.1_linux_amd64.tar.gz",
|
||||
"sha256": "1d9875210972a5d1a62b2dc4c48df45ab0af05d3ca1b5e494a014428259df803"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user