Compare commits
221 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
33ff9554cd | ||
![]() |
975b4e7664 | ||
![]() |
1f6a715939 | ||
![]() |
8e7a8de5e5 | ||
![]() |
4f53fccd25 | ||
![]() |
876d550f68 | ||
![]() |
2660ed5fda | ||
![]() |
50c6f5ae6c | ||
![]() |
85f0091056 | ||
![]() |
e25cd9be37 | ||
![]() |
1fb5ca9475 | ||
![]() |
7f3a9c021c | ||
![]() |
0427b48d75 | ||
![]() |
0b729b99e7 | ||
![]() |
940238f158 | ||
![]() |
3f6c7ba1d2 | ||
![]() |
0025973453 | ||
![]() |
c3a217c9d2 | ||
![]() |
13c2e72871 | ||
![]() |
3c65594030 | ||
![]() |
f85b031402 | ||
![]() |
ac3e994682 | ||
![]() |
139f6b3c4c | ||
![]() |
a4bb555fac | ||
![]() |
d0cfc49806 | ||
![]() |
01e491ec07 | ||
![]() |
bf021a9ead | ||
![]() |
70e69a382e | ||
![]() |
cd26d9f669 | ||
![]() |
4fd0253e99 | ||
![]() |
ebab70ca3b | ||
![]() |
ae4a158e36 | ||
![]() |
760a1e6306 | ||
![]() |
fded8b1de0 | ||
![]() |
762d5cd392 | ||
![]() |
09ac79b9f3 | ||
![]() |
16f6fb0c59 | ||
![]() |
385e790600 | ||
![]() |
95e4e5a931 | ||
![]() |
e1bfec6fe2 | ||
![]() |
dde7a4dff1 | ||
![]() |
40601bd05b | ||
![]() |
72d5ed908e | ||
![]() |
72673a9d52 | ||
![]() |
327ccdcf38 | ||
![]() |
8c2f96d1aa | ||
![]() |
34ba0bc95b | ||
![]() |
ed162c2e66 | ||
![]() |
40b5fe9a54 | ||
![]() |
5a98fac395 | ||
![]() |
0bab14cd72 | ||
![]() |
b407cfd9d4 | ||
![]() |
25dcdc652a | ||
![]() |
950cb04534 | ||
![]() |
c07d1286ef | ||
![]() |
8ddd153022 | ||
![]() |
870353c499 | ||
![]() |
ecebbecd3b | ||
![]() |
f39fbb2ce2 | ||
![]() |
ec56c0bc45 | ||
![]() |
20a6025075 | ||
![]() |
707963c0d9 | ||
![]() |
3c7837692e | ||
![]() |
f890812577 | ||
![]() |
47f3efe71b | ||
![]() |
6d88b10b14 | ||
![]() |
d34a51739f | ||
![]() |
a6773aa549 | ||
![]() |
0314c66635 | ||
![]() |
3fb172b4d2 | ||
![]() |
96fc19b803 | ||
![]() |
9f7ba8ab8f | ||
![]() |
e592e9f29a | ||
![]() |
4608bca998 | ||
![]() |
b5dfc7374c | ||
![]() |
b469f8197a | ||
![]() |
0a38a8ef4a | ||
![]() |
e75be7801f | ||
![]() |
6c49bb1865 | ||
![]() |
f9c24bc205 | ||
![]() |
d7c3179c6e | ||
![]() |
b0fd37949a | ||
![]() |
29994b663a | ||
![]() |
fc397c35c5 | ||
![]() |
0f2b214918 | ||
![]() |
fec885c427 | ||
![]() |
5a2fd4465c | ||
![]() |
83d1ecc4da | ||
![]() |
7c6daf7c56 | ||
![]() |
28fe6257be | ||
![]() |
99430983bc | ||
![]() |
d758a4958f | ||
![]() |
95b12dda5a | ||
![]() |
2675cf2d00 | ||
![]() |
72be46e8fa | ||
![]() |
c5580feb64 | ||
![]() |
7e3819be86 | ||
![]() |
f0302f2be7 | ||
![]() |
b5f60f843d | ||
![]() |
6bdfb8b01f | ||
![]() |
ef1d81a2a1 | ||
![]() |
739b4ee106 | ||
![]() |
6a038e8a88 | ||
![]() |
72ea8a9f76 | ||
![]() |
44d93648ee | ||
![]() |
75f7865769 | ||
![]() |
01e3ad99ca | ||
![]() |
3c0d85c9db | ||
![]() |
b38991a14e | ||
![]() |
465269566b | ||
![]() |
f103fc13d9 | ||
![]() |
e5917fad4e | ||
![]() |
de8c89eb03 | ||
![]() |
c142db301a | ||
![]() |
8dc8c7d9e2 | ||
![]() |
2b909e04ea | ||
![]() |
e130c3f2e4 | ||
![]() |
3ad754879f | ||
![]() |
fd2b3768e1 | ||
![]() |
67cff12c76 | ||
![]() |
c5ea7848b3 | ||
![]() |
34365a096e | ||
![]() |
d880dfbbca | ||
![]() |
b46a200f8d | ||
![]() |
81490d0662 | ||
![]() |
3d1e841cc5 | ||
![]() |
f52936a103 | ||
![]() |
23f69ce6a4 | ||
![]() |
f84ae228fc | ||
![]() |
74c716ccaa | ||
![]() |
445b02b2ca | ||
![]() |
bb17ffa9fc | ||
![]() |
389ea709ce | ||
![]() |
c2f535ead4 | ||
![]() |
0318f55322 | ||
![]() |
1f4340e82f | ||
![]() |
ed08707c98 | ||
![]() |
7397abcb94 | ||
![]() |
98d321f8ac | ||
![]() |
e78b0ef869 | ||
![]() |
8d654330ac | ||
![]() |
00d61333d3 | ||
![]() |
03b55b61e7 | ||
![]() |
745e44cc87 | ||
![]() |
24213a874a | ||
![]() |
155f8a2ba2 | ||
![]() |
568dca6f9c | ||
![]() |
673c34cf5a | ||
![]() |
2050ed78d0 | ||
![]() |
2632c44195 | ||
![]() |
5449eabf2a | ||
![]() |
dd5b00faf4 | ||
![]() |
0caec3e4da | ||
![]() |
e48e62cac0 | ||
![]() |
06ebda2e2f | ||
![]() |
53c449b9fb | ||
![]() |
51e0fac72c | ||
![]() |
32b1fe0893 | ||
![]() |
2af3b82e32 | ||
![]() |
eca1231831 | ||
![]() |
e833c2a28b | ||
![]() |
8b89a037e8 | ||
![]() |
1e821a03fe | ||
![]() |
66051967fe | ||
![]() |
a63778854f | ||
![]() |
4aea0821dd | ||
![]() |
08546925cc | ||
![]() |
d0f26d9303 | ||
![]() |
2a5d5ea4df | ||
![]() |
b69b122c8d | ||
![]() |
55a39491cb | ||
![]() |
1194ee1c2d | ||
![]() |
c23b544c34 | ||
![]() |
9d76b86f49 | ||
![]() |
bb0ccca3e5 | ||
![]() |
306817ae9a | ||
![]() |
d2ec60e108 | ||
![]() |
e016aeddeb | ||
![]() |
a4419a31fd | ||
![]() |
34e4e907a9 | ||
![]() |
2f4a097787 | ||
![]() |
f3de00be37 | ||
![]() |
4cf61f0d4a | ||
![]() |
4e5915f98e | ||
![]() |
870eca9e9f | ||
![]() |
25ed41caf5 | ||
![]() |
4bb72b5606 | ||
![]() |
c4d8ea4fec | ||
![]() |
8588c9201a | ||
![]() |
dd2236c697 | ||
![]() |
bc7c4d8cd0 | ||
![]() |
aed54f7318 | ||
![]() |
86600c6315 | ||
![]() |
3f47f37470 | ||
![]() |
1324e6163e | ||
![]() |
89093167c6 | ||
![]() |
15ad92aef2 | ||
![]() |
6cdea38284 | ||
![]() |
9d455e22fa | ||
![]() |
4fc3ff8ce8 | ||
![]() |
88e6de9d7e | ||
![]() |
e948dbfcc1 | ||
![]() |
8aca5851f2 | ||
![]() |
18da94bf33 | ||
![]() |
1ac2e1c8e3 | ||
![]() |
a78b759741 | ||
![]() |
b5c3726e67 | ||
![]() |
efee3707da | ||
![]() |
bbd3453f36 | ||
![]() |
0bf42c53cc | ||
![]() |
2134bc9139 | ||
![]() |
4df8d7e976 | ||
![]() |
70708b34cc | ||
![]() |
949003ee1b | ||
![]() |
db9df1df94 | ||
![]() |
4dca25db86 | ||
![]() |
d87a440c04 | ||
![]() |
55efd62798 | ||
![]() |
70a41275c1 | ||
![]() |
dd941681ce | ||
![]() |
9824d0adaa |
@@ -5,73 +5,99 @@ rustflags = ["-C", "linker-flavor=ld.lld"]
|
|||||||
[target.aarch64-unknown-linux-gnu]
|
[target.aarch64-unknown-linux-gnu]
|
||||||
linker = "aarch64-linux-gnu-gcc"
|
linker = "aarch64-linux-gnu-gcc"
|
||||||
|
|
||||||
|
[target.aarch64-unknown-linux-ohos]
|
||||||
|
ar = "/usr/local/ohos-sdk/linux/native/llvm/bin/llvm-ar"
|
||||||
|
linker = "/home/runner/sdk/native/llvm/aarch64-unknown-linux-ohos-clang.sh"
|
||||||
|
|
||||||
|
[target.aarch64-unknown-linux-ohos.env]
|
||||||
|
PKG_CONFIG_PATH = "/usr/local/ohos-sdk/linux/native/sysroot/usr/lib/pkgconfig:/usr/local/ohos-sdk/linux/native/sysroot/usr/local/lib/pkgconfig"
|
||||||
|
PKG_CONFIG_LIBDIR = "/usr/local/ohos-sdk/linux/native/sysroot/usr/lib:/usr/local/ohos-sdk/linux/native/sysroot/usr/local/lib"
|
||||||
|
PKG_CONFIG_SYSROOT_DIR = "/usr/local/ohos-sdk/linux/native/sysroot"
|
||||||
|
SYSROOT = "/usr/local/ohos-sdk/linux/native/sysroot"
|
||||||
|
|
||||||
[target.aarch64-unknown-linux-musl]
|
[target.aarch64-unknown-linux-musl]
|
||||||
linker = "aarch64-linux-musl-gcc"
|
linker = "aarch64-unknown-linux-musl-gcc"
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
|
||||||
[target.'cfg(all(windows, target_env = "msvc"))']
|
[target.'cfg(all(windows, target_env = "msvc"))']
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
|
||||||
[target.mipsel-unknown-linux-musl]
|
[target.mipsel-unknown-linux-musl]
|
||||||
linker = "mipsel-linux-muslsf-gcc"
|
linker = "mipsel-unknown-linux-muslsf-gcc"
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"-C",
|
"-C",
|
||||||
"target-feature=+crt-static",
|
"target-feature=+crt-static",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/mipsel-linux-muslsf-cross/mipsel-linux-muslsf/lib",
|
"./musl_gcc/mipsel-unknown-linux-muslsf/mipsel-unknown-linux-muslsf/lib",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/mipsel-linux-muslsf-cross/lib/gcc/mipsel-linux-muslsf/11.2.1",
|
"./musl_gcc/mipsel-unknown-linux-muslsf/mipsel-unknown-linux-muslsf/sysroot/usr/lib",
|
||||||
|
"-L",
|
||||||
|
"./musl_gcc/mipsel-unknown-linux-muslsf/lib/gcc/mipsel-unknown-linux-muslsf/15.1.0",
|
||||||
"-l",
|
"-l",
|
||||||
"atomic",
|
"atomic",
|
||||||
"-l",
|
"-l",
|
||||||
"ctz",
|
"ctz",
|
||||||
|
"-l",
|
||||||
|
"gcc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[target.mips-unknown-linux-musl]
|
[target.mips-unknown-linux-musl]
|
||||||
linker = "mips-linux-muslsf-gcc"
|
linker = "mips-unknown-linux-muslsf-gcc"
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"-C",
|
"-C",
|
||||||
"target-feature=+crt-static",
|
"target-feature=+crt-static",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/mips-linux-muslsf-cross/mips-linux-muslsf/lib",
|
"./musl_gcc/mips-unknown-linux-muslsf/mips-unknown-linux-muslsf/lib",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/mips-linux-muslsf-cross/lib/gcc/mips-linux-muslsf/11.2.1",
|
"./musl_gcc/mips-unknown-linux-muslsf/mips-unknown-linux-muslsf/sysroot/usr/lib",
|
||||||
|
"-L",
|
||||||
|
"./musl_gcc/mips-unknown-linux-muslsf/lib/gcc/mips-unknown-linux-muslsf/15.1.0",
|
||||||
"-l",
|
"-l",
|
||||||
"atomic",
|
"atomic",
|
||||||
"-l",
|
"-l",
|
||||||
"ctz",
|
"ctz",
|
||||||
|
"-l",
|
||||||
|
"gcc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[target.armv7-unknown-linux-musleabihf]
|
[target.armv7-unknown-linux-musleabihf]
|
||||||
linker = "armv7l-linux-musleabihf-gcc"
|
linker = "armv7-unknown-linux-musleabihf-gcc"
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
|
||||||
[target.armv7-unknown-linux-musleabi]
|
[target.armv7-unknown-linux-musleabi]
|
||||||
linker = "armv7m-linux-musleabi-gcc"
|
linker = "armv7-unknown-linux-musleabi-gcc"
|
||||||
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
|
||||||
|
[target.loongarch64-unknown-linux-musl]
|
||||||
|
linker = "loongarch64-unknown-linux-musl-gcc"
|
||||||
rustflags = ["-C", "target-feature=+crt-static"]
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
|
||||||
[target.arm-unknown-linux-musleabihf]
|
[target.arm-unknown-linux-musleabihf]
|
||||||
linker = "arm-linux-musleabihf-gcc"
|
linker = "arm-unknown-linux-musleabihf-gcc"
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"-C",
|
"-C",
|
||||||
"target-feature=+crt-static",
|
"target-feature=+crt-static",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/arm-linux-musleabihf-cross/arm-linux-musleabihf/lib",
|
"./musl_gcc/arm-unknown-linux-musleabihf/arm-unknown-linux-musleabihf/lib",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/arm-linux-musleabihf-cross/lib/gcc/arm-linux-musleabihf/11.2.1",
|
"./musl_gcc/arm-unknown-linux-musleabihf/lib/gcc/arm-unknown-linux-musleabihf/15.1.0",
|
||||||
"-l",
|
"-l",
|
||||||
"atomic",
|
"atomic",
|
||||||
|
"-l",
|
||||||
|
"gcc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[target.arm-unknown-linux-musleabi]
|
[target.arm-unknown-linux-musleabi]
|
||||||
linker = "arm-linux-musleabi-gcc"
|
linker = "arm-unknown-linux-musleabi-gcc"
|
||||||
rustflags = [
|
rustflags = [
|
||||||
"-C",
|
"-C",
|
||||||
"target-feature=+crt-static",
|
"target-feature=+crt-static",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/arm-linux-musleabi-cross/arm-linux-musleabi/lib",
|
"./musl_gcc/arm-unknown-linux-musleabi/arm-unknown-linux-musleabi/lib",
|
||||||
"-L",
|
"-L",
|
||||||
"./musl_gcc/arm-linux-musleabi-cross/lib/gcc/arm-linux-musleabi/11.2.1",
|
"./musl_gcc/arm-unknown-linux-musleabi/lib/gcc/arm-unknown-linux-musleabi/15.1.0",
|
||||||
"-l",
|
"-l",
|
||||||
"atomic",
|
"atomic",
|
||||||
|
"-l",
|
||||||
|
"gcc",
|
||||||
]
|
]
|
||||||
|
108
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -23,31 +23,113 @@ body:
|
|||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
label: 描述问题 / Describe the bug
|
label: 问题简要描述 / Brief Description
|
||||||
description: 对 bug 的明确描述。如果条件允许,请包括屏幕截图。 / A clear description of what the bug is. Include screenshots if applicable.
|
description: 对问题的简要描述,包括期望的行为和实际发生的情况。 / A brief description of the issue, including expected vs actual behavior.
|
||||||
placeholder: 问题描述 / Bug description
|
placeholder: |
|
||||||
|
例如:节点 A 无法连接到节点 B,期望能够正常建立连接
|
||||||
|
Example: Node A cannot connect to Node B, expected to establish connection normally
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: environment-info
|
||||||
|
attributes:
|
||||||
|
label: 环境信息 / Environment Information
|
||||||
|
description: 请提供网络拓扑、节点信息和系统环境详情。 / Please provide network topology, node information and system environment details.
|
||||||
|
placeholder: |
|
||||||
|
**EasyTier 版本(非常重要)/ EasyTier Version (Very Important):** v1.2.0
|
||||||
|
|
||||||
|
**网络拓扑 / Network Topology:**
|
||||||
|
- 节点 A (10.1.1.1): Windows 11 Pro 22H2, Wifi,有 IPV6 地址
|
||||||
|
- 节点 B (10.1.1.2): Ubuntu 22.04.3 LTS (Linux 5.15.0-72-generic), 公网 IP
|
||||||
|
- 节点 C (10.1.1.3): macOS Ventura 13.4.1, 5G 流量,无 IPV6 地址
|
||||||
|
|
||||||
|
**Network Topology:**
|
||||||
|
- Node A (10.1.1.1): Windows 11 Pro 22H2, Wifi, has IPV6 address
|
||||||
|
- Node B (10.1.1.2): Ubuntu 22.04.3 LTS (Linux 5.15.0-72-generic), public IP
|
||||||
|
- Node C (10.1.1.3): macOS Ventura 13.4.1, 5G traffic, no IPV6 address
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: node-configs
|
||||||
|
attributes:
|
||||||
|
label: 节点配置 / Node Configurations
|
||||||
|
description: 请提供每个节点的配置文件或启动参数。 / Please provide configuration files or startup parameters for each node.
|
||||||
|
placeholder: |
|
||||||
|
**节点 A 配置 / Node A Config:**
|
||||||
|
```
|
||||||
|
easytier-core --config-file config.toml
|
||||||
|
```
|
||||||
|
|
||||||
|
**节点 B 配置 / Node B Config:**
|
||||||
|
```
|
||||||
|
easytier-core --ipv4 10.1.1.2 --peers tcp://1.2.3.4:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
请贴出完整的配置文件内容或命令行参数
|
||||||
|
Please paste complete configuration file contents or command line arguments
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: logs
|
||||||
|
attributes:
|
||||||
|
label: 日志信息 / Log Information
|
||||||
|
description: 请提供相关的日志信息,包括 GUI 的事件日志或命令行的控制台输出。 / Please provide relevant log information, including GUI event logs or command line console output.
|
||||||
|
placeholder: |
|
||||||
|
请粘贴相关的日志信息:
|
||||||
|
- GUI 用户:请提供事件日志中的错误信息
|
||||||
|
- 命令行用户:请提供控制台输出的详细日志
|
||||||
|
- 一般情况下,提供默认输出的事件日志即可
|
||||||
|
- 如果能提供 --file-log-level debug 输出的日志,会更方便 debug
|
||||||
|
|
||||||
|
Please paste relevant log information:
|
||||||
|
- GUI users: Please provide error messages from event logs
|
||||||
|
- CLI users: Please provide detailed console output logs
|
||||||
|
- Default log output is usually sufficient
|
||||||
|
- If possible, logs with --file-log-level debug would be more helpful for debugging
|
||||||
|
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: reproduction
|
id: reproduction
|
||||||
attributes:
|
attributes:
|
||||||
label: 重现步骤 / Reproduction
|
label: 重现步骤 / Reproduction Steps
|
||||||
description: 能够重现行为的步骤或指向能够复现的存储库链接。 / A link to a reproduction repo or steps to reproduce the behaviour.
|
description: 请提供详细的步骤来重现这个问题。 / Please provide detailed steps to reproduce this issue.
|
||||||
placeholder: |
|
placeholder: |
|
||||||
请提供一个最小化的复现示例或复现步骤,请参考这个指南 https://stackoverflow.com/help/minimal-reproducible-example
|
1. 启动节点 A,使用配置 xxx / Start Node A with config xxx
|
||||||
Please provide a minimal reproduction or steps to reproduce, see this guide https://stackoverflow.com/help/minimal-reproducible-example
|
2. 启动节点 B,使用配置 yyy / Start Node B with config yyy
|
||||||
为什么需要重现(问题)?请参阅这篇文章 https://antfu.me/posts/why-reproductions-are-required
|
3. 尝试从节点 A ping 节点 B / Try to ping Node B from Node A
|
||||||
Why reproduction is required? see this article https://antfu.me/posts/why-reproductions-are-required
|
4. 观察到错误:xxx / Observe error: xxx
|
||||||
|
|
||||||
|
请提供详细的操作步骤,以便我们能够重现问题
|
||||||
|
Please provide detailed steps so we can reproduce the issue
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: expected-behavior
|
id: expected-behavior
|
||||||
attributes:
|
attributes:
|
||||||
label: 预期结果 / Expected behavior
|
label: 预期结果 / Expected Behavior
|
||||||
description: 清楚地描述您期望发生的事情。 / A clear description of what you expected to happen.
|
description: 清楚地描述您期望发生的事情。 / A clear description of what you expected to happen.
|
||||||
|
placeholder: |
|
||||||
|
例如:节点 A 应该能够成功 ping 通节点 B,延迟在 100ms 以内
|
||||||
|
Example: Node A should be able to ping Node B successfully with latency under 100ms
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: context
|
id: additional-context
|
||||||
attributes:
|
attributes:
|
||||||
label: 额外上下文 / Additional context
|
label: 额外信息 / Additional Context
|
||||||
description: 在这里添加关于问题的任何其他上下文。 / Add any other context about the problem here.
|
description: 在这里添加关于问题的任何其他上下文信息。 / Add any other context about the problem here.
|
||||||
|
placeholder: |
|
||||||
|
例如:
|
||||||
|
- 这个问题是否在特定时间出现?
|
||||||
|
- 是否有网络环境的特殊配置?
|
||||||
|
- 是否尝试过其他解决方案?
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- Does this issue occur at specific times?
|
||||||
|
- Are there any special network environment configurations?
|
||||||
|
- Have you tried any other solutions?
|
171
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@@ -3,36 +3,177 @@
|
|||||||
|
|
||||||
name: 💡 新功能请求 / Feature Request
|
name: 💡 新功能请求 / Feature Request
|
||||||
title: '[feat] '
|
title: '[feat] '
|
||||||
description: 提出一个想法 / Suggest an idea
|
description: 提出一个想法 / Suggest an idea
|
||||||
labels: ['type: feature request']
|
labels: ['type: feature request']
|
||||||
|
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: markdown
|
||||||
id: problem
|
|
||||||
attributes:
|
attributes:
|
||||||
label: 描述问题 / Describe the problem
|
value: |
|
||||||
description: 明确描述此功能将解决的问题 / A clear description of the problem this feature would solve
|
## 提交功能请求前请注意 / Before Submitting
|
||||||
placeholder: "我总是在...感觉困惑 / I'm always frustrated when..."
|
1. 请先搜索 [现有的功能请求](https://github.com/EasyTier/EasyTier/issues?q=is%3Aissue+label%3A%22type%3A+feature+request%22) 确保您的想法尚未被提出。
|
||||||
|
1. Please search [existing feature requests](https://github.com/EasyTier/EasyTier/issues?q=is%3Aissue+label%3A%22type%3A+feature+request%22) to ensure your idea hasn't been suggested already.
|
||||||
|
2. 请确保这个功能确实适合 EasyTier 项目的目标和范围。
|
||||||
|
2. Please ensure this feature fits within EasyTier's goals and scope.
|
||||||
|
3. 考虑这个功能是否能让更多用户受益,而不只是解决个人需求。
|
||||||
|
3. Consider whether this feature would benefit many users, not just personal needs.
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
id: feature-category
|
||||||
|
attributes:
|
||||||
|
label: 功能类别 / Feature Category
|
||||||
|
description: 请选择这个功能请求属于哪个类别 / Please select which category this feature request belongs to
|
||||||
|
options:
|
||||||
|
- 网络连接 / Network Connectivity
|
||||||
|
- 安全和加密 / Security & Encryption
|
||||||
|
- 性能优化 / Performance Optimization
|
||||||
|
- 用户界面 / User Interface
|
||||||
|
- 配置管理 / Configuration Management
|
||||||
|
- 监控和日志 / Monitoring & Logging
|
||||||
|
- 平台支持 / Platform Support
|
||||||
|
- API 和集成 / API & Integration
|
||||||
|
- 其他 / Other
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: solution
|
id: use-case
|
||||||
attributes:
|
attributes:
|
||||||
label: "描述您想要的解决方案 / Describe the solution you'd like"
|
label: 使用场景 / Use Case
|
||||||
description: 明确说明您希望做出的改变 / A clear description of what change you would like
|
description: 描述您希望这个功能解决的具体使用场景或问题 / Describe the specific use case or problem you want this feature to solve
|
||||||
placeholder: '我希望... / I would like to...'
|
placeholder: |
|
||||||
|
例如:
|
||||||
|
- 作为企业用户,我需要在多个分支机构之间建立安全的网络连接
|
||||||
|
- 作为开发者,我希望能够通过 API 监控网络状态
|
||||||
|
- 作为系统管理员,我需要更详细的连接日志来排查问题
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- As an enterprise user, I need to establish secure network connections between multiple branch offices
|
||||||
|
- As a developer, I want to monitor network status through APIs
|
||||||
|
- As a system administrator, I need more detailed connection logs for troubleshooting
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: current-limitations
|
||||||
|
attributes:
|
||||||
|
label: 当前限制 / Current Limitations
|
||||||
|
description: 描述当前 EasyTier 的哪些限制阻止了您实现这个使用场景 / Describe what current limitations in EasyTier prevent you from achieving this use case
|
||||||
|
placeholder: |
|
||||||
|
例如:
|
||||||
|
- 目前不支持基于用户角色的访问控制
|
||||||
|
- 缺少对 IPv6 的完整支持
|
||||||
|
- 没有提供 REST API 来获取网络状态
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- Currently lacks role-based access control
|
||||||
|
- Missing complete IPv6 support
|
||||||
|
- No REST API available for network status
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: proposed-solution
|
||||||
|
attributes:
|
||||||
|
label: 建议的解决方案 / Proposed Solution
|
||||||
|
description: 详细描述您希望添加的功能以及它应该如何工作 / Describe in detail the feature you'd like to add and how it should work
|
||||||
|
placeholder: |
|
||||||
|
请描述:
|
||||||
|
- 功能的具体实现方式
|
||||||
|
- 用户界面或 API 设计
|
||||||
|
- 配置选项和参数
|
||||||
|
- 与现有功能的集成方式
|
||||||
|
|
||||||
|
Please describe:
|
||||||
|
- Specific implementation approach
|
||||||
|
- User interface or API design
|
||||||
|
- Configuration options and parameters
|
||||||
|
- Integration with existing features
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: benefits
|
||||||
|
attributes:
|
||||||
|
label: 预期收益 / Expected Benefits
|
||||||
|
description: 说明这个功能会带来什么好处,会影响哪些用户群体 / Explain what benefits this feature would bring and which user groups it would affect
|
||||||
|
placeholder: |
|
||||||
|
例如:
|
||||||
|
- 提高网络连接的稳定性和性能
|
||||||
|
- 简化大规模部署的管理复杂度
|
||||||
|
- 增强企业用户的安全性需求
|
||||||
|
- 降低新用户的学习成本
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- Improve network connection stability and performance
|
||||||
|
- Simplify management complexity for large-scale deployments
|
||||||
|
- Enhance security requirements for enterprise users
|
||||||
|
- Reduce learning curve for new users
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: technical-considerations
|
||||||
|
attributes:
|
||||||
|
label: 技术考虑 / Technical Considerations
|
||||||
|
description: 如果您了解技术细节,请分享相关的技术考虑或约束 / If you have technical knowledge, please share relevant technical considerations or constraints
|
||||||
|
placeholder: |
|
||||||
|
例如:
|
||||||
|
- 可能需要修改网络协议栈
|
||||||
|
- 需要考虑跨平台兼容性
|
||||||
|
- 可能影响现有性能
|
||||||
|
- 依赖第三方库或协议
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- May require modifications to network protocol stack
|
||||||
|
- Cross-platform compatibility needs consideration
|
||||||
|
- Potential impact on existing performance
|
||||||
|
- Dependencies on third-party libraries or protocols
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: alternatives
|
id: alternatives
|
||||||
attributes:
|
attributes:
|
||||||
label: 替代方案 / Alternatives considered
|
label: 备选方案 / Alternative Solutions
|
||||||
description: "您考虑过的任何替代解决方案 / Any alternative solutions you've considered"
|
description: 您是否考虑过其他解决方案?是否有现有的替代方案? / Have you considered other solutions? Are there existing alternatives?
|
||||||
|
placeholder: |
|
||||||
|
例如:
|
||||||
|
- 使用第三方工具 X 可以部分解决,但缺少 Y 功能
|
||||||
|
- 通过脚本workaround可以实现,但不够优雅
|
||||||
|
- 其他类似项目 Z 有这个功能,可以参考其实现
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- Third-party tool X can partially solve this, but lacks Y functionality
|
||||||
|
- Can be achieved through script workarounds, but not elegant
|
||||||
|
- Similar project Z has this feature, could reference its implementation
|
||||||
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: context
|
id: implementation-priority
|
||||||
attributes:
|
attributes:
|
||||||
label: 额外上下文 / Additional context
|
label: 实现优先级 / Implementation Priority
|
||||||
description: 在此处添加有关问题的任何其他上下文。 / Add any other context about the problem here.
|
description: 这个功能对您有多重要?是否有时间要求? / How important is this feature to you? Any time requirements?
|
||||||
|
placeholder: |
|
||||||
|
例如:
|
||||||
|
- 高优先级:阻碍了我们的生产部署
|
||||||
|
- 中优先级:会显著改善用户体验
|
||||||
|
- 低优先级:锦上添花的功能
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- High priority: Blocking our production deployment
|
||||||
|
- Medium priority: Would significantly improve user experience
|
||||||
|
- Low priority: Nice-to-have feature
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: additional-context
|
||||||
|
attributes:
|
||||||
|
label: 补充信息 / Additional Context
|
||||||
|
description: 添加任何其他相关信息,如截图、链接、参考资料等 / Add any other relevant information such as screenshots, links, or references
|
||||||
|
placeholder: |
|
||||||
|
例如:
|
||||||
|
- 相关的 RFC 或技术规范
|
||||||
|
- 其他项目的实现示例
|
||||||
|
- 用户调研或反馈数据
|
||||||
|
- 设计草图或流程图
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- Relevant RFCs or technical specifications
|
||||||
|
- Implementation examples from other projects
|
||||||
|
- User research or feedback data
|
||||||
|
- Design sketches or flowcharts
|
16
.github/workflows/Dockerfile
vendored
@@ -1,11 +1,11 @@
|
|||||||
FROM alpine:latest AS builder
|
FROM alpine:latest AS base
|
||||||
|
FROM base AS builder
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
COPY . /tmp/artifacts
|
COPY . /tmp/artifacts
|
||||||
RUN mkdir -p /tmp/output; \
|
WORKDIR /tmp/output
|
||||||
cd /tmp/artifacts; \
|
RUN ARTIFACT_ARCH=""; \
|
||||||
ARTIFACT_ARCH=""; \
|
|
||||||
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
|
||||||
ARTIFACT_ARCH="x86_64"; \
|
ARTIFACT_ARCH="x86_64"; \
|
||||||
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
|
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
|
||||||
@@ -16,14 +16,14 @@ RUN mkdir -p /tmp/output; \
|
|||||||
fi; \
|
fi; \
|
||||||
cp /tmp/artifacts/easytier-linux-${ARTIFACT_ARCH}/* /tmp/output;
|
cp /tmp/artifacts/easytier-linux-${ARTIFACT_ARCH}/* /tmp/output;
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM base
|
||||||
|
|
||||||
RUN apk add --no-cache tzdata
|
RUN apk add --no-cache tzdata tini
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder --chmod=755 /tmp/output/* /usr/local/bin
|
COPY --from=builder --chmod=755 /tmp/output/* /usr/local/bin
|
||||||
|
|
||||||
# users can use "-e TZ=xxx" to adjust it
|
# users can use "-e TZ=xxx" to adjust it
|
||||||
ENV TZ Asia/Shanghai
|
ENV TZ=Asia/Shanghai
|
||||||
|
|
||||||
# tcp
|
# tcp
|
||||||
EXPOSE 11010/tcp
|
EXPOSE 11010/tcp
|
||||||
@@ -36,4 +36,4 @@ EXPOSE 11011/tcp
|
|||||||
# wss
|
# wss
|
||||||
EXPOSE 11012/tcp
|
EXPOSE 11012/tcp
|
||||||
|
|
||||||
ENTRYPOINT ["easytier-core"]
|
ENTRYPOINT ["/sbin/tini", "--", "easytier-core"]
|
||||||
|
216
.github/workflows/core.yml
vendored
@@ -31,36 +31,81 @@ jobs:
|
|||||||
skip_after_successful_duplicate: 'true'
|
skip_after_successful_duplicate: 'true'
|
||||||
cancel_others: 'true'
|
cancel_others: 'true'
|
||||||
paths: '["Cargo.toml", "Cargo.lock", "easytier/**", ".github/workflows/core.yml", ".github/workflows/install_rust.sh"]'
|
paths: '["Cargo.toml", "Cargo.lock", "easytier/**", ".github/workflows/core.yml", ".github/workflows/install_rust.sh"]'
|
||||||
|
build_web:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: pre_job
|
||||||
|
if: needs.pre_job.outputs.should_skip != 'true'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10
|
||||||
|
run_install: false
|
||||||
|
|
||||||
|
- name: Get pnpm store directory
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Setup pnpm cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.STORE_PATH }}
|
||||||
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
|
- name: Install frontend dependencies
|
||||||
|
run: |
|
||||||
|
pnpm -r install
|
||||||
|
pnpm -r --filter "./easytier-web/*" build
|
||||||
|
|
||||||
|
- name: Archive artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: easytier-web-dashboard
|
||||||
|
path: |
|
||||||
|
easytier-web/frontend/dist/*
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- TARGET: aarch64-unknown-linux-musl
|
- TARGET: aarch64-unknown-linux-musl
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
ARTIFACT_NAME: linux-aarch64
|
ARTIFACT_NAME: linux-aarch64
|
||||||
- TARGET: x86_64-unknown-linux-musl
|
- TARGET: x86_64-unknown-linux-musl
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
ARTIFACT_NAME: linux-x86_64
|
ARTIFACT_NAME: linux-x86_64
|
||||||
- TARGET: mips-unknown-linux-musl
|
- TARGET: mips-unknown-linux-musl
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
ARTIFACT_NAME: linux-mips
|
ARTIFACT_NAME: linux-mips
|
||||||
- TARGET: mipsel-unknown-linux-musl
|
- TARGET: mipsel-unknown-linux-musl
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
ARTIFACT_NAME: linux-mipsel
|
ARTIFACT_NAME: linux-mipsel
|
||||||
- TARGET: armv7-unknown-linux-musleabihf # raspberry pi 2-3-4, not tested
|
- TARGET: armv7-unknown-linux-musleabihf # raspberry pi 2-3-4, not tested
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
ARTIFACT_NAME: linux-armv7hf
|
ARTIFACT_NAME: linux-armv7hf
|
||||||
- TARGET: armv7-unknown-linux-musleabi # raspberry pi 2-3-4, not tested
|
- TARGET: armv7-unknown-linux-musleabi # raspberry pi 2-3-4, not tested
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
ARTIFACT_NAME: linux-armv7
|
ARTIFACT_NAME: linux-armv7
|
||||||
- TARGET: arm-unknown-linux-musleabihf # raspberry pi 0-1, not tested
|
- TARGET: arm-unknown-linux-musleabihf # raspberry pi 0-1, not tested
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
ARTIFACT_NAME: linux-armhf
|
ARTIFACT_NAME: linux-armhf
|
||||||
- TARGET: arm-unknown-linux-musleabi # raspberry pi 0-1, not tested
|
- TARGET: arm-unknown-linux-musleabi # raspberry pi 0-1, not tested
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
ARTIFACT_NAME: linux-arm
|
ARTIFACT_NAME: linux-arm
|
||||||
|
|
||||||
|
- TARGET: loongarch64-unknown-linux-musl
|
||||||
|
OS: ubuntu-24.04
|
||||||
|
ARTIFACT_NAME: linux-loongarch64
|
||||||
|
|
||||||
- TARGET: x86_64-apple-darwin
|
- TARGET: x86_64-apple-darwin
|
||||||
OS: macos-latest
|
OS: macos-latest
|
||||||
ARTIFACT_NAME: macos-x86_64
|
ARTIFACT_NAME: macos-x86_64
|
||||||
@@ -71,9 +116,15 @@ jobs:
|
|||||||
- TARGET: x86_64-pc-windows-msvc
|
- TARGET: x86_64-pc-windows-msvc
|
||||||
OS: windows-latest
|
OS: windows-latest
|
||||||
ARTIFACT_NAME: windows-x86_64
|
ARTIFACT_NAME: windows-x86_64
|
||||||
|
- TARGET: aarch64-pc-windows-msvc
|
||||||
|
OS: windows-latest
|
||||||
|
ARTIFACT_NAME: windows-arm64
|
||||||
|
- TARGET: i686-pc-windows-msvc
|
||||||
|
OS: windows-latest
|
||||||
|
ARTIFACT_NAME: windows-i686
|
||||||
|
|
||||||
- TARGET: x86_64-unknown-freebsd
|
- TARGET: x86_64-unknown-freebsd
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
ARTIFACT_NAME: freebsd-13.2-x86_64
|
ARTIFACT_NAME: freebsd-13.2-x86_64
|
||||||
BSD_VERSION: 13.2
|
BSD_VERSION: 13.2
|
||||||
|
|
||||||
@@ -83,7 +134,9 @@ jobs:
|
|||||||
TARGET: ${{ matrix.TARGET }}
|
TARGET: ${{ matrix.TARGET }}
|
||||||
OS: ${{ matrix.OS }}
|
OS: ${{ matrix.OS }}
|
||||||
OSS_BUCKET: ${{ secrets.ALIYUN_OSS_BUCKET }}
|
OSS_BUCKET: ${{ secrets.ALIYUN_OSS_BUCKET }}
|
||||||
needs: pre_job
|
needs:
|
||||||
|
- pre_job
|
||||||
|
- build_web
|
||||||
if: needs.pre_job.outputs.should_skip != 'true'
|
if: needs.pre_job.outputs.should_skip != 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
@@ -92,7 +145,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "GIT_DESC=$(git log -1 --format=%cd.%h --date=format:%Y-%m-%d_%H:%M:%S)" >> $GITHUB_ENV
|
echo "GIT_DESC=$(git log -1 --format=%cd.%h --date=format:%Y-%m-%d_%H:%M:%S)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Download web artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: easytier-web-dashboard
|
||||||
|
path: easytier-web/frontend/dist/
|
||||||
|
|
||||||
- name: Cargo cache
|
- name: Cargo cache
|
||||||
|
if: ${{ ! endsWith(matrix.TARGET, 'freebsd') }}
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
@@ -101,7 +161,7 @@ jobs:
|
|||||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- name: Setup protoc
|
- name: Setup protoc
|
||||||
uses: arduino/setup-protoc@v2
|
uses: arduino/setup-protoc@v3
|
||||||
with:
|
with:
|
||||||
# GitHub repo token to use to avoid rate limiter
|
# GitHub repo token to use to avoid rate limiter
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -110,26 +170,46 @@ jobs:
|
|||||||
if: ${{ ! endsWith(matrix.TARGET, 'freebsd') }}
|
if: ${{ ! endsWith(matrix.TARGET, 'freebsd') }}
|
||||||
run: |
|
run: |
|
||||||
bash ./.github/workflows/install_rust.sh
|
bash ./.github/workflows/install_rust.sh
|
||||||
|
|
||||||
|
# loongarch need llvm-18
|
||||||
|
if [[ $TARGET =~ ^loongarch.*$ ]]; then
|
||||||
|
sudo apt-get install -qq llvm-18 clang-18
|
||||||
|
export LLVM_CONFIG_PATH=/usr/lib/llvm-18/bin/llvm-config
|
||||||
|
fi
|
||||||
|
# we set the sysroot when sysroot is a dir
|
||||||
|
# this dir is a soft link generated by install_rust.sh
|
||||||
|
# kcp-sys need this to gen ffi bindings. without this clang may fail to find some libc headers such as bits/libc-header-start.h
|
||||||
|
if [[ -d "./musl_gcc/sysroot" ]]; then
|
||||||
|
export BINDGEN_EXTRA_CLANG_ARGS=--sysroot=$(readlink -f ./musl_gcc/sysroot)
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then
|
if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then
|
||||||
cargo +nightly build -r --verbose --target $TARGET -Z build-std=std,panic_abort --no-default-features --features mips
|
cargo +nightly build -r --target $TARGET -Z build-std=std,panic_abort --package=easytier --features=jemalloc
|
||||||
else
|
else
|
||||||
cargo build --release --verbose --target $TARGET
|
if [[ $OS =~ ^windows.*$ ]]; then
|
||||||
|
SUFFIX=.exe
|
||||||
|
CORE_FEATURES="--features=mimalloc"
|
||||||
|
else
|
||||||
|
CORE_FEATURES="--features=jemalloc"
|
||||||
|
fi
|
||||||
|
cargo build --release --target $TARGET --package=easytier-web --features=embed
|
||||||
|
mv ./target/$TARGET/release/easytier-web"$SUFFIX" ./target/$TARGET/release/easytier-web-embed"$SUFFIX"
|
||||||
|
cargo build --release --target $TARGET $CORE_FEATURES
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copied and slightly modified from @lmq8267 (https://github.com/lmq8267)
|
# Copied and slightly modified from @lmq8267 (https://github.com/lmq8267)
|
||||||
- name: Build Core & Cli (X86_64 FreeBSD)
|
- name: Build Core & Cli (X86_64 FreeBSD)
|
||||||
uses: cross-platform-actions/action@v0.23.0
|
uses: vmactions/freebsd-vm@v1
|
||||||
if: ${{ endsWith(matrix.TARGET, 'freebsd') }}
|
if: ${{ endsWith(matrix.TARGET, 'freebsd') }}
|
||||||
env:
|
env:
|
||||||
TARGET: ${{ matrix.TARGET }}
|
TARGET: ${{ matrix.TARGET }}
|
||||||
with:
|
with:
|
||||||
operating_system: freebsd
|
envs: TARGET
|
||||||
environment_variables: TARGET
|
release: ${{ matrix.BSD_VERSION }}
|
||||||
architecture: x86-64
|
arch: x86_64
|
||||||
version: ${{ matrix.BSD_VERSION }}
|
usesh: true
|
||||||
shell: bash
|
mem: 6144
|
||||||
memory: 5G
|
cpu: 4
|
||||||
cpu_count: 4
|
|
||||||
run: |
|
run: |
|
||||||
uname -a
|
uname -a
|
||||||
echo $SHELL
|
echo $SHELL
|
||||||
@@ -138,36 +218,36 @@ jobs:
|
|||||||
whoami
|
whoami
|
||||||
env | sort
|
env | sort
|
||||||
|
|
||||||
sudo pkg install -y git protobuf
|
pkg install -y git protobuf llvm-devel sudo curl
|
||||||
curl --proto 'https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
curl --proto 'https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
source $HOME/.cargo/env
|
. $HOME/.cargo/env
|
||||||
|
|
||||||
rustup set auto-self-update disable
|
rustup set auto-self-update disable
|
||||||
|
|
||||||
rustup install 1.77
|
rustup install 1.87
|
||||||
rustup default 1.77
|
rustup default 1.87
|
||||||
|
|
||||||
export CC=clang
|
export CC=clang
|
||||||
export CXX=clang++
|
export CXX=clang++
|
||||||
export CARGO_TERM_COLOR=always
|
export CARGO_TERM_COLOR=always
|
||||||
|
|
||||||
cargo build --release --verbose --target $TARGET
|
cargo build --release --verbose --target $TARGET --package=easytier-web --features=embed
|
||||||
|
mv ./target/$TARGET/release/easytier-web ./target/$TARGET/release/easytier-web-embed
|
||||||
- name: Install UPX
|
cargo build --release --verbose --target $TARGET --features=mimalloc
|
||||||
if: ${{ matrix.OS != 'macos-latest' }}
|
|
||||||
uses: crazy-max/ghaction-upx@v3
|
|
||||||
with:
|
|
||||||
version: latest
|
|
||||||
install-only: true
|
|
||||||
|
|
||||||
- name: Compress
|
- name: Compress
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ./artifacts/objects/
|
mkdir -p ./artifacts/objects/
|
||||||
# windows is the only OS using a different convention for executable file name
|
# windows is the only OS using a different convention for executable file name
|
||||||
if [[ $OS =~ ^windows.*$ ]]; then
|
if [[ $OS =~ ^windows.*$ && $TARGET =~ ^x86_64.*$ ]]; then
|
||||||
SUFFIX=.exe
|
SUFFIX=.exe
|
||||||
cp easytier/third_party/Packet.dll ./artifacts/objects/
|
cp easytier/third_party/*.dll ./artifacts/objects/
|
||||||
cp easytier/third_party/wintun.dll ./artifacts/objects/
|
elif [[ $OS =~ ^windows.*$ && $TARGET =~ ^i686.*$ ]]; then
|
||||||
|
SUFFIX=.exe
|
||||||
|
cp easytier/third_party/i686/*.dll ./artifacts/objects/
|
||||||
|
elif [[ $OS =~ ^windows.*$ && $TARGET =~ ^aarch64.*$ ]]; then
|
||||||
|
SUFFIX=.exe
|
||||||
|
cp easytier/third_party/arm64/*.dll ./artifacts/objects/
|
||||||
fi
|
fi
|
||||||
if [[ $GITHUB_REF_TYPE =~ ^tag$ ]]; then
|
if [[ $GITHUB_REF_TYPE =~ ^tag$ ]]; then
|
||||||
TAG=$GITHUB_REF_NAME
|
TAG=$GITHUB_REF_NAME
|
||||||
@@ -175,13 +255,20 @@ jobs:
|
|||||||
TAG=$GITHUB_SHA
|
TAG=$GITHUB_SHA
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $OS =~ ^ubuntu.*$ && ! $TARGET =~ ^.*freebsd$ ]]; then
|
if [[ $OS =~ ^ubuntu.*$ && ! $TARGET =~ ^.*freebsd$ && ! $TARGET =~ ^loongarch.*$ ]]; then
|
||||||
upx --lzma --best ./target/$TARGET/release/easytier-core"$SUFFIX"
|
UPX_VERSION=4.2.4
|
||||||
upx --lzma --best ./target/$TARGET/release/easytier-cli"$SUFFIX"
|
curl -L https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz -s | tar xJvf -
|
||||||
|
cp upx-${UPX_VERSION}-amd64_linux/upx .
|
||||||
|
./upx --lzma --best ./target/$TARGET/release/easytier-core"$SUFFIX"
|
||||||
|
./upx --lzma --best ./target/$TARGET/release/easytier-cli"$SUFFIX"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv ./target/$TARGET/release/easytier-core"$SUFFIX" ./artifacts/objects/
|
mv ./target/$TARGET/release/easytier-core"$SUFFIX" ./artifacts/objects/
|
||||||
mv ./target/$TARGET/release/easytier-cli"$SUFFIX" ./artifacts/objects/
|
mv ./target/$TARGET/release/easytier-cli"$SUFFIX" ./artifacts/objects/
|
||||||
|
if [[ ! $TARGET =~ ^mips.*$ ]]; then
|
||||||
|
mv ./target/$TARGET/release/easytier-web"$SUFFIX" ./artifacts/objects/
|
||||||
|
mv ./target/$TARGET/release/easytier-web-embed"$SUFFIX" ./artifacts/objects/
|
||||||
|
fi
|
||||||
|
|
||||||
mv ./artifacts/objects/* ./artifacts/
|
mv ./artifacts/objects/* ./artifacts/
|
||||||
rm -rf ./artifacts/objects/
|
rm -rf ./artifacts/objects/
|
||||||
@@ -193,25 +280,52 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
./artifacts/*
|
./artifacts/*
|
||||||
|
|
||||||
- name: Upload OSS
|
|
||||||
if: ${{ env.OSS_BUCKET != '' }}
|
|
||||||
uses: Menci/upload-to-oss@main
|
|
||||||
with:
|
|
||||||
access-key-id: ${{ secrets.ALIYUN_OSS_ACCESS_ID }}
|
|
||||||
access-key-secret: ${{ secrets.ALIYUN_OSS_ACCESS_KEY }}
|
|
||||||
endpoint: ${{ secrets.ALIYUN_OSS_ENDPOINT }}
|
|
||||||
bucket: ${{ secrets.ALIYUN_OSS_BUCKET }}
|
|
||||||
local-path: ./artifacts/
|
|
||||||
remote-path: /easytier-releases/${{env.GIT_DESC}}/easytier-${{ matrix.ARTIFACT_NAME }}
|
|
||||||
no-delete-remote-files: true
|
|
||||||
retry: 5
|
|
||||||
core-result:
|
core-result:
|
||||||
if: needs.pre_job.outputs.should_skip != 'true' && always()
|
if: needs.pre_job.outputs.should_skip != 'true' && always()
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- pre_job
|
- pre_job
|
||||||
|
- build_web
|
||||||
- build
|
- build
|
||||||
steps:
|
steps:
|
||||||
- name: Mark result as failed
|
- name: Mark result as failed
|
||||||
if: needs.build.result != 'success'
|
if: needs.build.result != 'success'
|
||||||
run: exit 1
|
run: exit 1
|
||||||
|
|
||||||
|
magisk_build:
|
||||||
|
needs:
|
||||||
|
- pre_job
|
||||||
|
- build_web
|
||||||
|
- build
|
||||||
|
if: needs.pre_job.outputs.should_skip != 'true' && always()
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4 # 必须先检出代码才能获取模块配置
|
||||||
|
|
||||||
|
# 下载二进制文件到独立目录
|
||||||
|
- name: Download Linux aarch64 binaries
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: easytier-linux-aarch64
|
||||||
|
path: ./downloaded-binaries/ # 独立目录避免冲突
|
||||||
|
|
||||||
|
# 将二进制文件复制到 Magisk 模块目录
|
||||||
|
- name: Prepare binaries
|
||||||
|
run: |
|
||||||
|
mkdir -p ./easytier-contrib/easytier-magisk/
|
||||||
|
cp ./downloaded-binaries/easytier-core ./easytier-contrib/easytier-magisk/
|
||||||
|
cp ./downloaded-binaries/easytier-cli ./easytier-contrib/easytier-magisk/
|
||||||
|
cp ./downloaded-binaries/easytier-web ./easytier-contrib/easytier-magisk/
|
||||||
|
|
||||||
|
|
||||||
|
# 上传生成的模块
|
||||||
|
- name: Upload Magisk Module
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: Easytier-Magisk
|
||||||
|
path: |
|
||||||
|
./easytier-contrib/easytier-magisk
|
||||||
|
!./easytier-contrib/easytier-magisk/build.sh
|
||||||
|
!./easytier-contrib/easytier-magisk/magisk_update.json
|
||||||
|
if-no-files-found: error
|
||||||
|
14
.github/workflows/docker.yml
vendored
@@ -11,7 +11,7 @@ on:
|
|||||||
image_tag:
|
image_tag:
|
||||||
description: 'Tag for this image build'
|
description: 'Tag for this image build'
|
||||||
type: string
|
type: string
|
||||||
default: 'v1.2.0'
|
default: 'v2.4.0'
|
||||||
required: true
|
required: true
|
||||||
mark_latest:
|
mark_latest:
|
||||||
description: 'Mark this image as latest'
|
description: 'Mark this image as latest'
|
||||||
@@ -39,9 +39,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: login github container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
id: download-artifact
|
id: download-artifact
|
||||||
uses: dawidd6/action-download-artifact@v6
|
uses: dawidd6/action-download-artifact@v11
|
||||||
with:
|
with:
|
||||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||||
run_id: ${{ inputs.run_id }}
|
run_id: ${{ inputs.run_id }}
|
||||||
@@ -58,4 +64,6 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
file: .github/workflows/Dockerfile
|
file: .github/workflows/Dockerfile
|
||||||
tags: easytier/easytier:${{ inputs.image_tag }}${{ inputs.mark_latest && ',easytier/easytier:latest' || '' }},
|
tags: |
|
||||||
|
easytier/easytier:${{ inputs.image_tag }}${{ inputs.mark_latest && ',easytier/easytier:latest' || '' }},
|
||||||
|
ghcr.io/easytier/easytier:${{ inputs.image_tag }}${{ inputs.mark_latest && ',easytier/easytier:latest' || '' }},
|
||||||
|
129
.github/workflows/gui.yml
vendored
@@ -36,11 +36,11 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- TARGET: aarch64-unknown-linux-musl
|
- TARGET: aarch64-unknown-linux-musl
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
GUI_TARGET: aarch64-unknown-linux-gnu
|
GUI_TARGET: aarch64-unknown-linux-gnu
|
||||||
ARTIFACT_NAME: linux-aarch64
|
ARTIFACT_NAME: linux-aarch64
|
||||||
- TARGET: x86_64-unknown-linux-musl
|
- TARGET: x86_64-unknown-linux-musl
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
GUI_TARGET: x86_64-unknown-linux-gnu
|
GUI_TARGET: x86_64-unknown-linux-gnu
|
||||||
ARTIFACT_NAME: linux-x86_64
|
ARTIFACT_NAME: linux-x86_64
|
||||||
|
|
||||||
@@ -58,6 +58,16 @@ jobs:
|
|||||||
GUI_TARGET: x86_64-pc-windows-msvc
|
GUI_TARGET: x86_64-pc-windows-msvc
|
||||||
ARTIFACT_NAME: windows-x86_64
|
ARTIFACT_NAME: windows-x86_64
|
||||||
|
|
||||||
|
- TARGET: aarch64-pc-windows-msvc
|
||||||
|
OS: windows-latest
|
||||||
|
GUI_TARGET: aarch64-pc-windows-msvc
|
||||||
|
ARTIFACT_NAME: windows-arm64
|
||||||
|
|
||||||
|
- TARGET: i686-pc-windows-msvc
|
||||||
|
OS: windows-latest
|
||||||
|
GUI_TARGET: i686-pc-windows-msvc
|
||||||
|
ARTIFACT_NAME: windows-i686
|
||||||
|
|
||||||
runs-on: ${{ matrix.OS }}
|
runs-on: ${{ matrix.OS }}
|
||||||
env:
|
env:
|
||||||
NAME: easytier
|
NAME: easytier
|
||||||
@@ -68,6 +78,56 @@ jobs:
|
|||||||
needs: pre_job
|
needs: pre_job
|
||||||
if: needs.pre_job.outputs.should_skip != 'true'
|
if: needs.pre_job.outputs.should_skip != 'true'
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install GUI dependencies (x86 only)
|
||||||
|
if: ${{ matrix.TARGET == 'x86_64-unknown-linux-musl' }}
|
||||||
|
run: |
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -qq libwebkit2gtk-4.1-dev \
|
||||||
|
build-essential \
|
||||||
|
curl \
|
||||||
|
wget \
|
||||||
|
file \
|
||||||
|
libgtk-3-dev \
|
||||||
|
librsvg2-dev \
|
||||||
|
libxdo-dev \
|
||||||
|
libssl-dev \
|
||||||
|
patchelf
|
||||||
|
|
||||||
|
- name: Install GUI cross compile (aarch64 only)
|
||||||
|
if: ${{ matrix.TARGET == 'aarch64-unknown-linux-musl' }}
|
||||||
|
run: |
|
||||||
|
# see https://tauri.app/v1/guides/building/linux/
|
||||||
|
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy main restricted" | sudo tee /etc/apt/sources.list
|
||||||
|
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy universe" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-updates universe" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=amd64] http://security.ubuntu.com/ubuntu/ jammy-security main restricted" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=amd64] http://security.ubuntu.com/ubuntu/ jammy-security universe" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=amd64] http://security.ubuntu.com/ubuntu/ jammy-security multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
|
||||||
|
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy universe" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates universe" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security universe" | sudo tee -a /etc/apt/sources.list
|
||||||
|
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security multiverse" | sudo tee -a /etc/apt/sources.list
|
||||||
|
|
||||||
|
sudo dpkg --add-architecture arm64
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install aptitude
|
||||||
|
sudo aptitude install -y libgstreamer1.0-0:arm64 gstreamer1.0-plugins-base:arm64 gstreamer1.0-plugins-good:arm64 \
|
||||||
|
libgstreamer-gl1.0-0:arm64 libgstreamer-plugins-base1.0-0:arm64 libgstreamer-plugins-good1.0-0:arm64 libwebkit2gtk-4.1-0:arm64 \
|
||||||
|
libwebkit2gtk-4.1-dev:arm64 libssl-dev:arm64 gcc-aarch64-linux-gnu
|
||||||
|
echo "PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/" >> "$GITHUB_ENV"
|
||||||
|
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig/" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set current ref as env variable
|
- name: Set current ref as env variable
|
||||||
@@ -76,12 +136,12 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 21
|
node-version: 22
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 9
|
version: 10
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
- name: Get pnpm store directory
|
||||||
@@ -99,8 +159,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: |
|
run: |
|
||||||
(cd easytier-gui; pnpm install)
|
pnpm -r install
|
||||||
(cd tauri-plugin-vpnservice; pnpm install; pnpm build)
|
pnpm -r build
|
||||||
|
|
||||||
- name: Cargo cache
|
- name: Cargo cache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
@@ -114,42 +174,21 @@ jobs:
|
|||||||
run: bash ./.github/workflows/install_rust.sh
|
run: bash ./.github/workflows/install_rust.sh
|
||||||
|
|
||||||
- name: Setup protoc
|
- name: Setup protoc
|
||||||
uses: arduino/setup-protoc@v2
|
uses: arduino/setup-protoc@v3
|
||||||
with:
|
with:
|
||||||
# GitHub repo token to use to avoid rate limiter
|
# GitHub repo token to use to avoid rate limiter
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Install GUI cross compile (aarch64 only)
|
- name: copy correct DLLs
|
||||||
if: ${{ matrix.TARGET == 'aarch64-unknown-linux-musl' }}
|
if: ${{ matrix.OS == 'windows-latest' }}
|
||||||
run: |
|
run: |
|
||||||
# see https://tauri.app/v1/guides/building/linux/
|
if [[ $GUI_TARGET =~ ^aarch64.*$ ]]; then
|
||||||
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble main restricted" | sudo tee /etc/apt/sources.list
|
cp ./easytier/third_party/arm64/*.dll ./easytier-gui/src-tauri/
|
||||||
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble-updates main restricted" | sudo tee -a /etc/apt/sources.list
|
elif [[ $GUI_TARGET =~ ^i686.*$ ]]; then
|
||||||
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble universe" | sudo tee -a /etc/apt/sources.list
|
cp ./easytier/third_party/i686/*.dll ./easytier-gui/src-tauri/
|
||||||
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble-updates universe" | sudo tee -a /etc/apt/sources.list
|
else
|
||||||
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble multiverse" | sudo tee -a /etc/apt/sources.list
|
cp ./easytier/third_party/*.dll ./easytier-gui/src-tauri/
|
||||||
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble-updates multiverse" | sudo tee -a /etc/apt/sources.list
|
fi
|
||||||
echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ noble-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=amd64] http://security.ubuntu.com/ubuntu/ noble-security main restricted" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=amd64] http://security.ubuntu.com/ubuntu/ noble-security universe" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=amd64] http://security.ubuntu.com/ubuntu/ noble-security multiverse" | sudo tee -a /etc/apt/sources.list
|
|
||||||
|
|
||||||
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble main restricted" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble-updates main restricted" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble universe" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble-updates universe" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble multiverse" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble-updates multiverse" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble-security main restricted" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble-security universe" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports noble-security multiverse" | sudo tee -a /etc/apt/sources.list
|
|
||||||
|
|
||||||
sudo dpkg --add-architecture arm64
|
|
||||||
sudo apt-get update && sudo apt-get upgrade -y
|
|
||||||
sudo apt install -f -o Dpkg::Options::="--force-overwrite" libwebkit2gtk-4.1-dev:arm64 libssl-dev:arm64 gcc-aarch64-linux-gnu
|
|
||||||
echo "PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/" >> "$GITHUB_ENV"
|
|
||||||
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig/" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Build GUI
|
- name: Build GUI
|
||||||
if: ${{ matrix.GUI_TARGET != '' }}
|
if: ${{ matrix.GUI_TARGET != '' }}
|
||||||
@@ -157,7 +196,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
projectPath: ./easytier-gui
|
projectPath: ./easytier-gui
|
||||||
# https://tauri.app/v1/guides/building/linux/#cross-compiling-tauri-applications-for-arm-based-devices
|
# https://tauri.app/v1/guides/building/linux/#cross-compiling-tauri-applications-for-arm-based-devices
|
||||||
args: --verbose --target ${{ matrix.GUI_TARGET }} ${{ matrix.OS == 'ubuntu-latest' && contains(matrix.TARGET, 'aarch64') && '--bundles deb' || '' }}
|
args: --verbose --target ${{ matrix.GUI_TARGET }} ${{ matrix.OS == 'ubuntu-22.04' && contains(matrix.TARGET, 'aarch64') && '--bundles deb' || '' }}
|
||||||
|
|
||||||
- name: Compress
|
- name: Compress
|
||||||
run: |
|
run: |
|
||||||
@@ -191,18 +230,6 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
./artifacts/*
|
./artifacts/*
|
||||||
|
|
||||||
- name: Upload OSS
|
|
||||||
if: ${{ env.OSS_BUCKET != '' }}
|
|
||||||
uses: Menci/upload-to-oss@main
|
|
||||||
with:
|
|
||||||
access-key-id: ${{ secrets.ALIYUN_OSS_ACCESS_ID }}
|
|
||||||
access-key-secret: ${{ secrets.ALIYUN_OSS_ACCESS_KEY }}
|
|
||||||
endpoint: ${{ secrets.ALIYUN_OSS_ENDPOINT }}
|
|
||||||
bucket: ${{ secrets.ALIYUN_OSS_BUCKET }}
|
|
||||||
local-path: ./artifacts/
|
|
||||||
remote-path: /easytier-releases/${{env.GIT_DESC}}/easytier-gui-${{ matrix.ARTIFACT_NAME }}
|
|
||||||
no-delete-remote-files: true
|
|
||||||
retry: 5
|
|
||||||
gui-result:
|
gui-result:
|
||||||
if: needs.pre_job.outputs.should_skip != 'true' && always()
|
if: needs.pre_job.outputs.should_skip != 'true' && always()
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
62
.github/workflows/install_rust.sh
vendored
@@ -8,61 +8,33 @@
|
|||||||
# dependencies are only needed on ubuntu as that's the only place where
|
# dependencies are only needed on ubuntu as that's the only place where
|
||||||
# we make cross-compilation
|
# we make cross-compilation
|
||||||
if [[ $OS =~ ^ubuntu.*$ ]]; then
|
if [[ $OS =~ ^ubuntu.*$ ]]; then
|
||||||
sudo apt-get update && sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf musl-tools libappindicator3-dev
|
sudo apt-get update && sudo apt-get install -qq musl-tools libappindicator3-dev llvm clang
|
||||||
# for easytier-gui
|
# https://github.com/cross-tools/musl-cross/releases
|
||||||
if [[ $GUI_TARGET != '' && $GUI_TARGET =~ ^x86_64.*$ ]]; then
|
# if "musl" is a substring of TARGET, we assume that we are using musl
|
||||||
sudo apt install -qq libwebkit2gtk-4.1-dev \
|
MUSL_TARGET=$TARGET
|
||||||
build-essential \
|
# if target is mips or mipsel, we should use soft-float version of musl
|
||||||
curl \
|
if [[ $TARGET =~ ^mips.*$ || $TARGET =~ ^mipsel.*$ ]]; then
|
||||||
wget \
|
MUSL_TARGET=${TARGET}sf
|
||||||
file \
|
|
||||||
libgtk-3-dev \
|
|
||||||
librsvg2-dev \
|
|
||||||
libxdo-dev \
|
|
||||||
libssl-dev \
|
|
||||||
patchelf
|
|
||||||
fi
|
fi
|
||||||
# curl -s musl.cc | grep mipsel
|
if [[ $MUSL_TARGET =~ musl ]]; then
|
||||||
case $TARGET in
|
|
||||||
mipsel-unknown-linux-musl)
|
|
||||||
MUSL_URI=mipsel-linux-muslsf
|
|
||||||
;;
|
|
||||||
mips-unknown-linux-musl)
|
|
||||||
MUSL_URI=mips-linux-muslsf
|
|
||||||
;;
|
|
||||||
aarch64-unknown-linux-musl)
|
|
||||||
MUSL_URI=aarch64-linux-musl
|
|
||||||
;;
|
|
||||||
armv7-unknown-linux-musleabihf)
|
|
||||||
MUSL_URI=armv7l-linux-musleabihf
|
|
||||||
;;
|
|
||||||
armv7-unknown-linux-musleabi)
|
|
||||||
MUSL_URI=armv7m-linux-musleabi
|
|
||||||
;;
|
|
||||||
arm-unknown-linux-musleabihf)
|
|
||||||
MUSL_URI=arm-linux-musleabihf
|
|
||||||
;;
|
|
||||||
arm-unknown-linux-musleabi)
|
|
||||||
MUSL_URI=arm-linux-musleabi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -n "$MUSL_URI" ]; then
|
|
||||||
mkdir -p ./musl_gcc
|
mkdir -p ./musl_gcc
|
||||||
wget -c https://musl.cc/${MUSL_URI}-cross.tgz -P ./musl_gcc/
|
wget --inet4-only -c https://github.com/cross-tools/musl-cross/releases/download/20250520/${MUSL_TARGET}.tar.xz -P ./musl_gcc/
|
||||||
tar zxf ./musl_gcc/${MUSL_URI}-cross.tgz -C ./musl_gcc/
|
tar xf ./musl_gcc/${MUSL_TARGET}.tar.xz -C ./musl_gcc/
|
||||||
sudo ln -s $(pwd)/musl_gcc/${MUSL_URI}-cross/bin/*gcc /usr/bin/
|
sudo ln -sf $(pwd)/musl_gcc/${MUSL_TARGET}/bin/*gcc /usr/bin/
|
||||||
|
sudo ln -sf $(pwd)/musl_gcc/${MUSL_TARGET}/include/ /usr/include/musl-cross
|
||||||
|
sudo ln -sf $(pwd)/musl_gcc/${MUSL_TARGET}/${MUSL_TARGET}/sysroot/ ./musl_gcc/sysroot
|
||||||
|
sudo chmod -R a+rwx ./musl_gcc
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# see https://github.com/rust-lang/rustup/issues/3709
|
# see https://github.com/rust-lang/rustup/issues/3709
|
||||||
rustup set auto-self-update disable
|
rustup set auto-self-update disable
|
||||||
rustup install 1.77
|
rustup install 1.87
|
||||||
rustup default 1.77
|
rustup default 1.87
|
||||||
|
|
||||||
# mips/mipsel cannot add target from rustup, need compile by ourselves
|
# mips/mipsel cannot add target from rustup, need compile by ourselves
|
||||||
if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then
|
if [[ $OS =~ ^ubuntu.*$ && $TARGET =~ ^mips.*$ ]]; then
|
||||||
cd "$PWD/musl_gcc/${MUSL_URI}-cross/lib/gcc/${MUSL_URI}/11.2.1" || exit 255
|
cd "$PWD/musl_gcc/${MUSL_TARGET}/lib/gcc/${MUSL_TARGET}/15.1.0" || exit 255
|
||||||
# for panic-abort
|
# for panic-abort
|
||||||
cp libgcc_eh.a libunwind.a
|
cp libgcc_eh.a libunwind.a
|
||||||
|
|
||||||
|
28
.github/workflows/mobile.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- TARGET: android
|
- TARGET: android
|
||||||
OS: ubuntu-latest
|
OS: ubuntu-22.04
|
||||||
ARTIFACT_NAME: android
|
ARTIFACT_NAME: android
|
||||||
runs-on: ${{ matrix.OS }}
|
runs-on: ${{ matrix.OS }}
|
||||||
env:
|
env:
|
||||||
@@ -56,7 +56,7 @@ jobs:
|
|||||||
- uses: actions/setup-java@v4
|
- uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: 'oracle'
|
distribution: 'oracle'
|
||||||
java-version: '20'
|
java-version: '21'
|
||||||
|
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
@@ -72,12 +72,12 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 21
|
node-version: 22
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 9
|
version: 10
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
- name: Get pnpm store directory
|
||||||
@@ -95,8 +95,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: |
|
run: |
|
||||||
(cd easytier-gui; pnpm install)
|
pnpm -r install
|
||||||
(cd tauri-plugin-vpnservice; pnpm install; pnpm build)
|
pnpm -r build
|
||||||
|
|
||||||
- name: Cargo cache
|
- name: Cargo cache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
@@ -115,7 +115,7 @@ jobs:
|
|||||||
rustup target add x86_64-linux-android
|
rustup target add x86_64-linux-android
|
||||||
|
|
||||||
- name: Setup protoc
|
- name: Setup protoc
|
||||||
uses: arduino/setup-protoc@v2
|
uses: arduino/setup-protoc@v3
|
||||||
with:
|
with:
|
||||||
# GitHub repo token to use to avoid rate limiter
|
# GitHub repo token to use to avoid rate limiter
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -146,18 +146,6 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
./artifacts/*
|
./artifacts/*
|
||||||
|
|
||||||
- name: Upload OSS
|
|
||||||
if: ${{ env.OSS_BUCKET != '' }}
|
|
||||||
uses: Menci/upload-to-oss@main
|
|
||||||
with:
|
|
||||||
access-key-id: ${{ secrets.ALIYUN_OSS_ACCESS_ID }}
|
|
||||||
access-key-secret: ${{ secrets.ALIYUN_OSS_ACCESS_KEY }}
|
|
||||||
endpoint: ${{ secrets.ALIYUN_OSS_ENDPOINT }}
|
|
||||||
bucket: ${{ secrets.ALIYUN_OSS_BUCKET }}
|
|
||||||
local-path: ./artifacts/
|
|
||||||
remote-path: /easytier-releases/${{env.GIT_DESC}}/easytier-gui-${{ matrix.ARTIFACT_NAME }}
|
|
||||||
no-delete-remote-files: true
|
|
||||||
retry: 5
|
|
||||||
mobile-result:
|
mobile-result:
|
||||||
if: needs.pre_job.outputs.should_skip != 'true' && always()
|
if: needs.pre_job.outputs.should_skip != 'true' && always()
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
114
.github/workflows/ohos.yml
vendored
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
name: EasyTier OHOS
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["develop", "main", "releases/**"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["develop", "main"]
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
# necessary for windows
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre_job:
|
||||||
|
# continue-on-error: true # Uncomment once integration is finished
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# Map a step output to a job output
|
||||||
|
outputs:
|
||||||
|
# do not skip push on branch starts with releases/
|
||||||
|
should_skip: ${{ steps.skip_check.outputs.should_skip == 'true' && !startsWith(github.ref_name, 'releases/') }}
|
||||||
|
steps:
|
||||||
|
- id: skip_check
|
||||||
|
uses: fkirc/skip-duplicate-actions@v5
|
||||||
|
with:
|
||||||
|
# All of these options are optional, so you can remove them if you are happy with the defaults
|
||||||
|
concurrent_skipping: 'same_content_newer'
|
||||||
|
skip_after_successful_duplicate: 'true'
|
||||||
|
cancel_others: 'true'
|
||||||
|
paths: '["Cargo.toml", "Cargo.lock", "easytier/**", "easytier-contrib/easytier-ohrs/**", ".github/workflows/ohos.yml", ".github/workflows/install_rust.sh"]'
|
||||||
|
build-ohos:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: pre_job
|
||||||
|
if: needs.pre_job.outputs.should_skip != 'true'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y \
|
||||||
|
build-essential \
|
||||||
|
wget \
|
||||||
|
unzip \
|
||||||
|
git \
|
||||||
|
pkg-config
|
||||||
|
sudo apt-get clean
|
||||||
|
|
||||||
|
- name: Download and extract native SDK
|
||||||
|
working-directory: ../../../
|
||||||
|
run: |
|
||||||
|
echo $PWD
|
||||||
|
wget -q \
|
||||||
|
https://github.com/openharmony-rs/ohos-sdk/releases/download/v5.1.0/ohos-sdk-windows_linux-public.tar.gz.aa
|
||||||
|
wget -q \
|
||||||
|
https://github.com/openharmony-rs/ohos-sdk/releases/download/v5.1.0/ohos-sdk-windows_linux-public.tar.gz.ab
|
||||||
|
cat ohos-sdk-windows_linux-public.tar.gz.aa ohos-sdk-windows_linux-public.tar.gz.ab > sdk.tar.gz
|
||||||
|
echo "Extracting native..."
|
||||||
|
mkdir sdk
|
||||||
|
tar -xzf sdk.tar.gz ohos-sdk/linux/native-linux-x64-5.1.0.107-Release.zip
|
||||||
|
tar -xzf sdk.tar.gz ohos-sdk/linux/toolchains-linux-x64-5.1.0.107-Release.zip
|
||||||
|
unzip -qq ohos-sdk/linux/native-linux-x64-5.1.0.107-Release.zip -d sdk
|
||||||
|
unzip -qq ohos-sdk/linux/toolchains-linux-x64-5.1.0.107-Release.zip -d sdk
|
||||||
|
ls -la sdk/native/llvm/bin/
|
||||||
|
rm -rf ohos-sdk-windows_linux-public.tar.gz.aa ohos-sdk-windows_linux-public.tar.gz.ab ohos-sdk/
|
||||||
|
|
||||||
|
- name: Download and Extract Custom SDK
|
||||||
|
run: |
|
||||||
|
wget https://github.com/FrankHan052176/Easytier-OHOS-sdk/releases/download/v1/ohos-sdk.zip -O /tmp/ohos-sdk.zip
|
||||||
|
sudo unzip -o /tmp/ohos-sdk.zip -d /tmp/custom-sdk
|
||||||
|
sudo cp -rf /tmp/custom-sdk/linux/native/* $HOME/sdk/native
|
||||||
|
echo "Custom SDK files deployed to $HOME/sdk/native"
|
||||||
|
ls -a $HOME/sdk/native
|
||||||
|
|
||||||
|
- name: Setup build environment
|
||||||
|
run: |
|
||||||
|
echo "OHOS_NDK_HOME=$HOME/sdk" >> $GITHUB_ENV
|
||||||
|
echo "TARGET_ARCH=aarch64-linux-ohos" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Create clang wrapper script
|
||||||
|
run: |
|
||||||
|
sudo mkdir -p $OHOS_NDK_HOME/native/llvm
|
||||||
|
sudo tee $OHOS_NDK_HOME/native/llvm/aarch64-unknown-linux-ohos-clang.sh > /dev/null <<'EOF'
|
||||||
|
#!/bin/sh
|
||||||
|
exec $OHOS_NDK_HOME/native/llvm/bin/clang \
|
||||||
|
-target aarch64-linux-ohos \
|
||||||
|
--sysroot=$OHOS_NDK_HOME/native/sysroot \
|
||||||
|
-D__MUSL__ \
|
||||||
|
"$@"
|
||||||
|
EOF
|
||||||
|
sudo chmod +x $OHOS_NDK_HOME/native/llvm/aarch64-unknown-linux-ohos-clang.sh
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
working-directory: ./easytier-contrib/easytier-ohrs
|
||||||
|
run: |
|
||||||
|
sudo apt-get install -y llvm clang lldb lld
|
||||||
|
sudo apt-get install -y protobuf-compiler
|
||||||
|
bash ../../.github/workflows/install_rust.sh
|
||||||
|
source env.sh
|
||||||
|
cargo install ohrs
|
||||||
|
rustup target add aarch64-unknown-linux-ohos
|
||||||
|
cargo update easytier
|
||||||
|
ohrs doctor
|
||||||
|
ohrs build --release --arch aarch
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: easytier-ohos
|
||||||
|
path: ./easytier-contrib/easytier-ohrs/dist/arm64-v8a/libeasytier_ohrs.so
|
||||||
|
retention-days: 5
|
||||||
|
if-no-files-found: error
|
19
.github/workflows/release.yml
vendored
@@ -21,7 +21,7 @@ on:
|
|||||||
version:
|
version:
|
||||||
description: 'Version for this release'
|
description: 'Version for this release'
|
||||||
type: string
|
type: string
|
||||||
default: 'v2.0.2'
|
default: 'v2.4.0'
|
||||||
required: true
|
required: true
|
||||||
make_latest:
|
make_latest:
|
||||||
description: 'Mark this release as latest'
|
description: 'Mark this release as latest'
|
||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Download Core Artifact
|
- name: Download Core Artifact
|
||||||
uses: dawidd6/action-download-artifact@v6
|
uses: dawidd6/action-download-artifact@v11
|
||||||
with:
|
with:
|
||||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||||
run_id: ${{ inputs.core_run_id }}
|
run_id: ${{ inputs.core_run_id }}
|
||||||
@@ -50,15 +50,15 @@ jobs:
|
|||||||
path: release_assets
|
path: release_assets
|
||||||
|
|
||||||
- name: Download GUI Artifact
|
- name: Download GUI Artifact
|
||||||
uses: dawidd6/action-download-artifact@v6
|
uses: dawidd6/action-download-artifact@v11
|
||||||
with:
|
with:
|
||||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||||
run_id: ${{ inputs.gui_run_id }}
|
run_id: ${{ inputs.gui_run_id }}
|
||||||
repo: EasyTier/EasyTier
|
repo: EasyTier/EasyTier
|
||||||
path: release_assets_nozip
|
path: release_assets_nozip
|
||||||
|
|
||||||
- name: Download GUI Artifact
|
- name: Download Mobile Artifact
|
||||||
uses: dawidd6/action-download-artifact@v6
|
uses: dawidd6/action-download-artifact@v11
|
||||||
with:
|
with:
|
||||||
github_token: ${{secrets.GITHUB_TOKEN}}
|
github_token: ${{secrets.GITHUB_TOKEN}}
|
||||||
run_id: ${{ inputs.mobile_run_id }}
|
run_id: ${{ inputs.mobile_run_id }}
|
||||||
@@ -78,7 +78,14 @@ jobs:
|
|||||||
ls -l -R ./
|
ls -l -R ./
|
||||||
chmod -R 755 .
|
chmod -R 755 .
|
||||||
for x in `ls`; do
|
for x in `ls`; do
|
||||||
zip ../zipped_assets/$x-${VERSION}.zip $x/*;
|
if [ "$x" = "Easytier-Magisk" ]; then
|
||||||
|
# for Easytier-Magisk, make sure files are in the root of the zip
|
||||||
|
cd $x;
|
||||||
|
zip -r ../../zipped_assets/$x-${VERSION}.zip .;
|
||||||
|
cd ..;
|
||||||
|
else
|
||||||
|
zip -r ../zipped_assets/$x-${VERSION}.zip $x;
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
|
36
.github/workflows/test.yml
vendored
@@ -30,14 +30,14 @@ jobs:
|
|||||||
skip_after_successful_duplicate: 'true'
|
skip_after_successful_duplicate: 'true'
|
||||||
paths: '["Cargo.toml", "Cargo.lock", "easytier/**", ".github/workflows/test.yml"]'
|
paths: '["Cargo.toml", "Cargo.lock", "easytier/**", ".github/workflows/test.yml"]'
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
needs: pre_job
|
needs: pre_job
|
||||||
if: needs.pre_job.outputs.should_skip != 'true'
|
if: needs.pre_job.outputs.should_skip != 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup protoc
|
- name: Setup protoc
|
||||||
uses: arduino/setup-protoc@v2
|
uses: arduino/setup-protoc@v3
|
||||||
with:
|
with:
|
||||||
# GitHub repo token to use to avoid rate limiter
|
# GitHub repo token to use to avoid rate limiter
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -47,11 +47,40 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup system for test
|
- name: Setup system for test
|
||||||
run: |
|
run: |
|
||||||
|
sudo modprobe br_netfilter
|
||||||
sudo sysctl net.bridge.bridge-nf-call-iptables=0
|
sudo sysctl net.bridge.bridge-nf-call-iptables=0
|
||||||
sudo sysctl net.bridge.bridge-nf-call-ip6tables=0
|
sudo sysctl net.bridge.bridge-nf-call-ip6tables=0
|
||||||
sudo sysctl net.ipv6.conf.lo.disable_ipv6=0
|
sudo sysctl net.ipv6.conf.lo.disable_ipv6=0
|
||||||
sudo ip addr add 2001:db8::2/64 dev lo
|
sudo ip addr add 2001:db8::2/64 dev lo
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10
|
||||||
|
run_install: false
|
||||||
|
|
||||||
|
- name: Get pnpm store directory
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Setup pnpm cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ env.STORE_PATH }}
|
||||||
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
|
- name: Install frontend dependencies
|
||||||
|
run: |
|
||||||
|
pnpm -r install
|
||||||
|
pnpm -r --filter "./easytier-web/*" build
|
||||||
|
|
||||||
- name: Cargo cache
|
- name: Cargo cache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
@@ -62,6 +91,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
sudo -E env "PATH=$PATH" cargo test --no-default-features --features=full --verbose
|
sudo prlimit --pid $$ --nofile=1048576:1048576
|
||||||
|
sudo -E env "PATH=$PATH" cargo test --no-default-features --features=full --verbose -- --test-threads=1
|
||||||
sudo chown -R $USER:$USER ./target
|
sudo chown -R $USER:$USER ./target
|
||||||
sudo chown -R $USER:$USER ~/.cargo
|
sudo chown -R $USER:$USER ~/.cargo
|
||||||
|
11
.gitignore
vendored
@@ -11,6 +11,7 @@ target-*/
|
|||||||
*.pdb
|
*.pdb
|
||||||
|
|
||||||
.vscode
|
.vscode
|
||||||
|
/.idea
|
||||||
|
|
||||||
# perf & flamegraph
|
# perf & flamegraph
|
||||||
perf.data
|
perf.data
|
||||||
@@ -29,3 +30,13 @@ musl_gcc
|
|||||||
|
|
||||||
# log
|
# log
|
||||||
easytier-panic.log
|
easytier-panic.log
|
||||||
|
|
||||||
|
# web
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
.vite
|
||||||
|
|
||||||
|
easytier-gui/src-tauri/*.dll
|
||||||
|
/easytier-contrib/easytier-ohrs/dist/
|
||||||
|
|
||||||
|
.direnv
|
||||||
|
0
.gitmodules
vendored
225
CONTRIBUTING.md
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
# Contributing to EasyTier
|
||||||
|
|
||||||
|
[中文版](CONTRIBUTING_zh.md)
|
||||||
|
|
||||||
|
Thank you for your interest in contributing to EasyTier! This document provides guidelines and instructions for contributing to the project.
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
- [Development Environment Setup](#development-environment-setup)
|
||||||
|
- [Prerequisites](#prerequisites)
|
||||||
|
- [Installation Steps](#installation-steps)
|
||||||
|
- [Project Structure](#project-structure)
|
||||||
|
- [Build Guide](#build-guide)
|
||||||
|
- [Building Core](#building-core)
|
||||||
|
- [Building GUI](#building-gui)
|
||||||
|
- [Building Mobile](#building-mobile)
|
||||||
|
- [Development Workflow](#development-workflow)
|
||||||
|
- [Testing Guidelines](#testing-guidelines)
|
||||||
|
- [Pull Request Guidelines](#pull-request-guidelines)
|
||||||
|
- [Additional Resources](#additional-resources)
|
||||||
|
|
||||||
|
## Development Environment Setup
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
#### Required Tools
|
||||||
|
- Node.js v21 or higher
|
||||||
|
- pnpm v9 or higher
|
||||||
|
- Rust toolchain (version 1.87)
|
||||||
|
- LLVM and Clang
|
||||||
|
- Protoc (Protocol Buffers compiler)
|
||||||
|
|
||||||
|
#### Platform-Specific Dependencies
|
||||||
|
|
||||||
|
**Linux (Ubuntu/Debian)**
|
||||||
|
```bash
|
||||||
|
# Core build dependencies
|
||||||
|
sudo apt-get update && sudo apt-get install -y \
|
||||||
|
musl-tools \
|
||||||
|
libappindicator3-dev \
|
||||||
|
llvm \
|
||||||
|
clang \
|
||||||
|
protobuf-compiler
|
||||||
|
|
||||||
|
# GUI build dependencies
|
||||||
|
sudo apt install -y \
|
||||||
|
libwebkit2gtk-4.1-dev \
|
||||||
|
build-essential \
|
||||||
|
curl \
|
||||||
|
wget \
|
||||||
|
file \
|
||||||
|
libgtk-3-dev \
|
||||||
|
librsvg2-dev \
|
||||||
|
libxdo-dev \
|
||||||
|
libssl-dev \
|
||||||
|
patchelf
|
||||||
|
|
||||||
|
# Testing dependencies
|
||||||
|
sudo apt install -y bridge-utils
|
||||||
|
```
|
||||||
|
|
||||||
|
**For Cross-Compilation**
|
||||||
|
- musl-cross toolchain (for MIPS and other architectures)
|
||||||
|
- Additional setup may be required (see `.github/workflows/` for details)
|
||||||
|
|
||||||
|
**For Android Development**
|
||||||
|
- Java 20
|
||||||
|
- Android SDK (Build Tools 34.0.0)
|
||||||
|
- Android NDK (26.0.10792818)
|
||||||
|
|
||||||
|
### Installation Steps
|
||||||
|
|
||||||
|
1. Clone the repository:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/EasyTier/EasyTier.git
|
||||||
|
cd EasyTier
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Install dependencies:
|
||||||
|
```bash
|
||||||
|
# Install Rust toolchain
|
||||||
|
rustup install 1.87
|
||||||
|
rustup default 1.87
|
||||||
|
|
||||||
|
# Install project dependencies
|
||||||
|
pnpm -r install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
easytier/ # Core functionality and libraries
|
||||||
|
easytier-web/ # Web dashboard and frontend
|
||||||
|
easytier-gui/ # Desktop GUI application
|
||||||
|
.github/workflows/ # CI/CD configuration files
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build Guide
|
||||||
|
|
||||||
|
### Building Core
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Standard build
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
|
# Platform-specific builds
|
||||||
|
cargo build --release --target x86_64-unknown-linux-musl # Linux x86_64
|
||||||
|
cargo build --release --target aarch64-unknown-linux-musl # Linux ARM64
|
||||||
|
cargo build --release --target x86_64-apple-darwin # macOS x86_64
|
||||||
|
cargo build --release --target aarch64-apple-darwin # macOS M1/M2
|
||||||
|
cargo build --release --target x86_64-pc-windows-msvc # Windows x86_64
|
||||||
|
```
|
||||||
|
|
||||||
|
Build artifacts: `target/[target-triple]/release/`
|
||||||
|
|
||||||
|
### Building GUI
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Build frontend
|
||||||
|
pnpm -r build
|
||||||
|
|
||||||
|
# 2. Build GUI application
|
||||||
|
cd easytier-gui
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
pnpm tauri build --target x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
pnpm tauri build --target x86_64-apple-darwin # Intel
|
||||||
|
pnpm tauri build --target aarch64-apple-darwin # Apple Silicon
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
pnpm tauri build --target x86_64-pc-windows-msvc # x64
|
||||||
|
```
|
||||||
|
|
||||||
|
Build artifacts: `easytier-gui/src-tauri/target/release/bundle/`
|
||||||
|
|
||||||
|
### Building Mobile
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Install Android targets
|
||||||
|
rustup target add aarch64-linux-android
|
||||||
|
rustup target add armv7-linux-androideabi
|
||||||
|
rustup target add i686-linux-android
|
||||||
|
rustup target add x86_64-linux-android
|
||||||
|
|
||||||
|
# 2. Build Android application
|
||||||
|
cd easytier-gui
|
||||||
|
pnpm tauri android build
|
||||||
|
```
|
||||||
|
|
||||||
|
Build artifacts: `easytier-gui/src-tauri/gen/android/app/build/outputs/apk/universal/release/`
|
||||||
|
|
||||||
|
### Build Notes
|
||||||
|
|
||||||
|
1. Cross-compilation for ARM/MIPS requires additional setup
|
||||||
|
2. Windows builds need correct DLL files
|
||||||
|
3. Check `.github/workflows/` for detailed build configurations
|
||||||
|
|
||||||
|
## Development Workflow
|
||||||
|
|
||||||
|
1. Create a feature branch from `develop`:
|
||||||
|
```bash
|
||||||
|
git checkout develop
|
||||||
|
git checkout -b feature/your-feature-name
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Make your changes following our coding standards
|
||||||
|
|
||||||
|
3. Write or update tests as needed
|
||||||
|
|
||||||
|
4. Use conventional commit messages:
|
||||||
|
```
|
||||||
|
feat: add new feature
|
||||||
|
fix: resolve bug
|
||||||
|
docs: update documentation
|
||||||
|
test: add tests
|
||||||
|
chore: update dependencies
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Submit a pull request to `develop`
|
||||||
|
|
||||||
|
## Testing Guidelines
|
||||||
|
|
||||||
|
### Running Tests
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Configure system (Linux)
|
||||||
|
sudo modprobe br_netfilter
|
||||||
|
sudo sysctl net.bridge.bridge-nf-call-iptables=0
|
||||||
|
sudo sysctl net.bridge.bridge-nf-call-ip6tables=0
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
cargo test --no-default-features --features=full --verbose
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test Requirements
|
||||||
|
|
||||||
|
- Write tests for new features
|
||||||
|
- Maintain existing test coverage
|
||||||
|
- Tests should be isolated and repeatable
|
||||||
|
- Include both unit and integration tests
|
||||||
|
|
||||||
|
## Pull Request Guidelines
|
||||||
|
|
||||||
|
1. Target the `develop` branch
|
||||||
|
2. Ensure all tests pass
|
||||||
|
3. Include clear description and purpose
|
||||||
|
4. Reference related issues
|
||||||
|
5. Keep changes focused and atomic
|
||||||
|
6. Update documentation as needed
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
- [Issue Tracker](https://github.com/EasyTier/EasyTier/issues)
|
||||||
|
- [Project Documentation](https://github.com/EasyTier/EasyTier/wiki)
|
||||||
|
|
||||||
|
## Questions or Need Help?
|
||||||
|
|
||||||
|
Feel free to:
|
||||||
|
- Open an issue for questions
|
||||||
|
- Join our community discussions
|
||||||
|
- Reach out to maintainers
|
||||||
|
|
||||||
|
Thank you for contributing to EasyTier!
|
233
CONTRIBUTING_zh.md
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
# EasyTier 贡献指南
|
||||||
|
|
||||||
|
[English Version](CONTRIBUTING.md)
|
||||||
|
|
||||||
|
感谢您对 EasyTier 项目的关注!本文档提供了参与项目贡献的指南和说明。
|
||||||
|
|
||||||
|
## 目录
|
||||||
|
|
||||||
|
- [EasyTier 贡献指南](#easytier-贡献指南)
|
||||||
|
- [目录](#目录)
|
||||||
|
- [开发环境配置](#开发环境配置)
|
||||||
|
- [前置要求](#前置要求)
|
||||||
|
- [必需工具](#必需工具)
|
||||||
|
- [平台特定依赖](#平台特定依赖)
|
||||||
|
- [安装步骤](#安装步骤)
|
||||||
|
- [项目结构](#项目结构)
|
||||||
|
- [构建指南](#构建指南)
|
||||||
|
- [构建核心组件](#构建核心组件)
|
||||||
|
- [构建桌面应用](#构建桌面应用)
|
||||||
|
- [构建移动应用](#构建移动应用)
|
||||||
|
- [构建注意事项](#构建注意事项)
|
||||||
|
- [开发工作流](#开发工作流)
|
||||||
|
- [测试指南](#测试指南)
|
||||||
|
- [运行测试](#运行测试)
|
||||||
|
- [测试要求](#测试要求)
|
||||||
|
- [Pull Request 规范](#pull-request-规范)
|
||||||
|
- [其他资源](#其他资源)
|
||||||
|
- [需要帮助?](#需要帮助)
|
||||||
|
|
||||||
|
## 开发环境配置
|
||||||
|
|
||||||
|
### 前置要求
|
||||||
|
|
||||||
|
#### 必需工具
|
||||||
|
- Node.js v21 或更高版本
|
||||||
|
- pnpm v9 或更高版本
|
||||||
|
- Rust 工具链(版本 1.87)
|
||||||
|
- LLVM 和 Clang
|
||||||
|
- Protoc(Protocol Buffers 编译器)
|
||||||
|
|
||||||
|
#### 平台特定依赖
|
||||||
|
|
||||||
|
**Linux (Ubuntu/Debian)**
|
||||||
|
```bash
|
||||||
|
# 核心构建依赖
|
||||||
|
sudo apt-get update && sudo apt-get install -y \
|
||||||
|
musl-tools \
|
||||||
|
libappindicator3-dev \
|
||||||
|
llvm \
|
||||||
|
clang \
|
||||||
|
protobuf-compiler
|
||||||
|
|
||||||
|
# GUI 构建依赖
|
||||||
|
sudo apt install -y \
|
||||||
|
libwebkit2gtk-4.1-dev \
|
||||||
|
build-essential \
|
||||||
|
curl \
|
||||||
|
wget \
|
||||||
|
file \
|
||||||
|
libgtk-3-dev \
|
||||||
|
librsvg2-dev \
|
||||||
|
libxdo-dev \
|
||||||
|
libssl-dev \
|
||||||
|
patchelf
|
||||||
|
|
||||||
|
# 测试依赖
|
||||||
|
sudo apt install -y bridge-utils
|
||||||
|
```
|
||||||
|
|
||||||
|
**交叉编译依赖**
|
||||||
|
- musl-cross 工具链(用于 MIPS 和其他架构)
|
||||||
|
- 可能需要额外配置(详见 `.github/workflows/` 目录)
|
||||||
|
|
||||||
|
**Android 开发依赖**
|
||||||
|
- Java 20
|
||||||
|
- Android SDK(Build Tools 34.0.0)
|
||||||
|
- Android NDK(26.0.10792818)
|
||||||
|
|
||||||
|
### 安装步骤
|
||||||
|
|
||||||
|
1. 克隆仓库:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/EasyTier/EasyTier.git
|
||||||
|
cd EasyTier
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 安装依赖:
|
||||||
|
```bash
|
||||||
|
# 安装 Rust 工具链
|
||||||
|
rustup install 1.87
|
||||||
|
rustup default 1.87
|
||||||
|
|
||||||
|
# 安装项目依赖
|
||||||
|
pnpm -r install
|
||||||
|
```
|
||||||
|
|
||||||
|
## 项目结构
|
||||||
|
|
||||||
|
```
|
||||||
|
easytier/ # 核心功能和库
|
||||||
|
easytier-web/ # Web 仪表盘和前端
|
||||||
|
easytier-gui/ # 桌面 GUI 应用
|
||||||
|
.github/workflows/ # CI/CD 配置文件
|
||||||
|
```
|
||||||
|
|
||||||
|
## 构建指南
|
||||||
|
|
||||||
|
### 构建核心组件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 标准构建
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
|
# 特定平台构建
|
||||||
|
cargo build --release --target x86_64-unknown-linux-musl # Linux x86_64
|
||||||
|
cargo build --release --target aarch64-unknown-linux-musl # Linux ARM64
|
||||||
|
cargo build --release --target x86_64-apple-darwin # macOS x86_64
|
||||||
|
cargo build --release --target aarch64-apple-darwin # macOS M1/M2
|
||||||
|
cargo build --release --target x86_64-pc-windows-msvc # Windows x86_64
|
||||||
|
```
|
||||||
|
|
||||||
|
构建产物位置:`target/[target-triple]/release/`
|
||||||
|
|
||||||
|
### 构建桌面应用
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. 构建前端
|
||||||
|
pnpm -r build
|
||||||
|
|
||||||
|
# 2. 构建 GUI 应用
|
||||||
|
cd easytier-gui
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
pnpm tauri build --target x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
pnpm tauri build --target x86_64-apple-darwin # Intel
|
||||||
|
pnpm tauri build --target aarch64-apple-darwin # Apple Silicon
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
pnpm tauri build --target x86_64-pc-windows-msvc # x64
|
||||||
|
```
|
||||||
|
|
||||||
|
构建产物位置:`easytier-gui/src-tauri/target/release/bundle/`
|
||||||
|
|
||||||
|
### 构建移动应用
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. 安装 Android 目标平台
|
||||||
|
rustup target add aarch64-linux-android
|
||||||
|
rustup target add armv7-linux-androideabi
|
||||||
|
rustup target add i686-linux-android
|
||||||
|
rustup target add x86_64-linux-android
|
||||||
|
|
||||||
|
# 2. 构建 Android 应用
|
||||||
|
cd easytier-gui
|
||||||
|
pnpm tauri android build
|
||||||
|
```
|
||||||
|
|
||||||
|
构建产物位置:`easytier-gui/src-tauri/gen/android/app/build/outputs/apk/universal/release/`
|
||||||
|
|
||||||
|
### 构建注意事项
|
||||||
|
|
||||||
|
1. ARM/MIPS 的交叉编译需要额外配置
|
||||||
|
2. Windows 构建需要正确的 DLL 文件
|
||||||
|
3. 详细构建配置请参考 `.github/workflows/` 目录
|
||||||
|
|
||||||
|
## 开发工作流
|
||||||
|
|
||||||
|
1. 从 `develop` 分支创建特性分支:
|
||||||
|
```bash
|
||||||
|
git checkout develop
|
||||||
|
git checkout -b feature/your-feature-name
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 按照代码规范进行修改
|
||||||
|
|
||||||
|
3. 编写或更新测试
|
||||||
|
|
||||||
|
4. 使用规范的提交信息:
|
||||||
|
```
|
||||||
|
feat: 添加新功能
|
||||||
|
fix: 修复问题
|
||||||
|
docs: 更新文档
|
||||||
|
test: 添加测试
|
||||||
|
chore: 更新依赖
|
||||||
|
```
|
||||||
|
|
||||||
|
5. 提交 Pull Request 到 `develop` 分支
|
||||||
|
|
||||||
|
## 测试指南
|
||||||
|
|
||||||
|
### 运行测试
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 配置系统(Linux)
|
||||||
|
sudo modprobe br_netfilter
|
||||||
|
sudo sysctl net.bridge.bridge-nf-call-iptables=0
|
||||||
|
sudo sysctl net.bridge.bridge-nf-call-ip6tables=0
|
||||||
|
|
||||||
|
# 运行测试
|
||||||
|
cargo test --no-default-features --features=full --verbose
|
||||||
|
```
|
||||||
|
|
||||||
|
### 测试要求
|
||||||
|
|
||||||
|
- 为新功能编写测试
|
||||||
|
- 维护现有测试覆盖率
|
||||||
|
- 测试应该是独立且可重复的
|
||||||
|
- 包含单元测试和集成测试
|
||||||
|
|
||||||
|
## Pull Request 规范
|
||||||
|
|
||||||
|
1. 目标分支为 `develop`
|
||||||
|
2. 确保所有测试通过
|
||||||
|
3. 包含清晰的描述和目的
|
||||||
|
4. 关联相关的 issues
|
||||||
|
5. 保持变更的原子性和聚焦性
|
||||||
|
6. 及时更新相关文档
|
||||||
|
|
||||||
|
## 其他资源
|
||||||
|
|
||||||
|
- [问题追踪](https://github.com/EasyTier/EasyTier/issues)
|
||||||
|
- [项目文档](https://github.com/EasyTier/EasyTier/wiki)
|
||||||
|
|
||||||
|
## 需要帮助?
|
||||||
|
|
||||||
|
欢迎:
|
||||||
|
- 提出问题
|
||||||
|
- 参与社区讨论
|
||||||
|
- 联系维护者
|
||||||
|
|
||||||
|
感谢您为 EasyTier 做出贡献!
|
5255
Cargo.lock
generated
15
Cargo.toml
@@ -1,7 +1,16 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
members = ["easytier", "easytier-gui/src-tauri"]
|
members = [
|
||||||
default-members = ["easytier"]
|
"easytier",
|
||||||
|
"easytier-gui/src-tauri",
|
||||||
|
"easytier-rpc-build",
|
||||||
|
"easytier-web",
|
||||||
|
"easytier-contrib/easytier-ffi",
|
||||||
|
]
|
||||||
|
default-members = ["easytier", "easytier-web"]
|
||||||
|
exclude = [
|
||||||
|
"easytier-contrib/easytier-ohrs", # it needs ohrs sdk
|
||||||
|
]
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
panic = "unwind"
|
panic = "unwind"
|
||||||
@@ -10,3 +19,5 @@ panic = "unwind"
|
|||||||
panic = "abort"
|
panic = "abort"
|
||||||
lto = true
|
lto = true
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
opt-level = 3
|
||||||
|
strip = true
|
||||||
|
@@ -4,84 +4,45 @@
|
|||||||
"path": "."
|
"path": "."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"name": "core",
|
||||||
|
"path": "easytier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gui",
|
||||||
"path": "easytier-gui"
|
"path": "easytier-gui"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "easytier"
|
"name": "web",
|
||||||
|
"path": "easytier-web"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ffi",
|
||||||
|
"path": "easytier-contrib/easytier-ffi"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "magisk",
|
||||||
|
"path": "easytier-contrib/easytier-magisk"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "openharmony",
|
||||||
|
"path": "easytier-contrib/easytier-ohrs"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vpnservice",
|
||||||
|
"path": "tauri-plugin-vpnservice"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rpc-build",
|
||||||
|
"path": "easytier-rpc-build"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"eslint.useFlatConfig": true,
|
"i18n-ally.sourceLanguage": "cn",
|
||||||
|
"i18n-ally.keystyle": "nested",
|
||||||
|
"i18n-ally.sortKeys": true,
|
||||||
|
// Disable the default formatter
|
||||||
"prettier.enable": false,
|
"prettier.enable": false,
|
||||||
"editor.formatOnSave": false,
|
"editor.formatOnSave": true,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.formatOnSaveMode": "modifications",
|
||||||
"source.fixAll.eslint": "explicit",
|
|
||||||
"source.organizeImports": "never"
|
|
||||||
},
|
|
||||||
"eslint.rules.customizations": [
|
|
||||||
{
|
|
||||||
"rule": "style/*",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "style/eol-last",
|
|
||||||
"severity": "error"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "format/*",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-indent",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-spacing",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-spaces",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-order",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-dangle",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*-newline",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*quotes",
|
|
||||||
"severity": "off"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "*semi",
|
|
||||||
"severity": "off"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"eslint.validate": [
|
|
||||||
"code-workspace",
|
|
||||||
"javascript",
|
|
||||||
"javascriptreact",
|
|
||||||
"typescript",
|
|
||||||
"typescriptreact",
|
|
||||||
"vue",
|
|
||||||
"html",
|
|
||||||
"markdown",
|
|
||||||
"json",
|
|
||||||
"jsonc",
|
|
||||||
"yaml",
|
|
||||||
"toml",
|
|
||||||
"gql",
|
|
||||||
"graphql"
|
|
||||||
],
|
|
||||||
"i18n-ally.localesPaths": [
|
|
||||||
"easytier-gui/locales"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
174
LICENSE
@@ -1,73 +1,165 @@
|
|||||||
Apache License
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
Version 2.0, January 2004
|
Version 3, 29 June 2007
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
0. Additional Definitions.
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
4. Combined Works.
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
d) Do one of the following:
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
Copyright 2023 sunsijie
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
5. Combined Libraries.
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
a) Accompany the combined library with a copy of the same work based
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
on the Library, uncombined with any other library facilities,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
conveyed under the terms of this License.
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
|
467
README.md
@@ -1,240 +1,244 @@
|
|||||||
# EasyTier
|
# EasyTier
|
||||||
|
|
||||||
|
[](https://github.com/EasyTier/EasyTier/releases)
|
||||||
[](https://github.com/EasyTier/EasyTier/blob/main/LICENSE)
|
[](https://github.com/EasyTier/EasyTier/blob/main/LICENSE)
|
||||||
[](https://github.com/EasyTier/EasyTier/commits/main)
|
[](https://github.com/EasyTier/EasyTier/commits/main)
|
||||||
[](https://github.com/EasyTier/EasyTier/issues)
|
[](https://github.com/EasyTier/EasyTier/issues)
|
||||||
[](https://github.com/EasyTier/EasyTier/actions/workflows/core.yml)
|
[](https://github.com/EasyTier/EasyTier/actions/workflows/core.yml)
|
||||||
[](https://github.com/EasyTier/EasyTier/actions/workflows/gui.yml)
|
[](https://github.com/EasyTier/EasyTier/actions/workflows/gui.yml)
|
||||||
|
[](https://github.com/EasyTier/EasyTier/actions/workflows/test.yml)
|
||||||
|
[](https://deepwiki.com/EasyTier/EasyTier)
|
||||||
|
|
||||||
[简体中文](/README_CN.md) | [English](/README.md)
|
[简体中文](/README_CN.md) | [English](/README.md)
|
||||||
|
|
||||||
**Please visit the [EasyTier Official Website](https://www.easytier.top/en/) to view the full documentation.**
|
> ✨ A simple, secure, decentralized virtual private network solution powered by Rust and Tokio
|
||||||
|
|
||||||
EasyTier is a simple, safe and decentralized VPN networking solution implemented with the Rust language and Tokio framework.
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="assets/image-5.png" width="300">
|
<img src="assets/config-page.png" width="300" alt="config page">
|
||||||
<img src="assets/image-4.png" width="300">
|
<img src="assets/running-page.png" width="300" alt="running page">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
📚 **[Full Documentation](https://easytier.cn/en/)** | 🖥️ **[Web Console](https://easytier.cn/web)** | 📝 **[Download Releases](https://github.com/EasyTier/EasyTier/releases)** | 🧩 **[Third Party Tools](https://easytier.cn/en/guide/installation_gui.html#third-party-graphical-interfaces)** | ❤️ **[Sponsor](#sponsor)**
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Decentralized**: No need to rely on centralized services, nodes are equal and independent.
|
### Core Features
|
||||||
- **Safe**: Use WireGuard protocol to encrypt data.
|
|
||||||
- **High Performance**: Full-link zero-copy, with performance comparable to mainstream networking software.
|
|
||||||
- **Cross-platform**: Supports MacOS/Linux/Windows/Android, will support IOS in the future. The executable file is statically linked, making deployment simple.
|
|
||||||
- **Networking without public IP**: Supports networking using shared public nodes, refer to [Configuration Guide](#Networking-without-public-IP)
|
|
||||||
- **NAT traversal**: Supports UDP-based NAT traversal, able to establish stable connections even in complex network environments.
|
|
||||||
- **Subnet Proxy (Point-to-Network)**: Nodes can expose accessible network segments as proxies to the VPN subnet, allowing other nodes to access these subnets through the node.
|
|
||||||
- **Smart Routing**: Selects links based on traffic to reduce latency and increase throughput.
|
|
||||||
- **TCP Support**: Provides reliable data transmission through concurrent TCP links when UDP is limited, optimizing performance.
|
|
||||||
- **High Availability**: Supports multi-path and switches to healthy paths when high packet loss or network errors are detected.
|
|
||||||
- **IPv6 Support**: Supports networking using IPv6.
|
|
||||||
- **Multiple Protocol Types**: Supports communication between nodes using protocols such as WebSocket and QUIC.
|
|
||||||
|
|
||||||
## Installation
|
- 🔒 **Decentralized**: Nodes are equal and independent, no centralized services required
|
||||||
|
- 🚀 **Easy to Use**: Multiple operation methods via web, client, and command line
|
||||||
|
- 🌍 **Cross-Platform**: Supports Win/MacOS/Linux/FreeBSD/Android and X86/ARM/MIPS architectures
|
||||||
|
- 🔐 **Secure**: AES-GCM or WireGuard encryption, prevents man-in-the-middle attacks
|
||||||
|
|
||||||
1. **Download the precompiled binary file**
|
### Advanced Capabilities
|
||||||
|
|
||||||
Visit the [GitHub Release page](https://github.com/EasyTier/EasyTier/releases) to download the binary file suitable for your operating system. Release includes both command-line programs and GUI programs in the compressed package.
|
- 🔌 **Efficient NAT Traversal**: Supports UDP and IPv6 traversal, works with NAT4-NAT4 networks
|
||||||
|
- 🌐 **Subnet Proxy**: Nodes can share subnets for other nodes to access
|
||||||
|
- 🔄 **Intelligent Routing**: Latency priority and automatic route selection for best network experience
|
||||||
|
- ⚡ **High Performance**: Zero-copy throughout the entire link, supports TCP/UDP/WSS/WG protocols
|
||||||
|
|
||||||
2. **Install via crates.io**
|
### Network Optimization
|
||||||
|
|
||||||
```sh
|
- 📊 **UDP Loss Resistance**: KCP/QUIC proxy optimizes latency and bandwidth in high packet loss environments
|
||||||
cargo install easytier
|
- 🔧 **Web Management**: Easy configuration and monitoring through web interface
|
||||||
```
|
- 🛠️ **Zero Config**: Simple deployment with statically linked executables
|
||||||
|
|
||||||
3. **Install from source code**
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cargo install --git https://github.com/EasyTier/EasyTier.git easytier
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **Install by Docker Compose**
|
|
||||||
|
|
||||||
Please visit the [EasyTier Official Website](https://www.easytier.top/en/) to view the full documentation.
|
|
||||||
|
|
||||||
5. **Install by script (For Linux Only)**
|
|
||||||
|
|
||||||
```sh
|
|
||||||
wget -O /tmp/easytier.sh "https://raw.githubusercontent.com/EasyTier/EasyTier/main/script/install.sh" && bash /tmp/easytier.sh install
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also uninstall/update Easytier by the command "uninstall" or "update" of this script
|
|
||||||
|
|
||||||
6. **Install by Homebrew (For MacOS Only)**
|
|
||||||
|
|
||||||
```sh
|
|
||||||
brew tap brewforge/chinese
|
|
||||||
brew install --cask easytier
|
|
||||||
```
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
> The following text only describes the use of the command-line tool; the GUI program can be configured by referring to the following concepts.
|
### 📥 Installation
|
||||||
|
|
||||||
Make sure EasyTier is installed according to the [Installation Guide](#Installation), and both easytier-core and easytier-cli commands are available.
|
Choose the installation method that best suits your needs:
|
||||||
|
|
||||||
### Two-node Networking
|
```bash
|
||||||
|
# 1. Download pre-built binary (Recommended, All platforms supported)
|
||||||
|
# Visit https://github.com/EasyTier/EasyTier/releases
|
||||||
|
|
||||||
Assuming the network topology of the two nodes is as follows
|
# 2. Install via cargo (Latest development version)
|
||||||
|
cargo install --git https://github.com/EasyTier/EasyTier.git easytier
|
||||||
|
|
||||||
|
# 3. Install via Docker
|
||||||
|
# See https://easytier.cn/en/guide/installation.html#installation-methods
|
||||||
|
|
||||||
|
# 4. Linux Quick Install
|
||||||
|
wget -O- https://raw.githubusercontent.com/EasyTier/EasyTier/main/script/install.sh | sudo bash
|
||||||
|
|
||||||
|
# 5. MacOS via Homebrew
|
||||||
|
brew tap brewforge/chinese
|
||||||
|
brew install --cask easytier-gui
|
||||||
|
|
||||||
|
# 6. OpenWrt Luci Web UI
|
||||||
|
# Visit https://github.com/EasyTier/luci-app-easytier
|
||||||
|
|
||||||
|
# 7. (Optional) Install shell completions:
|
||||||
|
easytier-core --gen-autocomplete fish > ~/.config/fish/completions/easytier-core.fish
|
||||||
|
easytier-cli gen-autocomplete fish > ~/.config/fish/completions/easytier-cli.fish
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🚀 Basic Usage
|
||||||
|
|
||||||
|
#### Quick Networking with Shared Nodes
|
||||||
|
|
||||||
|
EasyTier supports quick networking using shared public nodes. When you don't have a public IP, you can use the free shared nodes provided by the EasyTier community. Nodes will automatically attempt NAT traversal and establish P2P connections. When P2P fails, data will be relayed through shared nodes.
|
||||||
|
|
||||||
|
The currently deployed shared public node is `tcp://public.easytier.cn:11010`.
|
||||||
|
|
||||||
|
When using shared nodes, each node entering the network needs to provide the same `--network-name` and `--network-secret` parameters as the unique identifier of the network.
|
||||||
|
|
||||||
|
Taking two nodes as an example (Please use more complex network name to avoid conflicts):
|
||||||
|
|
||||||
|
1. Run on Node A:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run with administrator privileges
|
||||||
|
sudo easytier-core -d --network-name abc --network-secret abc -p tcp://public.easytier.cn:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Run on Node B:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run with administrator privileges
|
||||||
|
sudo easytier-core -d --network-name abc --network-secret abc -p tcp://public.easytier.cn:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
After successful execution, you can check the network status using `easytier-cli`:
|
||||||
|
|
||||||
|
```text
|
||||||
|
| ipv4 | hostname | cost | lat_ms | loss_rate | rx_bytes | tx_bytes | tunnel_proto | nat_type | id | version |
|
||||||
|
| ------------ | -------------- | ----- | ------ | --------- | -------- | -------- | ------------ | -------- | ---------- | --------------- |
|
||||||
|
| 10.126.126.1 | abc-1 | Local | * | * | * | * | udp | FullCone | 439804259 | 2.4.0-70e69a38~ |
|
||||||
|
| 10.126.126.2 | abc-2 | p2p | 3.452 | 0 | 17.33 kB | 20.42 kB | udp | FullCone | 390879727 | 2.4.0-70e69a38~ |
|
||||||
|
| | PublicServer_a | p2p | 27.796 | 0.000 | 50.01 kB | 67.46 kB | tcp | Unknown | 3771642457 | 2.4.0-70e69a38~ |
|
||||||
|
```
|
||||||
|
|
||||||
|
You can test connectivity between nodes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Test connectivity
|
||||||
|
ping 10.126.126.1
|
||||||
|
ping 10.126.126.2
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: If you cannot ping through, it may be that the firewall is blocking incoming traffic. Please turn off the firewall or add allow rules.
|
||||||
|
|
||||||
|
To improve availability, you can connect to multiple shared nodes simultaneously:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Connect to multiple shared nodes
|
||||||
|
sudo easytier-core -d --network-name abc --network-secret abc -p tcp://public.easytier.cn:11010 -p udp://public.easytier.cn:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
Once your network is set up successfully, you can easily configure it to start automatically on system boot. Refer to the [One-Click Register Service guide](https://easytier.cn/en/guide/network/oneclick-install-as-service.html) for step-by-step instructions on registering EasyTier as a system service.
|
||||||
|
|
||||||
|
#### Decentralized Networking
|
||||||
|
|
||||||
|
EasyTier is fundamentally decentralized, with no distinction between server and client. As long as one device can communicate with any node in the virtual network, it can join the virtual network. Here's how to set up a decentralized network:
|
||||||
|
|
||||||
|
1. Start First Node (Node A):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start the first node
|
||||||
|
sudo easytier-core -i 10.144.144.1
|
||||||
|
```
|
||||||
|
|
||||||
|
After startup, this node will listen on the following ports by default:
|
||||||
|
- TCP: 11010
|
||||||
|
- UDP: 11010
|
||||||
|
- WebSocket: 11011
|
||||||
|
- WebSocket SSL: 11012
|
||||||
|
- WireGuard: 11013
|
||||||
|
|
||||||
|
2. Connect Second Node (Node B):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Connect to the first node using its public IP
|
||||||
|
sudo easytier-core -i 10.144.144.2 -p udp://FIRST_NODE_PUBLIC_IP:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Verify Connection:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Test connectivity
|
||||||
|
ping 10.144.144.2
|
||||||
|
|
||||||
|
# View connected peers
|
||||||
|
easytier-cli peer
|
||||||
|
|
||||||
|
# View routing information
|
||||||
|
easytier-cli route
|
||||||
|
|
||||||
|
# View local node information
|
||||||
|
easytier-cli node
|
||||||
|
```
|
||||||
|
|
||||||
|
For more nodes to join the network, they can connect to any existing node in the network using the `-p` parameter:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Connect to any existing node using its public IP
|
||||||
|
sudo easytier-core -i 10.144.144.3 -p udp://ANY_EXISTING_NODE_PUBLIC_IP:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🔍 Advanced Features
|
||||||
|
|
||||||
|
#### Subnet Proxy
|
||||||
|
|
||||||
|
Assuming the network topology is as follows, Node B wants to share its accessible subnet 10.1.1.0/24 with other nodes:
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR
|
flowchart LR
|
||||||
|
|
||||||
subgraph Node A IP 22.1.1.1
|
subgraph Node A Public IP 22.1.1.1
|
||||||
nodea[EasyTier\n10.144.144.1]
|
nodea[EasyTier<br/>10.144.144.1]
|
||||||
end
|
end
|
||||||
|
|
||||||
subgraph Node B
|
subgraph Node B
|
||||||
nodeb[EasyTier\n10.144.144.2]
|
nodeb[EasyTier<br/>10.144.144.2]
|
||||||
end
|
|
||||||
|
|
||||||
nodea <-----> nodeb
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
1. Execute on Node A:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo easytier-core --ipv4 10.144.144.1
|
|
||||||
```
|
|
||||||
|
|
||||||
Successful execution of the command will print the following.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
2. Execute on Node B
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo easytier-core --ipv4 10.144.144.2 --peers udp://22.1.1.1:11010
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Test Connectivity
|
|
||||||
|
|
||||||
The two nodes should connect successfully and be able to communicate within the virtual subnet
|
|
||||||
|
|
||||||
```sh
|
|
||||||
ping 10.144.144.2
|
|
||||||
```
|
|
||||||
|
|
||||||
Use easytier-cli to view node information in the subnet
|
|
||||||
|
|
||||||
```sh
|
|
||||||
easytier-cli peer
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
```sh
|
|
||||||
easytier-cli route
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
```sh
|
|
||||||
easytier-cli node
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Multi-node Networking
|
|
||||||
|
|
||||||
Based on the two-node networking example just now, if more nodes need to join the virtual network, you can use the following command.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo easytier-core --ipv4 10.144.144.2 --peers udp://22.1.1.1:11010
|
|
||||||
```
|
|
||||||
|
|
||||||
The `--peers` parameter can fill in the listening address of any node already in the virtual network.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Subnet Proxy (Point-to-Network) Configuration
|
|
||||||
|
|
||||||
Assuming the network topology is as follows, Node B wants to share its accessible subnet 10.1.1.0/24 with other nodes.
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
flowchart LR
|
|
||||||
|
|
||||||
subgraph Node A IP 22.1.1.1
|
|
||||||
nodea[EasyTier\n10.144.144.1]
|
|
||||||
end
|
|
||||||
|
|
||||||
subgraph Node B
|
|
||||||
nodeb[EasyTier\n10.144.144.2]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
id1[[10.1.1.0/24]]
|
id1[[10.1.1.0/24]]
|
||||||
|
|
||||||
nodea <--> nodeb <-.-> id1
|
nodea <--> nodeb <-.-> id1
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Then the startup parameters for Node B's easytier are (new -n parameter)
|
To share a subnet, add the `-n` parameter when starting EasyTier:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
sudo easytier-core --ipv4 10.144.144.2 -n 10.1.1.0/24
|
# Share subnet 10.1.1.0/24 with other nodes
|
||||||
|
sudo easytier-core -i 10.144.144.2 -n 10.1.1.0/24
|
||||||
```
|
```
|
||||||
|
|
||||||
Subnet proxy information will automatically sync to each node in the virtual network, and each node will automatically configure the corresponding route. Node A can check whether the subnet proxy is effective through the following command.
|
Subnet proxy information will automatically sync to each node in the virtual network, and each node will automatically configure the corresponding route. You can verify the subnet proxy setup:
|
||||||
|
|
||||||
1. Check whether the routing information has been synchronized, the proxy_cidrs column shows the proxied subnets.
|
1. Check if the routing information has been synchronized (the proxy_cidrs column shows the proxied subnets):
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
easytier-cli route
|
# View routing information
|
||||||
```
|
easytier-cli route
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
2. Test whether Node A can access nodes under the proxied subnet
|
|
||||||
|
|
||||||
```sh
|
|
||||||
ping 10.1.1.2
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Networking without Public IP
|
|
||||||
|
|
||||||
EasyTier supports networking using shared public nodes. The currently deployed shared public node is ``tcp://public.easytier.top:11010``.
|
|
||||||
|
|
||||||
When using shared nodes, each node entering the network needs to provide the same ``--network-name`` and ``--network-secret`` parameters as the unique identifier of the network.
|
|
||||||
|
|
||||||
Taking two nodes as an example, Node A executes:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo easytier-core -i 10.144.144.1 --network-name abc --network-secret abc -e tcp://public.easytier.top:11010
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Node B executes
|

|
||||||
|
|
||||||
```sh
|
2. Test if you can access nodes in the proxied subnet:
|
||||||
sudo easytier-core --ipv4 10.144.144.2 --network-name abc --network-secret abc -e tcp://public.easytier.top:11010
|
|
||||||
|
```bash
|
||||||
|
# Test connectivity to proxied subnet
|
||||||
|
ping 10.1.1.2
|
||||||
```
|
```
|
||||||
|
|
||||||
After the command is successfully executed, Node A can access Node B through the virtual IP 10.144.144.2.
|
#### WireGuard Integration
|
||||||
|
|
||||||
### Use EasyTier with WireGuard Client
|
EasyTier can act as a WireGuard server, allowing any device with a WireGuard client (including iOS and Android) to access the EasyTier network. Here's an example setup:
|
||||||
|
|
||||||
EasyTier can be used as a WireGuard server to allow any device with WireGuard client installed to access the EasyTier network. For platforms currently unsupported by EasyTier (such as iOS, Android, etc.), this method can be used to connect to the EasyTier network.
|
|
||||||
|
|
||||||
Assuming the network topology is as follows:
|
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR
|
flowchart LR
|
||||||
|
|
||||||
ios[[iPhone \n WireGuard Installed]]
|
ios[[iPhone<br/>WireGuard Installed]]
|
||||||
|
|
||||||
subgraph Node A IP 22.1.1.1
|
subgraph Node A Public IP 22.1.1.1
|
||||||
nodea[EasyTier\n10.144.144.1]
|
nodea[EasyTier<br/>10.144.144.1]
|
||||||
end
|
end
|
||||||
|
|
||||||
subgraph Node B
|
subgraph Node B
|
||||||
nodeb[EasyTier\n10.144.144.2]
|
nodeb[EasyTier<br/>10.144.144.2]
|
||||||
end
|
end
|
||||||
|
|
||||||
id1[[10.1.1.0/24]]
|
id1[[10.1.1.0/24]]
|
||||||
@@ -242,88 +246,73 @@ id1[[10.1.1.0/24]]
|
|||||||
ios <-.-> nodea <--> nodeb <-.-> id1
|
ios <-.-> nodea <--> nodeb <-.-> id1
|
||||||
```
|
```
|
||||||
|
|
||||||
To enable an iPhone to access the EasyTier network through Node A, the following configuration can be applied:
|
1. Start EasyTier with WireGuard portal enabled:
|
||||||
|
|
||||||
Include the --vpn-portal parameter in the easytier-core command on Node A to specify the port that the WireGuard service listens on and the subnet used by the WireGuard network.
|
```bash
|
||||||
|
# Listen on 0.0.0.0:11013 and use 10.14.14.0/24 subnet for WireGuard clients
|
||||||
```sh
|
sudo easytier-core -i 10.144.144.1 --vpn-portal wg://0.0.0.0:11013/10.14.14.0/24
|
||||||
# The following parameters mean: listen on port 0.0.0.0:11013, and use the 10.14.14.0/24 subnet for WireGuard
|
|
||||||
sudo easytier-core --ipv4 10.144.144.1 --vpn-portal wg://0.0.0.0:11013/10.14.14.0/24
|
|
||||||
```
|
```
|
||||||
|
|
||||||
After successfully starting easytier-core, use easytier-cli to obtain the WireGuard client configuration.
|
2. Get WireGuard client configuration:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$> easytier-cli vpn-portal
|
# Get WireGuard client configuration
|
||||||
portal_name: wireguard
|
easytier-cli vpn-portal
|
||||||
|
|
||||||
############### client_config_start ###############
|
|
||||||
|
|
||||||
[Interface]
|
|
||||||
PrivateKey = 9VDvlaIC9XHUvRuE06hD2CEDrtGF+0lDthgr9SZfIho=
|
|
||||||
Address = 10.14.14.0/32 # should assign an ip from this cidr manually
|
|
||||||
|
|
||||||
[Peer]
|
|
||||||
PublicKey = zhrZQg4QdPZs8CajT3r4fmzcNsWpBL9ImQCUsnlXyGM=
|
|
||||||
AllowedIPs = 10.144.144.0/24,10.14.14.0/24
|
|
||||||
Endpoint = 0.0.0.0:11013 # should be the public ip(or domain) of the vpn server
|
|
||||||
PersistentKeepalive = 25
|
|
||||||
|
|
||||||
############### client_config_end ###############
|
|
||||||
|
|
||||||
connected_clients:
|
|
||||||
[]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Before using the Client Config, you need to modify the Interface Address and Peer Endpoint to the client's IP and the IP of the EasyTier node, respectively. Import the configuration file into the WireGuard client to access the EasyTier network.
|
3. In the output configuration:
|
||||||
|
- Set `Interface.Address` to an available IP from the WireGuard subnet
|
||||||
|
- Set `Peer.Endpoint` to the public IP/domain of your EasyTier node
|
||||||
|
- Import the modified configuration into your WireGuard client
|
||||||
|
|
||||||
### Self-Hosted Public Server
|
#### Self-Hosted Public Shared Node
|
||||||
|
|
||||||
Every virtual network (with same network name and secret) can act as a public server cluster. Nodes of other network can connect to arbitrary nodes in public server cluster to discover each other without public IP.
|
You can run your own public shared node to help other nodes discover each other. A public shared node is just a regular EasyTier network (with same network name and secret) that other networks can connect to.
|
||||||
|
|
||||||
Run you own public server cluster is exactly same as running an virtual network, except that you can skip config the ipv4 addr.
|
To run a public shared node:
|
||||||
|
|
||||||
You can also join the official public server cluster with following command:
|
```bash
|
||||||
|
# No need to specify IPv4 address for public shared nodes
|
||||||
```
|
sudo easytier-core --network-name mysharednode --network-secret mysharednode
|
||||||
sudo easytier-core --network-name easytier --network-secret easytier -p tcp://public.easytier.top:11010
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Related Projects
|
||||||
### Configurations
|
|
||||||
|
|
||||||
You can use ``easytier-core --help`` to view all configuration items
|
|
||||||
|
|
||||||
## Roadmap
|
|
||||||
|
|
||||||
- [ ] Improve documentation and user guides.
|
|
||||||
- [ ] Support features such as encryption, TCP hole punching, etc.
|
|
||||||
- [ ] Support iOS.
|
|
||||||
- [ ] Support Web configuration management.
|
|
||||||
|
|
||||||
## Community and Contribution
|
|
||||||
|
|
||||||
We welcome and encourage community contributions! If you want to get involved, please submit a [GitHub PR](https://github.com/EasyTier/EasyTier/pulls). Detailed contribution guidelines can be found in [CONTRIBUTING.md](https://github.com/EasyTier/EasyTier/blob/main/CONTRIBUTING.md).
|
|
||||||
|
|
||||||
## Related Projects and Resources
|
|
||||||
|
|
||||||
- [ZeroTier](https://www.zerotier.com/): A global virtual network for connecting devices.
|
- [ZeroTier](https://www.zerotier.com/): A global virtual network for connecting devices.
|
||||||
- [TailScale](https://tailscale.com/): A VPN solution aimed at simplifying network configuration.
|
- [TailScale](https://tailscale.com/): A VPN solution aimed at simplifying network configuration.
|
||||||
- [vpncloud](https://github.com/dswd/vpncloud): A P2P Mesh VPN
|
- [vpncloud](https://github.com/dswd/vpncloud): A P2P Mesh VPN
|
||||||
- [Candy](https://github.com/lanthora/candy): A reliable, low-latency, and anti-censorship virtual private network
|
- [Candy](https://github.com/lanthora/candy): A reliable, low-latency, and anti-censorship virtual private network
|
||||||
|
|
||||||
|
### Contact Us
|
||||||
|
|
||||||
|
- 💬 **[Telegram Group](https://t.me/easytier)**
|
||||||
|
- 👥 **[QQ Group: 949700262](https://qm.qq.com/cgi-bin/qm/qr?k=kC8YJ6Jb8vWJIDbZrZJB8pB5YZgPJA5-)**
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
EasyTier is released under the [Apache License 2.0](https://github.com/EasyTier/EasyTier/blob/main/LICENSE).
|
EasyTier is released under the [LGPL-3.0](https://github.com/EasyTier/EasyTier/blob/main/LICENSE).
|
||||||
|
|
||||||
## Contact
|
|
||||||
|
|
||||||
- Ask questions or report problems: [GitHub Issues](https://github.com/EasyTier/EasyTier/issues)
|
|
||||||
- Discussion and exchange: [GitHub Discussions](https://github.com/EasyTier/EasyTier/discussions)
|
|
||||||
- Telegram:https://t.me/easytier
|
|
||||||
- QQ Group: 949700262
|
|
||||||
|
|
||||||
## Sponsor
|
## Sponsor
|
||||||
|
|
||||||
<img src="assets/image-8.png" width="300">
|
CDN acceleration and security protection for this project are sponsored by Tencent EdgeOne.
|
||||||
<img src="assets/image-9.png" width="300">
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://edgeone.ai/?from=github" target="_blank">
|
||||||
|
<img src="assets/edgeone.png" width="200" alt="EdgeOne Logo">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Special thanks to [Langlang Cloud](https://langlang.cloud/) for sponsoring our public servers.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://langlangy.cn/?i26c5a5" target="_blank">
|
||||||
|
<img src="assets/langlang.png" width="200">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
If you find EasyTier helpful, please consider sponsoring us. Software development and maintenance require a lot of time and effort, and your sponsorship will help us better maintain and improve EasyTier.
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="assets/wechat.png" width="200">
|
||||||
|
<img src="assets/alipay.png" width="200">
|
||||||
|
</p>
|
||||||
|
472
README_CN.md
@@ -1,241 +1,243 @@
|
|||||||
# EasyTier
|
# EasyTier
|
||||||
|
|
||||||
|
[](https://github.com/EasyTier/EasyTier/releases)
|
||||||
[](https://github.com/EasyTier/EasyTier/blob/main/LICENSE)
|
[](https://github.com/EasyTier/EasyTier/blob/main/LICENSE)
|
||||||
[](https://github.com/EasyTier/EasyTier/commits/main)
|
[](https://github.com/EasyTier/EasyTier/commits/main)
|
||||||
[](https://github.com/EasyTier/EasyTier/issues)
|
[](https://github.com/EasyTier/EasyTier/issues)
|
||||||
[](https://github.com/EasyTier/EasyTier/actions/workflows/core.yml)
|
[](https://github.com/EasyTier/EasyTier/actions/workflows/core.yml)
|
||||||
[](https://github.com/EasyTier/EasyTier/actions/workflows/gui.yml)
|
[](https://github.com/EasyTier/EasyTier/actions/workflows/gui.yml)
|
||||||
|
[](https://github.com/EasyTier/EasyTier/actions/workflows/test.yml)
|
||||||
|
[](https://deepwiki.com/EasyTier/EasyTier)
|
||||||
|
|
||||||
[简体中文](/README_CN.md) | [English](/README.md)
|
[简体中文](/README_CN.md) | [English](/README.md)
|
||||||
|
|
||||||
**请访问 [EasyTier 官网](https://www.easytier.top/) 以查看完整的文档。**
|
> ✨ 一个由 Rust 和 Tokio 驱动的简单、安全、去中心化的异地组网方案
|
||||||
|
|
||||||
一个简单、安全、去中心化的内网穿透 VPN 组网方案,使用 Rust 语言和 Tokio 框架实现。
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="assets/image-6.png" width="300">
|
<img src="assets/config-page.png" width="300" alt="配置页面">
|
||||||
<img src="assets/image-7.png" width="300">
|
<img src="assets/running-page.png" width="300" alt="运行页面">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## 特点
|
📚 **[完整文档](https://easytier.cn)** | 🖥️ **[Web 控制台](https://easytier.cn/web)** | 📝 **[下载发布版本](https://github.com/EasyTier/EasyTier/releases)** | 🧩 **[第三方工具](https://easytier.cn/guide/installation_gui.html#%E7%AC%AC%E4%B8%89%E6%96%B9%E5%9B%BE%E5%BD%A2%E7%95%8C%E9%9D%A2)** | ❤️ **[赞助](#赞助)**
|
||||||
|
|
||||||
- **去中心化**:无需依赖中心化服务,节点平等且独立。
|
## 特性
|
||||||
- **安全**:支持利用 WireGuard 加密通信,也支持 AES-GCM 加密保护中转流量。
|
|
||||||
- **高性能**:全链路零拷贝,性能与主流组网软件相当。
|
|
||||||
- **跨平台**:支持 MacOS/Linux/Windows/Android,未来将支持 IOS。可执行文件静态链接,部署简单。
|
|
||||||
- **无公网 IP 组网**:支持利用共享的公网节点组网,可参考 [配置指南](#无公网IP组网)
|
|
||||||
- **NAT 穿透**:支持基于 UDP 的 NAT 穿透,即使在复杂的网络环境下也能建立稳定的连接。
|
|
||||||
- **子网代理(点对网)**:节点可以将可访问的网段作为代理暴露给 VPN 子网,允许其他节点通过该节点访问这些子网。
|
|
||||||
- **智能路由**:根据流量智能选择链路,减少延迟,提高吞吐量。
|
|
||||||
- **TCP 支持**:在 UDP 受限的情况下,通过并发 TCP 链接提供可靠的数据传输,优化性能。
|
|
||||||
- **高可用性**:支持多路径和在检测到高丢包率或网络错误时切换到健康路径。
|
|
||||||
- **IPV6 支持**:支持利用 IPV6 组网。
|
|
||||||
- **多协议类型**: 支持使用 WebSocket、QUIC 等协议进行节点间通信。
|
|
||||||
|
|
||||||
## 安装
|
### 核心特性
|
||||||
|
|
||||||
1. **下载预编译的二进制文件**
|
- 🔒 **去中心化**:节点平等且独立,无需中心化服务
|
||||||
|
- 🚀 **易于使用**:支持通过网页、客户端和命令行多种操作方式
|
||||||
|
- 🌍 **跨平台**:支持 Win/MacOS/Linux/FreeBSD/Android 和 X86/ARM/MIPS 架构
|
||||||
|
- 🔐 **安全**:AES-GCM 或 WireGuard 加密,防止中间人攻击
|
||||||
|
|
||||||
访问 [GitHub Release 页面](https://github.com/EasyTier/EasyTier/releases) 下载适用于您操作系统的二进制文件。Release 压缩包中同时包含命令行程序和图形界面程序。
|
### 高级功能
|
||||||
|
|
||||||
2. **通过 crates.io 安装**
|
- 🔌 **高效 NAT 穿透**:支持 UDP 和 IPv6 穿透,可在 NAT4-NAT4 网络中工作
|
||||||
|
- 🌐 **子网代理**:节点可以共享子网供其他节点访问
|
||||||
|
- 🔄 **智能路由**:延迟优先和自动路由选择,提供最佳网络体验
|
||||||
|
- ⚡ **高性能**:整个链路零拷贝,支持 TCP/UDP/WSS/WG 协议
|
||||||
|
|
||||||
```sh
|
### 网络优化
|
||||||
cargo install easytier
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **通过源码安装**
|
- 📊 **UDP 丢包抗性**:KCP/QUIC 代理在高丢包环境下优化延迟和带宽
|
||||||
|
- 🔧 **Web 管理**:通过 Web 界面轻松配置和监控
|
||||||
```sh
|
- 🛠️ **零配置**:静态链接的可执行文件,简单部署
|
||||||
cargo install --git https://github.com/EasyTier/EasyTier.git easytier
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **通过Docker Compose安装**
|
|
||||||
|
|
||||||
请访问 [EasyTier 官网](https://www.easytier.top/) 以查看完整的文档。
|
|
||||||
|
|
||||||
5. **使用一键脚本安装 (仅适用于 Linux)**
|
|
||||||
|
|
||||||
```sh
|
|
||||||
wget -O /tmp/easytier.sh "https://raw.githubusercontent.com/EasyTier/EasyTier/main/script/install.sh" && bash /tmp/easytier.sh install
|
|
||||||
```
|
|
||||||
|
|
||||||
使用本脚本安装的 Easytier 可以使用脚本的 uninstall/update 对其卸载/升级
|
|
||||||
|
|
||||||
6. **使用 Homebrew 安装 (仅适用于 MacOS)**
|
|
||||||
|
|
||||||
```sh
|
|
||||||
brew tap brewforge/chinese
|
|
||||||
brew install --cask easytier
|
|
||||||
```
|
|
||||||
|
|
||||||
## 快速开始
|
## 快速开始
|
||||||
|
|
||||||
> 下文仅描述命令行工具的使用,图形界面程序可参考下述概念自行配置。
|
### 📥 安装
|
||||||
|
|
||||||
确保已按照 [安装指南](#安装) 安装 EasyTier,并且 easytier-core 和 easytier-cli 两个命令都已经可用。
|
选择最适合您需求的安装方式:
|
||||||
|
|
||||||
### 双节点组网
|
```bash
|
||||||
|
# 1. 下载预编译二进制文件(推荐,支持所有平台)
|
||||||
|
# 访问 https://github.com/EasyTier/EasyTier/releases
|
||||||
|
|
||||||
假设双节点的网络拓扑如下
|
# 2. 通过 cargo 安装(最新开发版本)
|
||||||
|
cargo install --git https://github.com/EasyTier/EasyTier.git easytier
|
||||||
|
|
||||||
|
# 3. 通过 Docker 安装
|
||||||
|
# 参见 https://easytier.cn/guide/installation.html#%E5%AE%89%E8%A3%85%E6%96%B9%E5%BC%8F
|
||||||
|
|
||||||
|
# 4. Linux 快速安装
|
||||||
|
wget -O- https://raw.githubusercontent.com/EasyTier/EasyTier/main/script/install.sh | sudo bash
|
||||||
|
|
||||||
|
# 5. MacOS 通过 Homebrew 安装
|
||||||
|
brew tap brewforge/chinese
|
||||||
|
brew install --cask easytier-gui
|
||||||
|
|
||||||
|
# 6. OpenWrt Luci Web 界面
|
||||||
|
# 访问 https://github.com/EasyTier/luci-app-easytier
|
||||||
|
|
||||||
|
# 7.(可选)安装 Shell 补全功能:
|
||||||
|
# Fish 补全
|
||||||
|
easytier-core --gen-autocomplete fish > ~/.config/fish/completions/easytier-core.fish
|
||||||
|
easytier-cli gen-autocomplete fish > ~/.config/fish/completions/easytier-cli.fish
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🚀 基本用法
|
||||||
|
|
||||||
|
#### 使用共享节点快速组网
|
||||||
|
|
||||||
|
EasyTier 支持使用共享公共节点快速组网。当您没有公网 IP 时,可以使用 EasyTier 社区提供的免费共享节点。节点会自动尝试 NAT 穿透并建立 P2P 连接。当 P2P 失败时,数据将通过共享节点中继。
|
||||||
|
|
||||||
|
当前部署的共享公共节点是 `tcp://public.easytier.cn:11010`。
|
||||||
|
|
||||||
|
使用共享节点时,每个进入网络的节点需要提供相同的 `--network-name` 和 `--network-secret` 参数作为网络的唯一标识符。
|
||||||
|
|
||||||
|
以两个节点为例(请使用更复杂的网络名称以避免冲突):
|
||||||
|
|
||||||
|
1. 在节点 A 上运行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 以管理员权限运行
|
||||||
|
sudo easytier-core -d --network-name abc --network-secret abc -p tcp://public.easytier.cn:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
2. 在节点 B 上运行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 以管理员权限运行
|
||||||
|
sudo easytier-core -d --network-name abc --network-secret abc -p tcp://public.easytier.cn:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
执行成功后,可以使用 `easytier-cli` 检查网络状态:
|
||||||
|
|
||||||
|
```text
|
||||||
|
| ipv4 | hostname | cost | lat_ms | loss_rate | rx_bytes | tx_bytes | tunnel_proto | nat_type | id | version |
|
||||||
|
| ------------ | -------------- | ----- | ------ | --------- | -------- | -------- | ------------ | -------- | ---------- | --------------- |
|
||||||
|
| 10.126.126.1 | abc-1 | Local | * | * | * | * | udp | FullCone | 439804259 | 2.4.0-70e69a38~ |
|
||||||
|
| 10.126.126.2 | abc-2 | p2p | 3.452 | 0 | 17.33 kB | 20.42 kB | udp | FullCone | 390879727 | 2.4.0-70e69a38~ |
|
||||||
|
| | PublicServer_a | p2p | 27.796 | 0.000 | 50.01 kB | 67.46 kB | tcp | Unknown | 3771642457 | 2.4.0-70e69a38~ |
|
||||||
|
```
|
||||||
|
|
||||||
|
您可以测试节点之间的连通性:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 测试连通性
|
||||||
|
ping 10.126.126.1
|
||||||
|
ping 10.126.126.2
|
||||||
|
```
|
||||||
|
|
||||||
|
注意:如果无法 ping 通,可能是防火墙阻止了入站流量。请关闭防火墙或添加允许规则。
|
||||||
|
|
||||||
|
为了提高可用性,您可以同时连接多个共享节点:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 连接多个共享节点
|
||||||
|
sudo easytier-core -d --network-name abc --network-secret abc -p tcp://public.easytier.cn:11010 -p udp://public.easytier.cn:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 去中心化组网
|
||||||
|
|
||||||
|
EasyTier 本质上是去中心化的,没有服务器和客户端的区分。只要一个设备能与虚拟网络中的任何节点通信,它就可以加入虚拟网络。以下是如何设置去中心化网络:
|
||||||
|
|
||||||
|
1. 启动第一个节点(节点 A):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 启动第一个节点
|
||||||
|
sudo easytier-core -i 10.144.144.1
|
||||||
|
```
|
||||||
|
|
||||||
|
启动后,该节点将默认监听以下端口:
|
||||||
|
- TCP:11010
|
||||||
|
- UDP:11010
|
||||||
|
- WebSocket:11011
|
||||||
|
- WebSocket SSL:11012
|
||||||
|
- WireGuard:11013
|
||||||
|
|
||||||
|
2. 连接第二个节点(节点 B):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 使用第一个节点的公网 IP 连接
|
||||||
|
sudo easytier-core -i 10.144.144.2 -p udp://第一个节点的公网IP:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 验证连接:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 测试连通性
|
||||||
|
ping 10.144.144.2
|
||||||
|
|
||||||
|
# 查看已连接的对等节点
|
||||||
|
easytier-cli peer
|
||||||
|
|
||||||
|
# 查看路由信息
|
||||||
|
easytier-cli route
|
||||||
|
|
||||||
|
# 查看本地节点信息
|
||||||
|
easytier-cli node
|
||||||
|
```
|
||||||
|
|
||||||
|
更多节点要加入网络,可以使用 `-p` 参数连接到网络中的任何现有节点:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 使用任何现有节点的公网 IP 连接
|
||||||
|
sudo easytier-core -i 10.144.144.3 -p udp://任何现有节点的公网IP:11010
|
||||||
|
```
|
||||||
|
|
||||||
|
### 🔍 高级功能
|
||||||
|
|
||||||
|
#### 子网代理
|
||||||
|
|
||||||
|
假设网络拓扑如下,节点 B 想要与其他节点共享其可访问的子网 10.1.1.0/24:
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR
|
flowchart LR
|
||||||
|
|
||||||
subgraph 节点 A IP 22.1.1.1
|
subgraph 节点 A 公网 IP 22.1.1.1
|
||||||
nodea[EasyTier\n10.144.144.1]
|
nodea[EasyTier<br/>10.144.144.1]
|
||||||
end
|
end
|
||||||
|
|
||||||
subgraph 节点 B
|
subgraph 节点 B
|
||||||
nodeb[EasyTier\n10.144.144.2]
|
nodeb[EasyTier<br/>10.144.144.2]
|
||||||
end
|
|
||||||
|
|
||||||
nodea <-----> nodeb
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
1. 在节点 A 上执行:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo easytier-core --ipv4 10.144.144.1
|
|
||||||
```
|
|
||||||
|
|
||||||
命令执行成功会有如下打印。
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
2. 在节点 B 执行
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo easytier-core --ipv4 10.144.144.2 --peers udp://22.1.1.1:11010
|
|
||||||
```
|
|
||||||
|
|
||||||
3. 测试联通性
|
|
||||||
|
|
||||||
两个节点应成功连接并能够在虚拟子网内通信
|
|
||||||
|
|
||||||
```sh
|
|
||||||
ping 10.144.144.2
|
|
||||||
```
|
|
||||||
|
|
||||||
使用 easytier-cli 查看子网中的节点信息
|
|
||||||
|
|
||||||
```sh
|
|
||||||
easytier-cli peer
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
```sh
|
|
||||||
easytier-cli route
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
```sh
|
|
||||||
easytier-cli node
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 多节点组网
|
|
||||||
|
|
||||||
基于刚才的双节点组网例子,如果有更多的节点需要加入虚拟网络,可以使用如下命令。
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo easytier-core --ipv4 10.144.144.2 --peers udp://22.1.1.1:11010
|
|
||||||
```
|
|
||||||
|
|
||||||
其中 `--peers` 参数可以填写任意一个已经在虚拟网络中的节点的监听地址。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 子网代理(点对网)配置
|
|
||||||
|
|
||||||
假设网络拓扑如下,节点 B 想将其可访问的子网 10.1.1.0/24 共享给其他节点。
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
flowchart LR
|
|
||||||
|
|
||||||
subgraph 节点 A IP 22.1.1.1
|
|
||||||
nodea[EasyTier\n10.144.144.1]
|
|
||||||
end
|
|
||||||
|
|
||||||
subgraph 节点 B
|
|
||||||
nodeb[EasyTier\n10.144.144.2]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
id1[[10.1.1.0/24]]
|
id1[[10.1.1.0/24]]
|
||||||
|
|
||||||
nodea <--> nodeb <-.-> id1
|
nodea <--> nodeb <-.-> id1
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
则节点 B 的 easytier 启动参数为(新增 -n 参数)
|
要共享子网,在启动 EasyTier 时添加 `-n` 参数:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
sudo easytier-core --ipv4 10.144.144.2 -n 10.1.1.0/24
|
# 与其他节点共享子网 10.1.1.0/24
|
||||||
|
sudo easytier-core -i 10.144.144.2 -n 10.1.1.0/24
|
||||||
```
|
```
|
||||||
|
|
||||||
子网代理信息会自动同步到虚拟网络的每个节点,各个节点会自动配置相应的路由,节点 A 可以通过如下命令检查子网代理是否生效。
|
子网代理信息将自动同步到虚拟网络中的每个节点,每个节点将自动配置相应的路由。您可以验证子网代理设置:
|
||||||
|
|
||||||
1. 检查路由信息是否已经同步,proxy_cidrs 列展示了被代理的子网。
|
1. 检查路由信息是否已同步(proxy_cidrs 列显示代理的子网):
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
easytier-cli route
|
# 查看路由信息
|
||||||
```
|
easytier-cli route
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
2. 测试节点 A 是否可访问被代理子网下的节点
|
|
||||||
|
|
||||||
```sh
|
|
||||||
ping 10.1.1.2
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### 无公网IP组网
|
|
||||||
|
|
||||||
EasyTier 支持共享公网节点进行组网。目前已部署共享的公网节点 ``tcp://public.easytier.top:11010``。
|
|
||||||
|
|
||||||
使用共享节点时,需要每个入网节点提供相同的 ``--network-name`` 和 ``--network-secret`` 参数,作为网络的唯一标识。
|
|
||||||
|
|
||||||
以双节点为例,节点 A 执行:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo easytier-core -i 10.144.144.1 --network-name abc --network-secret abc -e tcp://public.easytier.top:11010
|
|
||||||
```
|
```
|
||||||
|
|
||||||
节点 B 执行
|

|
||||||
|
|
||||||
```sh
|
2. 测试是否可以访问代理子网中的节点:
|
||||||
sudo easytier-core --ipv4 10.144.144.2 --network-name abc --network-secret abc -e tcp://public.easytier.top:11010
|
|
||||||
|
```bash
|
||||||
|
# 测试到代理子网的连通性
|
||||||
|
ping 10.1.1.2
|
||||||
```
|
```
|
||||||
|
|
||||||
命令执行成功后,节点 A 即可通过虚拟 IP 10.144.144.2 访问节点 B。
|
#### WireGuard 集成
|
||||||
|
|
||||||
---
|
EasyTier 可以作为 WireGuard 服务器,允许任何安装了 WireGuard 客户端的设备(包括 iOS 和 Android)访问 EasyTier 网络。以下是设置示例:
|
||||||
|
|
||||||
### 使用 WireGuard 客户端接入
|
|
||||||
|
|
||||||
EasyTier 可以用作 WireGuard 服务端,让任意安装了 WireGuard 客户端的设备访问 EasyTier 网络。对于目前 EasyTier 不支持的平台 (如 iOS、Android 等),可以使用这种方式接入 EasyTier 网络。
|
|
||||||
|
|
||||||
假设网络拓扑如下:
|
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR
|
flowchart LR
|
||||||
|
|
||||||
ios[[iPhone \n 安装 WireGuard]]
|
ios[[iPhone<br/>已安装 WireGuard]]
|
||||||
|
|
||||||
subgraph 节点 A IP 22.1.1.1
|
subgraph 节点 A 公网 IP 22.1.1.1
|
||||||
nodea[EasyTier\n10.144.144.1]
|
nodea[EasyTier<br/>10.144.144.1]
|
||||||
end
|
end
|
||||||
|
|
||||||
subgraph 节点 B
|
subgraph 节点 B
|
||||||
nodeb[EasyTier\n10.144.144.2]
|
nodeb[EasyTier<br/>10.144.144.2]
|
||||||
end
|
end
|
||||||
|
|
||||||
id1[[10.1.1.0/24]]
|
id1[[10.1.1.0/24]]
|
||||||
@@ -243,89 +245,75 @@ id1[[10.1.1.0/24]]
|
|||||||
ios <-.-> nodea <--> nodeb <-.-> id1
|
ios <-.-> nodea <--> nodeb <-.-> id1
|
||||||
```
|
```
|
||||||
|
|
||||||
我们需要 iPhone 通过节点 A 访问 EasyTier 网络,则可进行如下配置:
|
1. 启动启用 WireGuard 门户的 EasyTier:
|
||||||
|
|
||||||
在节点 A 的 easytier-core 命令中,加入 --vpn-portal 参数,指定 WireGuard 服务监听的端口,以及 WireGuard 网络使用的网段。
|
```bash
|
||||||
|
# 在 0.0.0.0:11013 上监听,并使用 10.14.14.0/24 子网作为 WireGuard 客户端
|
||||||
```sh
|
sudo easytier-core -i 10.144.144.1 --vpn-portal wg://0.0.0.0:11013/10.14.14.0/24
|
||||||
# 以下参数的含义为: 监听 0.0.0.0:11013 端口,WireGuard 使用 10.14.14.0/24 网段
|
|
||||||
sudo easytier-core --ipv4 10.144.144.1 --vpn-portal wg://0.0.0.0:11013/10.14.14.0/24
|
|
||||||
```
|
```
|
||||||
|
|
||||||
easytier-core 启动成功后,使用 easytier-cli 获取 WireGuard Client 的配置。
|
2. 获取 WireGuard 客户端配置:
|
||||||
|
|
||||||
```sh
|
```bash
|
||||||
$> easytier-cli vpn-portal
|
# 获取 WireGuard 客户端配置
|
||||||
portal_name: wireguard
|
easytier-cli vpn-portal
|
||||||
|
|
||||||
############### client_config_start ###############
|
|
||||||
|
|
||||||
[Interface]
|
|
||||||
PrivateKey = 9VDvlaIC9XHUvRuE06hD2CEDrtGF+0lDthgr9SZfIho=
|
|
||||||
Address = 10.14.14.0/32 # should assign an ip from this cidr manually
|
|
||||||
|
|
||||||
[Peer]
|
|
||||||
PublicKey = zhrZQg4QdPZs8CajT3r4fmzcNsWpBL9ImQCUsnlXyGM=
|
|
||||||
AllowedIPs = 10.144.144.0/24,10.14.14.0/24
|
|
||||||
Endpoint = 0.0.0.0:11013 # should be the public ip(or domain) of the vpn server
|
|
||||||
PersistentKeepalive = 25
|
|
||||||
|
|
||||||
############### client_config_end ###############
|
|
||||||
|
|
||||||
connected_clients:
|
|
||||||
[]
|
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 Client Config 前,需要将 Interface Address 和 Peer Endpoint 分别修改为客户端的 IP 和 EasyTier 节点的 IP。将配置文件导入 WireGuard 客户端,即可访问 EasyTier 网络。
|
3. 在输出配置中:
|
||||||
|
- 将 `Interface.Address` 设置为 WireGuard 子网中的可用 IP
|
||||||
|
- 将 `Peer.Endpoint` 设置为您的 EasyTier 节点的公网 IP/域名
|
||||||
|
- 将修改后的配置导入到您的 WireGuard 客户端
|
||||||
|
|
||||||
---
|
#### 自建公共共享节点
|
||||||
|
|
||||||
### 自建公共中转服务器
|
您可以运行自己的公共共享节点来帮助其他节点相互发现。公共共享节点只是一个普通的 EasyTier 网络(具有相同的网络名称和密钥),其他网络可以连接到它。
|
||||||
|
|
||||||
每个虚拟网络(通过相同的网络名称和密钥建链)都可以充当公共服务器集群。其他网络的节点可以连接到公共服务器集群中的任意节点,无需公共 IP 即可发现彼此。
|
要运行公共共享节点:
|
||||||
|
|
||||||
运行自建的公共服务器集群与运行虚拟网络完全相同,不过可以跳过配置 ipv4 地址。
|
```bash
|
||||||
|
# 公共共享节点无需指定 IPv4 地址
|
||||||
也可以使用以下命令加入官方公共服务器集群,后续将实现公共服务器集群的节点间负载均衡:
|
sudo easytier-core --network-name mysharednode --network-secret mysharednode
|
||||||
|
|
||||||
```
|
|
||||||
sudo easytier-core --network-name easytier --network-secret easytier -p tcp://public.easytier.top:11010
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 其他配置
|
网络设置成功后,您可以轻松配置它以在系统启动时自动启动。请参阅 [一键注册服务指南](https://easytier.cn/en/guide/network/oneclick-install-as-service.html) 了解如何将 EasyTier 注册为系统服务。
|
||||||
|
|
||||||
可使用 ``easytier-core --help`` 查看全部配置项
|
## 相关项目
|
||||||
|
|
||||||
## 路线图
|
- [ZeroTier](https://www.zerotier.com/):用于连接设备的全球虚拟网络。
|
||||||
|
- [TailScale](https://tailscale.com/):旨在简化网络配置的 VPN 解决方案。
|
||||||
|
- [vpncloud](https://github.com/dswd/vpncloud):一个 P2P 网状 VPN
|
||||||
|
- [Candy](https://github.com/lanthora/candy):一个可靠、低延迟、反审查的虚拟专用网络
|
||||||
|
|
||||||
- [ ] 完善文档和用户指南。
|
### 联系我们
|
||||||
- [ ] 支持 TCP 打洞等特性。
|
|
||||||
- [ ] 支持 iOS。
|
|
||||||
- [ ] 支持 Web 配置管理。
|
|
||||||
|
|
||||||
## 社区和贡献
|
- 💬 **[Telegram 群组](https://t.me/easytier)**
|
||||||
|
- 👥 **[QQ 群:949700262](https://qm.qq.com/cgi-bin/qm/qr?k=kC8YJ6Jb8vWJIDbZrZJB8pB5YZgPJA5-)**
|
||||||
我们欢迎并鼓励社区贡献!如果你想参与进来,请提交 [GitHub PR](https://github.com/EasyTier/EasyTier/pulls)。详细的贡献指南可以在 [CONTRIBUTING.md](https://github.com/EasyTier/EasyTier/blob/main/CONTRIBUTING.md) 中找到。
|
|
||||||
|
|
||||||
## 相关项目和资源
|
|
||||||
|
|
||||||
- [ZeroTier](https://www.zerotier.com/): 一个全球虚拟网络,用于连接设备。
|
|
||||||
- [TailScale](https://tailscale.com/): 一个旨在简化网络配置的 VPN 解决方案。
|
|
||||||
- [vpncloud](https://github.com/dswd/vpncloud): 一个 P2P Mesh VPN
|
|
||||||
- [Candy](https://github.com/lanthora/candy): 可靠、低延迟、抗审查的虚拟专用网络
|
|
||||||
|
|
||||||
## 许可证
|
## 许可证
|
||||||
|
|
||||||
EasyTier 根据 [Apache License 2.0](https://github.com/EasyTier/EasyTier/blob/main/LICENSE) 许可证发布。
|
EasyTier 在 [LGPL-3.0](https://github.com/EasyTier/EasyTier/blob/main/LICENSE) 许可下发布。
|
||||||
|
|
||||||
## 联系方式
|
|
||||||
|
|
||||||
- 提问或报告问题:[GitHub Issues](https://github.com/EasyTier/EasyTier/issues)
|
|
||||||
- 讨论和交流:[GitHub Discussions](https://github.com/EasyTier/EasyTier/discussions)
|
|
||||||
- QQ 群: 949700262
|
|
||||||
- Telegram:https://t.me/easytier
|
|
||||||
|
|
||||||
## 赞助
|
## 赞助
|
||||||
|
|
||||||
<img src="assets/image-8.png" width="300">
|
本项目的 CDN 加速和安全防护由腾讯云 EdgeOne 赞助。
|
||||||
<img src="assets/image-9.png" width="300">
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://edgeone.ai/?from=github" target="_blank">
|
||||||
|
<img src="assets/edgeone.png" width="200">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
特别感谢 [浪浪云](https://langlang.cloud/) 赞助我们的公共服务器。
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://langlangy.cn/?i26c5a5" target="_blank">
|
||||||
|
<img src="assets/langlang.png" width="200">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
如果您觉得 EasyTier 有帮助,请考虑赞助我们。软件开发和维护需要大量的时间和精力,您的赞助将帮助我们更好地维护和改进 EasyTier。
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="assets/wechat.png" width="200">
|
||||||
|
<img src="assets/alipay.png" width="200">
|
||||||
|
</p>
|
||||||
|
BIN
assets/alipay.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
assets/config-page.png
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
assets/edgeone.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
assets/langlang.png
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
assets/running-page.png
Normal file
After Width: | Height: | Size: 138 KiB |
BIN
assets/wechat.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
17
easytier-contrib/easytier-ffi/Cargo.toml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
[package]
|
||||||
|
name = "easytier-ffi"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
easytier = { path = "../../easytier" }
|
||||||
|
|
||||||
|
once_cell = "1.18.0"
|
||||||
|
dashmap = "6.0"
|
||||||
|
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_json = "1"
|
||||||
|
uuid = "1.17.0"
|
159
easytier-contrib/easytier-ffi/examples/csharp.cs
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
public class EasyTierFFI
|
||||||
|
{
|
||||||
|
// 导入 DLL 函数
|
||||||
|
private const string DllName = "easytier_ffi.dll";
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
private static extern int parse_config([MarshalAs(UnmanagedType.LPStr)] string cfgStr);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
private static extern int run_network_instance([MarshalAs(UnmanagedType.LPStr)] string cfgStr);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
private static extern int retain_network_instance(IntPtr instNames, int length);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
private static extern int collect_network_infos(IntPtr infos, int maxLength);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
private static extern void get_error_msg(out IntPtr errorMsg);
|
||||||
|
|
||||||
|
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
private static extern void free_string(IntPtr str);
|
||||||
|
|
||||||
|
// 定义 KeyValuePair 结构体
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct KeyValuePair
|
||||||
|
{
|
||||||
|
public IntPtr Key;
|
||||||
|
public IntPtr Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析配置
|
||||||
|
public static void ParseConfig(string config)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(config))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Configuration string cannot be null or empty.");
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = parse_config(config);
|
||||||
|
if (result < 0)
|
||||||
|
{
|
||||||
|
throw new Exception(GetErrorMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 启动网络实例
|
||||||
|
public static void RunNetworkInstance(string config)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(config))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Configuration string cannot be null or empty.");
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = run_network_instance(config);
|
||||||
|
if (result < 0)
|
||||||
|
{
|
||||||
|
throw new Exception(GetErrorMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保留网络实例
|
||||||
|
public static void RetainNetworkInstances(string[] instanceNames)
|
||||||
|
{
|
||||||
|
IntPtr[] namePointers = null;
|
||||||
|
IntPtr namesPtr = IntPtr.Zero;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (instanceNames != null && instanceNames.Length > 0)
|
||||||
|
{
|
||||||
|
namePointers = new IntPtr[instanceNames.Length];
|
||||||
|
for (int i = 0; i < instanceNames.Length; i++)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(instanceNames[i]))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Instance name cannot be null or empty.");
|
||||||
|
}
|
||||||
|
namePointers[i] = Marshal.StringToHGlobalAnsi(instanceNames[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
namesPtr = Marshal.AllocHGlobal(Marshal.SizeOf<IntPtr>() * namePointers.Length);
|
||||||
|
Marshal.Copy(namePointers, 0, namesPtr, namePointers.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = retain_network_instance(namesPtr, instanceNames?.Length ?? 0);
|
||||||
|
if (result < 0)
|
||||||
|
{
|
||||||
|
throw new Exception(GetErrorMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (namePointers != null)
|
||||||
|
{
|
||||||
|
foreach (var ptr in namePointers)
|
||||||
|
{
|
||||||
|
if (ptr != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Marshal.FreeHGlobal(ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (namesPtr != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Marshal.FreeHGlobal(namesPtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 收集网络信息
|
||||||
|
public static KeyValuePair<string, string>[] CollectNetworkInfos(int maxLength)
|
||||||
|
{
|
||||||
|
IntPtr buffer = Marshal.AllocHGlobal(Marshal.SizeOf<KeyValuePair>() * maxLength);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int count = collect_network_infos(buffer, maxLength);
|
||||||
|
if (count < 0)
|
||||||
|
{
|
||||||
|
throw new Exception(GetErrorMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = new KeyValuePair<string, string>[count];
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
var kv = Marshal.PtrToStructure<KeyValuePair>(buffer + i * Marshal.SizeOf<KeyValuePair>());
|
||||||
|
string key = Marshal.PtrToStringAnsi(kv.Key);
|
||||||
|
string value = Marshal.PtrToStringAnsi(kv.Value);
|
||||||
|
|
||||||
|
// 释放由 FFI 分配的字符串内存
|
||||||
|
free_string(kv.Key);
|
||||||
|
free_string(kv.Value);
|
||||||
|
|
||||||
|
result[i] = new KeyValuePair<string, string>(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Marshal.FreeHGlobal(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取错误信息
|
||||||
|
private static string GetErrorMessage()
|
||||||
|
{
|
||||||
|
get_error_msg(out IntPtr errorMsgPtr);
|
||||||
|
if (errorMsgPtr == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return "Unknown error";
|
||||||
|
}
|
||||||
|
|
||||||
|
string errorMsg = Marshal.PtrToStringAnsi(errorMsgPtr);
|
||||||
|
free_string(errorMsgPtr); // 释放错误信息字符串
|
||||||
|
return errorMsg;
|
||||||
|
}
|
||||||
|
}
|
248
easytier-contrib/easytier-ffi/src/lib.rs
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
use std::sync::Mutex;
|
||||||
|
|
||||||
|
use dashmap::DashMap;
|
||||||
|
use easytier::{
|
||||||
|
common::config::{ConfigLoader as _, TomlConfigLoader},
|
||||||
|
instance_manager::NetworkInstanceManager,
|
||||||
|
launcher::ConfigSource,
|
||||||
|
};
|
||||||
|
|
||||||
|
static INSTANCE_NAME_ID_MAP: once_cell::sync::Lazy<DashMap<String, uuid::Uuid>> =
|
||||||
|
once_cell::sync::Lazy::new(DashMap::new);
|
||||||
|
static INSTANCE_MANAGER: once_cell::sync::Lazy<NetworkInstanceManager> =
|
||||||
|
once_cell::sync::Lazy::new(NetworkInstanceManager::new);
|
||||||
|
|
||||||
|
static ERROR_MSG: once_cell::sync::Lazy<Mutex<Vec<u8>>> =
|
||||||
|
once_cell::sync::Lazy::new(|| Mutex::new(Vec::new()));
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct KeyValuePair {
|
||||||
|
pub key: *const std::ffi::c_char,
|
||||||
|
pub value: *const std::ffi::c_char,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn set_error_msg(msg: &str) {
|
||||||
|
let bytes = msg.as_bytes();
|
||||||
|
let mut msg_buf = ERROR_MSG.lock().unwrap();
|
||||||
|
let len = bytes.len();
|
||||||
|
msg_buf.resize(len, 0);
|
||||||
|
msg_buf[..len].copy_from_slice(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn set_tun_fd(
|
||||||
|
inst_name: *const std::ffi::c_char,
|
||||||
|
fd: std::ffi::c_int,
|
||||||
|
) -> std::ffi::c_int {
|
||||||
|
let inst_name = unsafe {
|
||||||
|
assert!(!inst_name.is_null());
|
||||||
|
std::ffi::CStr::from_ptr(inst_name)
|
||||||
|
.to_string_lossy()
|
||||||
|
.into_owned()
|
||||||
|
};
|
||||||
|
if !INSTANCE_NAME_ID_MAP.contains_key(&inst_name) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
match INSTANCE_MANAGER.set_tun_fd(&INSTANCE_NAME_ID_MAP.get(&inst_name).unwrap().value(), fd) {
|
||||||
|
Ok(_) => {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
-1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn get_error_msg(out: *mut *const std::ffi::c_char) {
|
||||||
|
let msg_buf = ERROR_MSG.lock().unwrap();
|
||||||
|
if msg_buf.is_empty() {
|
||||||
|
unsafe {
|
||||||
|
*out = std::ptr::null();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let cstr = std::ffi::CString::new(&msg_buf[..]).unwrap();
|
||||||
|
unsafe {
|
||||||
|
*out = cstr.into_raw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn free_string(s: *const std::ffi::c_char) {
|
||||||
|
if s.is_null() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let _ = std::ffi::CString::from_raw(s as *mut std::ffi::c_char);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn parse_config(cfg_str: *const std::ffi::c_char) -> std::ffi::c_int {
|
||||||
|
let cfg_str = unsafe {
|
||||||
|
assert!(!cfg_str.is_null());
|
||||||
|
std::ffi::CStr::from_ptr(cfg_str)
|
||||||
|
.to_string_lossy()
|
||||||
|
.into_owned()
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Err(e) = TomlConfigLoader::new_from_str(&cfg_str) {
|
||||||
|
set_error_msg(&format!("failed to parse config: {:?}", e));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn run_network_instance(cfg_str: *const std::ffi::c_char) -> std::ffi::c_int {
|
||||||
|
let cfg_str = unsafe {
|
||||||
|
assert!(!cfg_str.is_null());
|
||||||
|
std::ffi::CStr::from_ptr(cfg_str)
|
||||||
|
.to_string_lossy()
|
||||||
|
.into_owned()
|
||||||
|
};
|
||||||
|
let cfg = match TomlConfigLoader::new_from_str(&cfg_str) {
|
||||||
|
Ok(cfg) => cfg,
|
||||||
|
Err(e) => {
|
||||||
|
set_error_msg(&format!("failed to parse config: {}", e));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let inst_name = cfg.get_inst_name();
|
||||||
|
|
||||||
|
if INSTANCE_NAME_ID_MAP.contains_key(&inst_name) {
|
||||||
|
set_error_msg("instance already exists");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let instance_id = match INSTANCE_MANAGER.run_network_instance(cfg, ConfigSource::FFI) {
|
||||||
|
Ok(id) => id,
|
||||||
|
Err(e) => {
|
||||||
|
set_error_msg(&format!("failed to start instance: {}", e));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
INSTANCE_NAME_ID_MAP.insert(inst_name, instance_id);
|
||||||
|
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn retain_network_instance(
|
||||||
|
inst_names: *const *const std::ffi::c_char,
|
||||||
|
length: usize,
|
||||||
|
) -> std::ffi::c_int {
|
||||||
|
if length == 0 {
|
||||||
|
if let Err(e) = INSTANCE_MANAGER.retain_network_instance(Vec::new()) {
|
||||||
|
set_error_msg(&format!("failed to retain instances: {}", e));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
INSTANCE_NAME_ID_MAP.clear();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
let inst_names = unsafe {
|
||||||
|
assert!(!inst_names.is_null());
|
||||||
|
std::slice::from_raw_parts(inst_names, length)
|
||||||
|
.iter()
|
||||||
|
.map(|&name| {
|
||||||
|
assert!(!name.is_null());
|
||||||
|
std::ffi::CStr::from_ptr(name)
|
||||||
|
.to_string_lossy()
|
||||||
|
.into_owned()
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
};
|
||||||
|
|
||||||
|
let inst_ids: Vec<uuid::Uuid> = inst_names
|
||||||
|
.iter()
|
||||||
|
.filter_map(|name| INSTANCE_NAME_ID_MAP.get(name).map(|id| *id))
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
if let Err(e) = INSTANCE_MANAGER.retain_network_instance(inst_ids) {
|
||||||
|
set_error_msg(&format!("failed to retain instances: {}", e));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let _ = INSTANCE_NAME_ID_MAP.retain(|k, _| inst_names.contains(k));
|
||||||
|
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn collect_network_infos(
|
||||||
|
infos: *mut KeyValuePair,
|
||||||
|
max_length: usize,
|
||||||
|
) -> std::ffi::c_int {
|
||||||
|
if max_length == 0 {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
let infos = unsafe {
|
||||||
|
assert!(!infos.is_null());
|
||||||
|
std::slice::from_raw_parts_mut(infos, max_length)
|
||||||
|
};
|
||||||
|
|
||||||
|
let collected_infos = match INSTANCE_MANAGER.collect_network_infos() {
|
||||||
|
Ok(infos) => infos,
|
||||||
|
Err(e) => {
|
||||||
|
set_error_msg(&format!("failed to collect network infos: {}", e));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut index = 0;
|
||||||
|
for (instance_id, value) in collected_infos.iter() {
|
||||||
|
if index >= max_length {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
let Some(key) = INSTANCE_MANAGER.get_network_instance_name(instance_id) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
// convert value to json string
|
||||||
|
let value = match serde_json::to_string(&value) {
|
||||||
|
Ok(value) => value,
|
||||||
|
Err(e) => {
|
||||||
|
set_error_msg(&format!("failed to serialize instance info: {}", e));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
infos[index] = KeyValuePair {
|
||||||
|
key: std::ffi::CString::new(key.clone()).unwrap().into_raw(),
|
||||||
|
value: std::ffi::CString::new(value).unwrap().into_raw(),
|
||||||
|
};
|
||||||
|
index += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
index as std::ffi::c_int
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_parse_config() {
|
||||||
|
let cfg_str = r#"
|
||||||
|
inst_name = "test"
|
||||||
|
network = "test_network"
|
||||||
|
"#;
|
||||||
|
let cstr = std::ffi::CString::new(cfg_str).unwrap();
|
||||||
|
assert_eq!(parse_config(cstr.as_ptr()), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_run_network_instance() {
|
||||||
|
let cfg_str = r#"
|
||||||
|
inst_name = "test"
|
||||||
|
network = "test_network"
|
||||||
|
"#;
|
||||||
|
let cstr = std::ffi::CString::new(cfg_str).unwrap();
|
||||||
|
assert_eq!(run_network_instance(cstr.as_ptr()), 0);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,33 @@
|
|||||||
|
#!/sbin/sh
|
||||||
|
|
||||||
|
#################
|
||||||
|
# Initialization
|
||||||
|
#################
|
||||||
|
|
||||||
|
umask 022
|
||||||
|
|
||||||
|
# echo before loading util_functions
|
||||||
|
ui_print() { echo "$1"; }
|
||||||
|
|
||||||
|
require_new_magisk() {
|
||||||
|
ui_print "********************************"
|
||||||
|
ui_print " Please install Magisk v20.4+! "
|
||||||
|
ui_print "********************************"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#########################
|
||||||
|
# Load util_functions.sh
|
||||||
|
#########################
|
||||||
|
|
||||||
|
OUTFD=$2
|
||||||
|
ZIPFILE=$3
|
||||||
|
|
||||||
|
mount /data 2>/dev/null
|
||||||
|
|
||||||
|
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
|
||||||
|
. /data/adb/magisk/util_functions.sh
|
||||||
|
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
|
||||||
|
|
||||||
|
install_module
|
||||||
|
exit 0
|
@@ -0,0 +1 @@
|
|||||||
|
#MAGISK
|
6
easytier-contrib/easytier-magisk/README.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# easytier_magisk版模块
|
||||||
|
magisk安装后重启
|
||||||
|
|
||||||
|
目录位置:/data/adb/modules/easytier_magisk
|
||||||
|
配置文件位置://data/adb/modules/easytier_magisk/config/config.toml
|
||||||
|
修改config.conf即可,修改后配置文件后去magisk app重新开关模块即可生效
|
14
easytier-contrib/easytier-magisk/action.sh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/data/adb/magisk/busybox sh
|
||||||
|
MODDIR=${0%/*}
|
||||||
|
|
||||||
|
# 查找 easytier-core 进程的 PID
|
||||||
|
PID=$(pgrep easytier-core)
|
||||||
|
|
||||||
|
# 检查是否找到了进程
|
||||||
|
if [ -z "$PID" ]; then
|
||||||
|
echo "easytier-core 进程未找到"
|
||||||
|
else
|
||||||
|
# 结束进程
|
||||||
|
kill $PID
|
||||||
|
echo "已结束 easytier-core 进程 (PID: $PID)"
|
||||||
|
fi
|
25
easytier-contrib/easytier-magisk/build.sh
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
version=$(cat module.prop | grep 'version=' | awk -F '=' '{print $2}' | sed 's/ (.*//')
|
||||||
|
|
||||||
|
version='v'$(grep '^version =' ../../easytier/Cargo.toml | cut -d '"' -f 2)
|
||||||
|
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
echo "Error: 版本号不存在."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
filename="easytier_magisk_${version}.zip"
|
||||||
|
echo $version
|
||||||
|
|
||||||
|
|
||||||
|
if [ -f "./easytier-core" ] && [ -f "./easytier-cli" ] && [ -f "./easytier-web" ]; then
|
||||||
|
zip -r -o -X "$filename" ./ -x '.git/*' -x '.github/*' -x 'folder/*' -x 'build.sh' -x 'magisk_update.json'
|
||||||
|
else
|
||||||
|
wget -O "easytier_last.zip" https://github.com/EasyTier/EasyTier/releases/download/"$version"/easytier-linux-aarch64-"$version".zip
|
||||||
|
unzip -o easytier_last.zip -d ./
|
||||||
|
mv ./easytier-linux-aarch64/* ./
|
||||||
|
rm -rf ./easytier_last.zip
|
||||||
|
rm -rf ./easytier-linux-aarch64
|
||||||
|
zip -r -o -X "$filename" ./ -x '.git/*' -x '.github/*' -x 'folder/*' -x 'build.sh' -x 'magisk_update.json'
|
||||||
|
fi
|
37
easytier-contrib/easytier-magisk/config/config.toml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
instance_name = "default"
|
||||||
|
dhcp = false
|
||||||
|
#ipv4="本机ip"
|
||||||
|
listeners = [
|
||||||
|
"tcp://0.0.0.0:11010",
|
||||||
|
"udp://0.0.0.0:11010",
|
||||||
|
"wg://0.0.0.0:11011",
|
||||||
|
"ws://0.0.0.0:11011/",
|
||||||
|
"wss://0.0.0.0:11012/",
|
||||||
|
]
|
||||||
|
mapped_listeners = []
|
||||||
|
exit_nodes = []
|
||||||
|
rpc_portal = "0.0.0.0:15888"
|
||||||
|
|
||||||
|
[network_identity]
|
||||||
|
network_name = "default"
|
||||||
|
network_secret = ""
|
||||||
|
|
||||||
|
[[peer]]
|
||||||
|
#uri = "协议://中转ip:端口"
|
||||||
|
|
||||||
|
[flags]
|
||||||
|
default_protocol = "tcp"
|
||||||
|
dev_name = ""
|
||||||
|
enable_encryption = true
|
||||||
|
enable_ipv6 = true
|
||||||
|
mtu = 1380
|
||||||
|
latency_first = false
|
||||||
|
enable_exit_node = false
|
||||||
|
no_tun = false
|
||||||
|
use_smoltcp = false
|
||||||
|
foreign_network_whitelist = "*"
|
||||||
|
disable_p2p = false
|
||||||
|
relay_all_peer_rpc = false
|
||||||
|
disable_udp_hole_punching = false
|
||||||
|
|
||||||
|
|
7
easytier-contrib/easytier-magisk/customize.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
ui_print '安装完成'
|
||||||
|
ui_print '当前架构为' + $ARCH
|
||||||
|
ui_print '当前系统版本为' + $API
|
||||||
|
ui_print '安装目录为: /data/adb/modules/easytier_magisk'
|
||||||
|
ui_print '配置文件位置: /data/adb/modules/easytier_magisk/config/config.toml'
|
||||||
|
ui_print '修改后配置文件后在magisk app点击操作按钮即可生效'
|
||||||
|
ui_print '记得重启'
|
48
easytier-contrib/easytier-magisk/easytier_core.sh
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/system/bin/sh
|
||||||
|
|
||||||
|
MODDIR=${0%/*}
|
||||||
|
CONFIG_FILE="${MODDIR}/config/config.toml"
|
||||||
|
LOG_FILE="${MODDIR}/log.log"
|
||||||
|
MODULE_PROP="${MODDIR}/module.prop"
|
||||||
|
EASYTIER="${MODDIR}/easytier-core"
|
||||||
|
|
||||||
|
# 更新module.prop文件中的description
|
||||||
|
update_module_description() {
|
||||||
|
local status_message=$1
|
||||||
|
sed -i "/^description=/c\description=[状态]${status_message}" ${MODULE_PROP}
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! -e /dev/net/tun ]; then
|
||||||
|
if [ ! -d /dev/net ]; then
|
||||||
|
mkdir -p /dev/net
|
||||||
|
fi
|
||||||
|
|
||||||
|
ln -s /dev/tun /dev/net/tun
|
||||||
|
fi
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
if ls $MODDIR | grep -q "disable"; then
|
||||||
|
update_module_description "关闭中"
|
||||||
|
if pgrep -f 'easytier-core' >/dev/null; then
|
||||||
|
echo "开关控制$(date "+%Y-%m-%d %H:%M:%S") 进程已存在,正在关闭 ..."
|
||||||
|
pkill easytier-core # 关闭进程
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if ! pgrep -f 'easytier-core' >/dev/null; then
|
||||||
|
if [ ! -f "$CONFIG_FILE" ]; then
|
||||||
|
update_module_description "config.toml不存在"
|
||||||
|
sleep 3s
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
TZ=Asia/Shanghai ${EASYTIER} -c ${CONFIG_FILE} > ${LOG_FILE} &
|
||||||
|
sleep 5s # 等待easytier-core启动完成
|
||||||
|
update_module_description "已开启(不一定运行成功)"
|
||||||
|
ip rule add from all lookup main
|
||||||
|
else
|
||||||
|
echo "开关控制$(date "+%Y-%m-%d %H:%M:%S") 进程已存在"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 3s # 暂停3秒后再次执行循环
|
||||||
|
done
|
6
easytier-contrib/easytier-magisk/magisk_update.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"version": "v1.0",
|
||||||
|
"versionCode": 1,
|
||||||
|
"zipUrl": "",
|
||||||
|
"changelog": ""
|
||||||
|
}
|
7
easytier-contrib/easytier-magisk/module.prop
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
id=easytier_magisk
|
||||||
|
name=EasyTier_Magisk
|
||||||
|
version=v2.4.0
|
||||||
|
versionCode=1
|
||||||
|
author=EasyTier
|
||||||
|
description=easytier magisk module @EasyTier(https://github.com/EasyTier/EasyTier)
|
||||||
|
updateJson=https://raw.githubusercontent.com/EasyTier/EasyTier/refs/heads/main/easytier-contrib/easytier-magisk/magisk_update.json
|
27
easytier-contrib/easytier-magisk/service.sh
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/data/adb/magisk/busybox sh
|
||||||
|
MODDIR=${0%/*}
|
||||||
|
# MODDIR="$(dirname $(readlink -f "$0"))"
|
||||||
|
chmod 755 ${MODDIR}/*
|
||||||
|
|
||||||
|
# 等待系统启动成功
|
||||||
|
while [ "$(getprop sys.boot_completed)" != "1" ]; do
|
||||||
|
sleep 5s
|
||||||
|
done
|
||||||
|
|
||||||
|
# 防止系统挂起
|
||||||
|
echo "PowerManagerService.noSuspend" > /sys/power/wake_lock
|
||||||
|
|
||||||
|
# 修改模块描述
|
||||||
|
sed -i 's/$(description=)$[^"]*/\1[状态]关闭中/' "$MODDIR/module.prop"
|
||||||
|
|
||||||
|
# 等待 3 秒
|
||||||
|
sleep 3s
|
||||||
|
|
||||||
|
"${MODDIR}/easytier_core.sh" &
|
||||||
|
|
||||||
|
# 检查是否启用模块
|
||||||
|
while [ ! -f ${MODDIR}/disable ]; do
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
|
pkill easytier-core
|
2
easytier-contrib/easytier-magisk/system/etc/resolv.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
nameserver 114.114.114.114
|
||||||
|
nameserver 223.5.5.5
|
3
easytier-contrib/easytier-magisk/uninstall.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
MODDIR=${0%/*}
|
||||||
|
pkill easytier-core # 结束 easytier-core 进程
|
||||||
|
rm -rf $MODDIR/*
|
5778
easytier-contrib/easytier-ohrs/Cargo.lock
generated
Normal file
46
easytier-contrib/easytier-ohrs/Cargo.toml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
[package]
|
||||||
|
name = "easytier-ohrs"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type=["cdylib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
ohos-hilog-binding = {version = "*", features = ["redirect"]}
|
||||||
|
easytier = { git = "https://github.com/EasyTier/EasyTier.git" }
|
||||||
|
napi-derive-ohos = "1.0.4"
|
||||||
|
napi-ohos = { version = "1.0.4", default-features = false, features = [
|
||||||
|
"serde-json",
|
||||||
|
"latin1",
|
||||||
|
"chrono_date",
|
||||||
|
"object_indexmap",
|
||||||
|
"tokio",
|
||||||
|
"async",
|
||||||
|
"tokio_rt",
|
||||||
|
"tokio_macros",
|
||||||
|
"tokio_io_util",
|
||||||
|
"deferred_trace",
|
||||||
|
"napi8",
|
||||||
|
"node_version_detect",
|
||||||
|
"web_stream",
|
||||||
|
] }
|
||||||
|
once_cell = "1.21.3"
|
||||||
|
serde_json = "1.0.125"
|
||||||
|
tracing-subscriber = "0.3.19"
|
||||||
|
tracing-core = "0.1.33"
|
||||||
|
tracing = "0.1.41"
|
||||||
|
uuid = { version = "1.17.0", features = ["v4"] }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
napi-build-ohos = "1.0.4"
|
||||||
|
[profile.dev]
|
||||||
|
panic = "unwind"
|
||||||
|
debug = true
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
panic = "abort"
|
||||||
|
lto = true
|
||||||
|
codegen-units = 1
|
||||||
|
opt-level = 3
|
||||||
|
strip = true
|
65
easytier-contrib/easytier-ohrs/README.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# OpenHarmonyOS 项目构建说明
|
||||||
|
|
||||||
|
本项目需要 OpenHarmonyOS SDK 和多个基础库支持才能成功编译。请按照以下步骤准备构建环境。
|
||||||
|
如存在任何编译问题,请前往[Easytier for OHOS](https://github.com/FrankHan052176/EasyTier)
|
||||||
|
|
||||||
|
## 前置要求
|
||||||
|
|
||||||
|
### 1. 安装 OpenHarmonyOS SDK
|
||||||
|
|
||||||
|
**SDK 下载链接**:
|
||||||
|
[OpenHarmony 每日构建版本](https://ci.openharmony.cn/workbench/cicd/dailybuild/dailylist)
|
||||||
|
|
||||||
|
**版本要求**:
|
||||||
|
请选择版本号 **小于 OpenHarmony_5.1.0.58** 的 ohos-sdk-full 版本
|
||||||
|
|
||||||
|
下载后请解压到适当位置(如 `/usr/local/ohos-sdk`),并记下安装路径。
|
||||||
|
|
||||||
|
### 2. 编译依赖库
|
||||||
|
在编译本项目前,需要先自行编译以下四个基础库:
|
||||||
|
|
||||||
|
- glib
|
||||||
|
- libffi
|
||||||
|
- pcre2
|
||||||
|
- zlib
|
||||||
|
|
||||||
|
这些库需要使用 OpenHarmonyOS 的工具链进行交叉编译。
|
||||||
|
|
||||||
|
## 环境配置
|
||||||
|
|
||||||
|
### 1. 设置环境变量
|
||||||
|
创建并运行以下脚本设置环境变量(请根据您的实际 SDK 安装路径修改):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
# 请修改为您的实际 SDK 路径
|
||||||
|
export OHOS_SDK_PATH="/usr/local/ohos-sdk/linux"
|
||||||
|
export OHOS_TOOLCHAIN_DIR="${OHOS_SDK_PATH}/native/llvm"
|
||||||
|
export TARGET_ARCH="aarch64-linux-ohos"
|
||||||
|
export OHOS_SYSROOT="${OHOS_SDK_PATH}/native/sysroot"
|
||||||
|
export CC="${OHOS_TOOLCHAIN_DIR}/bin/aarch64-unknown-linux-ohos-clang"
|
||||||
|
export CXX="${OHOS_TOOLCHAIN_DIR}/bin/aarch64-unknown-linux-ohos-clang++"
|
||||||
|
export AS="${OHOS_TOOLCHAIN_DIR}/bin/llvm-as"
|
||||||
|
export AR="${OHOS_TOOLCHAIN_DIR}/bin/llvm-ar"
|
||||||
|
export LD="${OHOS_TOOLCHAIN_DIR}/bin/ld.lld"
|
||||||
|
export RANLIB="${OHOS_TOOLCHAIN_DIR}/bin/llvm-ranlib"
|
||||||
|
export STRIP="${OHOS_TOOLCHAIN_DIR}/bin/llvm-strip"
|
||||||
|
export OBJDUMP="${OHOS_TOOLCHAIN_DIR}/bin/llvm-objdump"
|
||||||
|
export OBJCOPY="${OHOS_TOOLCHAIN_DIR}/bin/llvm-objcopy"
|
||||||
|
export NM="${OHOS_TOOLCHAIN_DIR}/bin/llvm-nm"
|
||||||
|
export CFLAGS="-fPIC -D__MUSL__=1 -march=armv8-a --target=${TARGET_ARCH} -Wno-error --sysroot=${OHOS_SYSROOT} -I${OHOS_SYSROOT}/usr/include/${TARGET_ARCH}"
|
||||||
|
export CXXFLAGS="${CFLAGS}"
|
||||||
|
export LDFLAGS="--sysroot=${OHOS_SYSROOT} -L${OHOS_SYSROOT}/usr/lib/${TARGET_ARCH} -fuse-ld=${LD}"
|
||||||
|
export PKG_CONFIG_PATH="${OHOS_SYSROOT}/usr/lib/pkgconfig:${OHOS_SYSROOT}/usr/local/lib/pkgconfig"
|
||||||
|
export PKG_CONFIG_LIBDIR="${OHOS_SYSROOT}/usr/lib:${OHOS_SYSROOT}/usr/local/lib"
|
||||||
|
export PKG_CONFIG_SYSROOT_DIR="${OHOS_SYSROOT}"
|
||||||
|
export HOST_TRIPLET="${TARGET_ARCH}"
|
||||||
|
export BUILD_TRIPLET="$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)"
|
||||||
|
export PATH="${OHOS_TOOLCHAIN_DIR}/bin:${PATH}"
|
||||||
|
|
||||||
|
echo "OpenHarmonyOS 环境变量已设置:"
|
||||||
|
echo "OHOS_SDK_PATH: ${OHOS_SDK_PATH}"
|
||||||
|
echo "OHOS_TOOLCHAIN_DIR: ${OHOS_TOOLCHAIN_DIR}"
|
||||||
|
echo "OHOS_SYSROOT: ${OHOS_SYSROOT}"
|
||||||
|
echo "PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}"
|
||||||
|
echo "PATH: ${PATH}"
|
3
easytier-contrib/easytier-ohrs/build.rs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fn main () {
|
||||||
|
napi_build_ohos::setup();
|
||||||
|
}
|
31
easytier-contrib/easytier-ohrs/env.sh
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# 请修改为您的实际 SDK 路径
|
||||||
|
export OHOS_TOOLCHAIN_DIR="${OHOS_NDK_HOME}/native/llvm"
|
||||||
|
export TARGET_ARCH="aarch64-linux-ohos"
|
||||||
|
export OHOS_SYSROOT="${OHOS_NDK_HOME}/native/sysroot"
|
||||||
|
export CC="${OHOS_TOOLCHAIN_DIR}/bin/aarch64-unknown-linux-ohos-clang"
|
||||||
|
export CXX="${OHOS_TOOLCHAIN_DIR}/bin/aarch64-unknown-linux-ohos-clang++"
|
||||||
|
export AS="${OHOS_TOOLCHAIN_DIR}/bin/llvm-as"
|
||||||
|
export AR="${OHOS_TOOLCHAIN_DIR}/bin/llvm-ar"
|
||||||
|
export LD="${OHOS_TOOLCHAIN_DIR}/bin/ld.lld"
|
||||||
|
export RANLIB="${OHOS_TOOLCHAIN_DIR}/bin/llvm-ranlib"
|
||||||
|
export STRIP="${OHOS_TOOLCHAIN_DIR}/bin/llvm-strip"
|
||||||
|
export OBJDUMP="${OHOS_TOOLCHAIN_DIR}/bin/llvm-objdump"
|
||||||
|
export OBJCOPY="${OHOS_TOOLCHAIN_DIR}/bin/llvm-objcopy"
|
||||||
|
export NM="${OHOS_TOOLCHAIN_DIR}/bin/llvm-nm"
|
||||||
|
export CFLAGS="-fPIC -D__MUSL__=1 -march=armv8-a --target=${TARGET_ARCH} -Wno-error --sysroot=${OHOS_SYSROOT} -I${OHOS_SYSROOT}/usr/include/${TARGET_ARCH}"
|
||||||
|
export CXXFLAGS="${CFLAGS}"
|
||||||
|
export LDFLAGS="--sysroot=${OHOS_SYSROOT} -L${OHOS_SYSROOT}/usr/lib/${TARGET_ARCH} -fuse-ld=${LD}"
|
||||||
|
export PKG_CONFIG_PATH="${OHOS_SYSROOT}/usr/lib/pkgconfig:${OHOS_SYSROOT}/usr/local/lib/pkgconfig"
|
||||||
|
export PKG_CONFIG_LIBDIR="${OHOS_SYSROOT}/usr/lib:${OHOS_SYSROOT}/usr/local/lib"
|
||||||
|
export PKG_CONFIG_SYSROOT_DIR="${OHOS_SYSROOT}"
|
||||||
|
export HOST_TRIPLET="${TARGET_ARCH}"
|
||||||
|
export BUILD_TRIPLET="$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)"
|
||||||
|
export PATH="${OHOS_TOOLCHAIN_DIR}/bin:${PATH}"
|
||||||
|
|
||||||
|
echo "OpenHarmonyOS 环境变量已设置:"
|
||||||
|
echo "OHOS_SDK_PATH: ${OHOS_NDK_HOME}"
|
||||||
|
echo "OHOS_TOOLCHAIN_DIR: ${OHOS_TOOLCHAIN_DIR}"
|
||||||
|
echo "OHOS_SYSROOT: ${OHOS_SYSROOT}"
|
||||||
|
echo "PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}"
|
||||||
|
echo "PATH: ${PATH}"
|
148
easytier-contrib/easytier-ohrs/src/lib.rs
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
mod native_log;
|
||||||
|
|
||||||
|
use easytier::common::config::{ConfigLoader, TomlConfigLoader};
|
||||||
|
use easytier::instance_manager::NetworkInstanceManager;
|
||||||
|
use easytier::launcher::ConfigSource;
|
||||||
|
use napi_derive_ohos::napi;
|
||||||
|
use ohos_hilog_binding::{hilog_debug, hilog_error};
|
||||||
|
use std::format;
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
static INSTANCE_MANAGER: once_cell::sync::Lazy<NetworkInstanceManager> =
|
||||||
|
once_cell::sync::Lazy::new(NetworkInstanceManager::new);
|
||||||
|
|
||||||
|
#[napi(object)]
|
||||||
|
pub struct KeyValuePair {
|
||||||
|
pub key: String,
|
||||||
|
pub value: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn set_tun_fd(
|
||||||
|
inst_id: String,
|
||||||
|
fd: i32,
|
||||||
|
) -> bool {
|
||||||
|
match Uuid::try_parse(&inst_id) {
|
||||||
|
Ok(uuid) => {
|
||||||
|
match INSTANCE_MANAGER.set_tun_fd(&uuid, fd) {
|
||||||
|
Ok(_) => {
|
||||||
|
hilog_debug!("[Rust] set tun fd {} to {}.", fd, inst_id);
|
||||||
|
true
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
hilog_error!("[Rust] cant set tun fd {} to {}. {}", fd, inst_id, e);
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
hilog_error!("[Rust] cant covert {} to uuid. {}", inst_id, e);
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn parse_config(cfg_str: String) -> bool {
|
||||||
|
match TomlConfigLoader::new_from_str(&cfg_str) {
|
||||||
|
Ok(_) => {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
hilog_error!("[Rust] parse config failed {}", e);
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn run_network_instance(cfg_str: String) -> bool {
|
||||||
|
let cfg = match TomlConfigLoader::new_from_str(&cfg_str) {
|
||||||
|
Ok(cfg) => cfg,
|
||||||
|
Err(e) => {
|
||||||
|
hilog_error!("[Rust] parse config failed {}", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if INSTANCE_MANAGER.list_network_instance_ids().len() > 0 {
|
||||||
|
hilog_error!("[Rust] there is a running instance!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let inst_id = cfg.get_id();
|
||||||
|
if INSTANCE_MANAGER
|
||||||
|
.list_network_instance_ids()
|
||||||
|
.contains(&inst_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
INSTANCE_MANAGER
|
||||||
|
.run_network_instance(cfg, ConfigSource::FFI)
|
||||||
|
.unwrap();
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn stop_network_instance(inst_names: Vec<String>) {
|
||||||
|
INSTANCE_MANAGER
|
||||||
|
.delete_network_instance(
|
||||||
|
inst_names
|
||||||
|
.into_iter()
|
||||||
|
.filter_map(|s| Uuid::parse_str(&s).ok())
|
||||||
|
.collect(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
hilog_debug!("[Rust] stop_network_instance");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn collect_network_infos() -> Vec<KeyValuePair> {
|
||||||
|
let mut result = Vec::new();
|
||||||
|
match INSTANCE_MANAGER.collect_network_infos() {
|
||||||
|
Ok(map) => {
|
||||||
|
for (uuid, info) in map.iter() {
|
||||||
|
// convert value to json string
|
||||||
|
let value = match serde_json::to_string(&info) {
|
||||||
|
Ok(value) => value,
|
||||||
|
Err(e) => {
|
||||||
|
hilog_error!("[Rust] failed to serialize instance {} info: {}", uuid, e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result.push(KeyValuePair {
|
||||||
|
key: uuid.clone().to_string(),
|
||||||
|
value: value.clone(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(_) => {}
|
||||||
|
}
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn collect_running_network() -> Vec<String> {
|
||||||
|
INSTANCE_MANAGER
|
||||||
|
.list_network_instance_ids()
|
||||||
|
.clone()
|
||||||
|
.into_iter()
|
||||||
|
.map(|id| id.to_string())
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn is_running_network(inst_id: String) -> bool {
|
||||||
|
match Uuid::try_parse(&inst_id) {
|
||||||
|
Ok(uuid) => {
|
||||||
|
INSTANCE_MANAGER
|
||||||
|
.list_network_instance_ids()
|
||||||
|
.contains(&uuid)
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
hilog_error!("[Rust] cant covert {} to uuid. {}", inst_id, e);
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
98
easytier-contrib/easytier-ohrs/src/native_log.rs
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
use std::collections::HashMap;
|
||||||
|
use std::panic;
|
||||||
|
use napi_derive_ohos::napi;
|
||||||
|
use ohos_hilog_binding::{hilog_debug, hilog_error, hilog_info, hilog_warn, set_global_options, LogOptions};
|
||||||
|
use tracing::{Event, Subscriber};
|
||||||
|
use tracing_core::Level;
|
||||||
|
use tracing_subscriber::layer::{Context, Layer};
|
||||||
|
use tracing_subscriber::prelude::*;
|
||||||
|
|
||||||
|
static INITIALIZED: std::sync::Once = std::sync::Once::new();
|
||||||
|
fn panic_hook(info: &panic::PanicHookInfo) {
|
||||||
|
hilog_error!("RUST PANIC: {}", info);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn init_panic_hook() {
|
||||||
|
INITIALIZED.call_once(|| {
|
||||||
|
panic::set_hook(Box::new(panic_hook));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn hilog_global_options(
|
||||||
|
domain: u32,
|
||||||
|
tag: String,
|
||||||
|
) {
|
||||||
|
ohos_hilog_binding::forward_stdio_to_hilog();
|
||||||
|
set_global_options(LogOptions{
|
||||||
|
domain,
|
||||||
|
tag: Box::leak(tag.clone().into_boxed_str()),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[napi]
|
||||||
|
pub fn init_tracing_subscriber() {
|
||||||
|
tracing_subscriber::registry()
|
||||||
|
.with(
|
||||||
|
CallbackLayer {
|
||||||
|
callback: Box::new(tracing_callback),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn tracing_callback(event: &Event, fields: HashMap<String, String>) {
|
||||||
|
let metadata = event.metadata();
|
||||||
|
#[cfg(target_env = "ohos")]
|
||||||
|
{
|
||||||
|
let loc = metadata.target().split("::").last().unwrap();
|
||||||
|
match *metadata.level() {
|
||||||
|
Level::TRACE => {
|
||||||
|
hilog_debug!("[{}] {:?}", loc, fields.values().collect::<Vec<_>>());
|
||||||
|
}
|
||||||
|
Level::DEBUG => {
|
||||||
|
hilog_debug!("[{}] {:?}", loc, fields.values().collect::<Vec<_>>());
|
||||||
|
}
|
||||||
|
Level::INFO => {
|
||||||
|
hilog_info!("[{}] {:?}", loc, fields.values().collect::<Vec<_>>());
|
||||||
|
}
|
||||||
|
Level::WARN => {
|
||||||
|
hilog_warn!("[{}] {:?}", loc, fields.values().collect::<Vec<_>>());
|
||||||
|
}
|
||||||
|
Level::ERROR => {
|
||||||
|
hilog_error!("[{}] {:?}", loc, fields.values().collect::<Vec<_>>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CallbackLayer {
|
||||||
|
callback: Box<dyn Fn(&Event, HashMap<String, String>) + Send + Sync>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<S: Subscriber> Layer<S> for CallbackLayer {
|
||||||
|
fn on_event(&self, event: &Event, _ctx: Context<S>) {
|
||||||
|
// 使用 fmt::format::FmtSpan 提取字段值
|
||||||
|
let mut fields = HashMap::new();
|
||||||
|
let mut visitor = FieldCollector(&mut fields);
|
||||||
|
event.record(&mut visitor);
|
||||||
|
(self.callback)(event, fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FieldCollector<'a>(&'a mut HashMap<String, String>);
|
||||||
|
|
||||||
|
impl<'a> tracing::field::Visit for FieldCollector<'a> {
|
||||||
|
fn record_i64(&mut self, field: &tracing::field::Field, value: i64) {
|
||||||
|
self.0.insert(field.name().to_string(), value.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn record_str(&mut self, field: &tracing::field::Field, value: &str) {
|
||||||
|
self.0.insert(field.name().to_string(), value.to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn record_debug(&mut self, field: &tracing::field::Field, value: &dyn std::fmt::Debug) {
|
||||||
|
self.0.insert(field.name().to_string(), format!("{:?}", value));
|
||||||
|
}
|
||||||
|
}
|
@@ -1,2 +0,0 @@
|
|||||||
shamefully-hoist=true
|
|
||||||
strict-peer-dependencies=false
|
|
82
easytier-gui/.vscode/settings.json
vendored
@@ -1,5 +1,81 @@
|
|||||||
{
|
{
|
||||||
"i18n-ally.localesPaths": [
|
"cSpell.words": [
|
||||||
"locales"
|
"easytier",
|
||||||
|
"Vite",
|
||||||
|
"vueuse",
|
||||||
|
"pinia",
|
||||||
|
"demi",
|
||||||
|
"antfu",
|
||||||
|
"iconify",
|
||||||
|
"intlify",
|
||||||
|
"vitejs",
|
||||||
|
"unplugin",
|
||||||
|
"pnpm"
|
||||||
|
],
|
||||||
|
"i18n-ally.localesPaths": "locales",
|
||||||
|
"editor.formatOnSave": false,
|
||||||
|
// Auto fix
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll.eslint": "explicit",
|
||||||
|
"source.organizeImports": "never"
|
||||||
|
},
|
||||||
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
||||||
|
"eslint.rules.customizations": [
|
||||||
|
{
|
||||||
|
"rule": "style/*",
|
||||||
|
"severity": "off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "format/*",
|
||||||
|
"severity": "off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "*-indent",
|
||||||
|
"severity": "off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "*-spacing",
|
||||||
|
"severity": "off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "*-spaces",
|
||||||
|
"severity": "off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "*-order",
|
||||||
|
"severity": "off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "*-dangle",
|
||||||
|
"severity": "off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "*-newline",
|
||||||
|
"severity": "off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "*quotes",
|
||||||
|
"severity": "off"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "*semi",
|
||||||
|
"severity": "off"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// The following is optional.
|
||||||
|
// It's better to put under project setting `.vscode/settings.json`
|
||||||
|
// to avoid conflicts with working with different eslint configs
|
||||||
|
// that does not support all formats.
|
||||||
|
"eslint.validate": [
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescript",
|
||||||
|
"typescriptreact",
|
||||||
|
"vue",
|
||||||
|
"html",
|
||||||
|
"markdown",
|
||||||
|
"json",
|
||||||
|
"jsonc",
|
||||||
|
"yaml"
|
||||||
]
|
]
|
||||||
}
|
}
|
@@ -18,7 +18,11 @@ cd ../tauri-plugin-vpnservice
|
|||||||
pnpm install
|
pnpm install
|
||||||
pnpm build
|
pnpm build
|
||||||
|
|
||||||
cd ../easytier-gui
|
cd ../easytier-web/frontend-lib
|
||||||
|
pnpm install
|
||||||
|
pnpm build
|
||||||
|
|
||||||
|
cd ../../easytier-gui
|
||||||
pnpm install
|
pnpm install
|
||||||
pnpm tauri build
|
pnpm tauri build
|
||||||
```
|
```
|
||||||
|
@@ -1,93 +0,0 @@
|
|||||||
network: 网络
|
|
||||||
networking_method: 网络方式
|
|
||||||
public_server: 公共服务器
|
|
||||||
manual: 手动
|
|
||||||
standalone: 独立
|
|
||||||
virtual_ipv4: 虚拟IPv4地址
|
|
||||||
virtual_ipv4_dhcp: DHCP
|
|
||||||
network_name: 网络名称
|
|
||||||
network_secret: 网络密码
|
|
||||||
public_server_url: 公共服务器地址
|
|
||||||
peer_urls: 对等节点地址
|
|
||||||
proxy_cidrs: 子网代理CIDR
|
|
||||||
enable_vpn_portal: 启用VPN门户
|
|
||||||
vpn_portal_listen_port: 监听端口
|
|
||||||
vpn_portal_client_network: 客户端子网
|
|
||||||
dev_name: TUN接口名称
|
|
||||||
advanced_settings: 高级设置
|
|
||||||
basic_settings: 基础设置
|
|
||||||
listener_urls: 监听地址
|
|
||||||
rpc_port: RPC端口
|
|
||||||
config_network: 配置网络
|
|
||||||
running: 运行中
|
|
||||||
error_msg: 错误信息
|
|
||||||
detail: 详情
|
|
||||||
add_new_network: 添加新网络
|
|
||||||
del_cur_network: 删除当前网络
|
|
||||||
select_network: 选择网络
|
|
||||||
network_instances: 网络实例
|
|
||||||
instance_id: 实例ID
|
|
||||||
network_infos: 网络信息
|
|
||||||
parse_network_config: 解析网络配置
|
|
||||||
retain_network_instance: 保留网络实例
|
|
||||||
collect_network_infos: 收集网络信息
|
|
||||||
settings: 设置
|
|
||||||
exchange_language: Switch to English
|
|
||||||
logging: 日志
|
|
||||||
logging_level_info: 信息
|
|
||||||
logging_level_debug: 调试
|
|
||||||
logging_level_warn: 警告
|
|
||||||
logging_level_trace: 跟踪
|
|
||||||
logging_level_off: 关闭
|
|
||||||
logging_open_dir: 打开日志目录
|
|
||||||
logging_copy_dir: 复制日志路径
|
|
||||||
disable_auto_launch: 关闭开机自启
|
|
||||||
enable_auto_launch: 开启开机自启
|
|
||||||
exit: 退出
|
|
||||||
chips_placeholder: 例如: {0}, 按回车添加
|
|
||||||
hostname_placeholder: '留空默认为主机名: {0}'
|
|
||||||
dev_name_placeholder: 注意:当多个网络同时使用相同的TUN接口名称时,将会在设置TUN的IP时产生冲突,留空以自动生成随机名称
|
|
||||||
off_text: 点击关闭
|
|
||||||
on_text: 点击开启
|
|
||||||
show_config: 显示配置
|
|
||||||
close: 关闭
|
|
||||||
|
|
||||||
use_latency_first: 延迟优先模式
|
|
||||||
my_node_info: 当前节点信息
|
|
||||||
peer_count: 已连接
|
|
||||||
upload: 上传
|
|
||||||
download: 下载
|
|
||||||
show_vpn_portal_config: 显示VPN门户配置
|
|
||||||
vpn_portal_config: VPN门户配置
|
|
||||||
show_event_log: 显示事件日志
|
|
||||||
event_log: 事件日志
|
|
||||||
peer_info: 节点信息
|
|
||||||
hostname: 主机名
|
|
||||||
route_cost: 路由
|
|
||||||
latency: 延迟
|
|
||||||
upload_bytes: 上传
|
|
||||||
download_bytes: 下载
|
|
||||||
loss_rate: 丢包率
|
|
||||||
|
|
||||||
status:
|
|
||||||
version: 内核版本
|
|
||||||
local: 本机
|
|
||||||
|
|
||||||
run_network: 运行网络
|
|
||||||
stop_network: 停止网络
|
|
||||||
network_running: 运行中
|
|
||||||
network_stopped: 已停止
|
|
||||||
dhcp_experimental_warning: 实验性警告!使用DHCP时如果组网环境中发生IP冲突,将自动更改IP。
|
|
||||||
|
|
||||||
tray:
|
|
||||||
show: 显示 / 隐藏
|
|
||||||
exit: 退出
|
|
||||||
|
|
||||||
about:
|
|
||||||
title: 关于
|
|
||||||
version: 版本
|
|
||||||
author: 作者
|
|
||||||
homepage: 主页
|
|
||||||
license: 许可证
|
|
||||||
description: 一个简单、安全、去中心化的内网穿透 VPN 组网方案,使用 Rust 语言和 Tokio 框架实现。
|
|
||||||
check_update: 检查更新
|
|
@@ -1,92 +0,0 @@
|
|||||||
network: Network
|
|
||||||
networking_method: Networking Method
|
|
||||||
public_server: Public Server
|
|
||||||
manual: Manual
|
|
||||||
standalone: Standalone
|
|
||||||
virtual_ipv4: Virtual IPv4
|
|
||||||
virtual_ipv4_dhcp: DHCP
|
|
||||||
network_name: Network Name
|
|
||||||
network_secret: Network Secret
|
|
||||||
public_server_url: Public Server URL
|
|
||||||
peer_urls: Peer URLs
|
|
||||||
proxy_cidrs: Subnet Proxy CIDRs
|
|
||||||
enable_vpn_portal: Enable VPN Portal
|
|
||||||
vpn_portal_listen_port: VPN Portal Listen Port
|
|
||||||
vpn_portal_client_network: Client Sub Network
|
|
||||||
dev_name: TUN interface name
|
|
||||||
advanced_settings: Advanced Settings
|
|
||||||
basic_settings: Basic Settings
|
|
||||||
listener_urls: Listener URLs
|
|
||||||
rpc_port: RPC Port
|
|
||||||
config_network: Config Network
|
|
||||||
running: Running
|
|
||||||
error_msg: Error Message
|
|
||||||
detail: Detail
|
|
||||||
add_new_network: New Network
|
|
||||||
del_cur_network: Delete Current Network
|
|
||||||
select_network: Select Network
|
|
||||||
network_instances: Network Instances
|
|
||||||
instance_id: Instance ID
|
|
||||||
network_infos: Network Infos
|
|
||||||
parse_network_config: Parse Network Config
|
|
||||||
retain_network_instance: Retain Network Instance
|
|
||||||
collect_network_infos: Collect Network Infos
|
|
||||||
settings: Settings
|
|
||||||
exchange_language: 切换中文
|
|
||||||
logging: Logging
|
|
||||||
logging_level_info: Info
|
|
||||||
logging_level_debug: Debug
|
|
||||||
logging_level_warn: Warn
|
|
||||||
logging_level_trace: Trace
|
|
||||||
logging_level_off: Off
|
|
||||||
logging_open_dir: Open Log Directory
|
|
||||||
logging_copy_dir: Copy Log Path
|
|
||||||
disable_auto_launch: Disable Launch on Reboot
|
|
||||||
enable_auto_launch: Enable Launch on Reboot
|
|
||||||
exit: Exit
|
|
||||||
use_latency_first: Latency First Mode
|
|
||||||
chips_placeholder: 'e.g: {0}, press Enter to add'
|
|
||||||
hostname_placeholder: 'Leave blank and default to host name: {0}'
|
|
||||||
dev_name_placeholder: 'Note: When multiple networks use the same TUN interface name at the same time, there will be a conflict when setting the TUN''s IP. Leave blank to automatically generate a random name.'
|
|
||||||
off_text: Press to disable
|
|
||||||
on_text: Press to enable
|
|
||||||
show_config: Show Config
|
|
||||||
close: Close
|
|
||||||
my_node_info: My Node Info
|
|
||||||
peer_count: Connected
|
|
||||||
upload: Upload
|
|
||||||
download: Download
|
|
||||||
show_vpn_portal_config: Show VPN Portal Config
|
|
||||||
vpn_portal_config: VPN Portal Config
|
|
||||||
show_event_log: Show Event Log
|
|
||||||
event_log: Event Log
|
|
||||||
peer_info: Peer Info
|
|
||||||
route_cost: Route Cost
|
|
||||||
hostname: Hostname
|
|
||||||
latency: Latency
|
|
||||||
upload_bytes: Upload
|
|
||||||
download_bytes: Download
|
|
||||||
loss_rate: Loss Rate
|
|
||||||
|
|
||||||
status:
|
|
||||||
version: Version
|
|
||||||
local: Local
|
|
||||||
|
|
||||||
run_network: Run Network
|
|
||||||
stop_network: Stop Network
|
|
||||||
network_running: running
|
|
||||||
network_stopped: stopped
|
|
||||||
dhcp_experimental_warning: Experimental warning! if there is an IP conflict in the network when using DHCP, the IP will be automatically changed.
|
|
||||||
|
|
||||||
tray:
|
|
||||||
show: Show / Hide
|
|
||||||
exit: Exit
|
|
||||||
|
|
||||||
about:
|
|
||||||
title: About
|
|
||||||
version: Version
|
|
||||||
author: Author
|
|
||||||
homepage: Homepage
|
|
||||||
license: License
|
|
||||||
description: 'EasyTier is a simple, safe and decentralized VPN networking solution implemented with the Rust language and Tokio framework.'
|
|
||||||
check_update: Check Update
|
|
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "easytier-gui",
|
"name": "easytier-gui",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.0.2",
|
"version": "2.4.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"packageManager": "pnpm@9.12.1+sha512.e5a7e52a4183a02d5931057f7a0dbff9d5e9ce3161e33fa68ae392125b79282a8a8a470a51dfc8a0ed86221442eb2fb57019b0990ed24fab519bf0e1bc5ccfc4",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
@@ -12,43 +13,44 @@
|
|||||||
"lint:fix": "eslint . --ignore-pattern src-tauri --fix"
|
"lint:fix": "eslint . --ignore-pattern src-tauri --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@primevue/themes": "^4.1.0",
|
"@primevue/themes": "4.3.3",
|
||||||
"@tauri-apps/plugin-autostart": "2.0.0-rc.1",
|
"@tauri-apps/plugin-autostart": "2.0.0",
|
||||||
"@tauri-apps/plugin-clipboard-manager": "2.0.0-rc.1",
|
"@tauri-apps/plugin-clipboard-manager": "2.3.0",
|
||||||
"@tauri-apps/plugin-os": "2.0.0-rc.1",
|
"@tauri-apps/plugin-os": "2.3.0",
|
||||||
"@tauri-apps/plugin-process": "2.0.0-rc.1",
|
"@tauri-apps/plugin-process": "2.3.0",
|
||||||
"@tauri-apps/plugin-shell": "2.0.0-rc.1",
|
"@tauri-apps/plugin-shell": "2.3.0",
|
||||||
|
"@vueuse/core": "^11.2.0",
|
||||||
"aura": "link:@primevue\\themes\\aura",
|
"aura": "link:@primevue\\themes\\aura",
|
||||||
|
"easytier-frontend-lib": "workspace:*",
|
||||||
"ip-num": "1.5.1",
|
"ip-num": "1.5.1",
|
||||||
"pinia": "^2.2.4",
|
"pinia": "^2.2.4",
|
||||||
"primeflex": "^3.3.1",
|
"primevue": "4.3.3",
|
||||||
"primeicons": "^7.0.0",
|
"tauri-plugin-vpnservice-api": "workspace:*",
|
||||||
"primevue": "^4.1.0",
|
"vue": "^3.5.12",
|
||||||
"tauri-plugin-vpnservice-api": "link:..\\tauri-plugin-vpnservice",
|
|
||||||
"vue": "^3.5.11",
|
|
||||||
"vue-i18n": "^10.0.4",
|
|
||||||
"vue-router": "^4.4.5"
|
"vue-router": "^4.4.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^3.7.3",
|
"@antfu/eslint-config": "^3.7.3",
|
||||||
"@intlify/unplugin-vue-i18n": "^5.2.0",
|
"@intlify/unplugin-vue-i18n": "^5.2.0",
|
||||||
"@primevue/auto-import-resolver": "^4.1.0",
|
"@primevue/auto-import-resolver": "4.3.3",
|
||||||
"@tauri-apps/api": "2.0.0-rc.0",
|
"@tauri-apps/api": "2.7.0",
|
||||||
"@tauri-apps/cli": "2.0.0-rc.3",
|
"@tauri-apps/cli": "2.7.1",
|
||||||
|
"@types/default-gateway": "^7.2.2",
|
||||||
"@types/node": "^22.7.4",
|
"@types/node": "^22.7.4",
|
||||||
"@types/uuid": "^10.0.0",
|
"@types/uuid": "^10.0.0",
|
||||||
"@vitejs/plugin-vue": "^5.1.4",
|
"@vitejs/plugin-vue": "^5.1.4",
|
||||||
"@vue-macros/volar": "^0.29.1",
|
"@vue-macros/volar": "0.30.5",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
|
"cidr-tools": "^11.0.2",
|
||||||
|
"default-gateway": "^7.2.2",
|
||||||
"eslint": "^9.12.0",
|
"eslint": "^9.12.0",
|
||||||
"eslint-plugin-format": "^0.1.2",
|
"eslint-plugin-format": "^0.1.2",
|
||||||
"internal-ip": "^8.0.0",
|
|
||||||
"postcss": "^8.4.47",
|
"postcss": "^8.4.47",
|
||||||
"tailwindcss": "^3.4.13",
|
"tailwindcss": "=3.4.17",
|
||||||
"typescript": "^5.6.2",
|
"typescript": "^5.6.2",
|
||||||
"unplugin-auto-import": "^0.18.3",
|
"unplugin-auto-import": "^0.18.3",
|
||||||
"unplugin-vue-components": "^0.27.4",
|
"unplugin-vue-components": "^0.27.4",
|
||||||
"unplugin-vue-macros": "^2.12.3",
|
"unplugin-vue-macros": "^2.13.3",
|
||||||
"unplugin-vue-markdown": "^0.26.2",
|
"unplugin-vue-markdown": "^0.26.2",
|
||||||
"unplugin-vue-router": "^0.10.8",
|
"unplugin-vue-router": "^0.10.8",
|
||||||
"uuid": "^10.0.0",
|
"uuid": "^10.0.0",
|
||||||
@@ -56,6 +58,6 @@
|
|||||||
"vite-plugin-vue-devtools": "^7.4.6",
|
"vite-plugin-vue-devtools": "^7.4.6",
|
||||||
"vite-plugin-vue-layouts": "^0.11.0",
|
"vite-plugin-vue-layouts": "^0.11.0",
|
||||||
"vue-i18n": "^10.0.0",
|
"vue-i18n": "^10.0.0",
|
||||||
"vue-tsc": "^2.1.6"
|
"vue-tsc": "^2.1.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
1255
easytier-gui/pnpm-lock.yaml
generated
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "easytier-gui"
|
name = "easytier-gui"
|
||||||
version = "2.0.2"
|
version = "2.4.0"
|
||||||
description = "EasyTier GUI"
|
description = "EasyTier GUI"
|
||||||
authors = ["you"]
|
authors = ["you"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
@@ -14,11 +14,20 @@ crate-type = ["staticlib", "cdylib", "rlib"]
|
|||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tauri-build = { version = "2.0.0-rc", features = [] }
|
tauri-build = { version = "2.0.0-rc", features = [] }
|
||||||
|
|
||||||
|
# enable thunk-rs when compiling for x86_64 or i686 windows
|
||||||
|
[target.x86_64-pc-windows-msvc.build-dependencies]
|
||||||
|
thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] }
|
||||||
|
|
||||||
|
[target.i686-pc-windows-msvc.build-dependencies]
|
||||||
|
thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = ["win7"] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tauri = { version = "2.0.0-rc", features = [
|
# wry 0.47 may crash on android, see https://github.com/EasyTier/EasyTier/issues/527
|
||||||
|
tauri = { version = "2.7.0", features = [
|
||||||
"tray-icon",
|
"tray-icon",
|
||||||
"image-png",
|
"image-png",
|
||||||
"image-ico",
|
"image-ico",
|
||||||
|
"devtools",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
@@ -31,19 +40,19 @@ chrono = { version = "0.4.37", features = ["serde"] }
|
|||||||
|
|
||||||
once_cell = "1.18.0"
|
once_cell = "1.18.0"
|
||||||
dashmap = "6.0"
|
dashmap = "6.0"
|
||||||
|
elevated-command = "1.1.2"
|
||||||
privilege = "0.3"
|
gethostname = "1.0.2"
|
||||||
gethostname = "0.5"
|
|
||||||
|
|
||||||
dunce = "1.0.4"
|
dunce = "1.0.4"
|
||||||
|
|
||||||
tauri-plugin-shell = "2.0.0-rc"
|
tauri-plugin-shell = "2.3.0"
|
||||||
tauri-plugin-process = "2.0.0-rc"
|
tauri-plugin-process = "2.3.0"
|
||||||
tauri-plugin-clipboard-manager = "2.0.0-rc"
|
tauri-plugin-clipboard-manager = "2.3.0"
|
||||||
tauri-plugin-positioner = { version = "2.0.0-rc", features = ["tray-icon"] }
|
tauri-plugin-positioner = { version = "2.3.0", features = ["tray-icon"] }
|
||||||
tauri-plugin-vpnservice = { path = "../../tauri-plugin-vpnservice" }
|
tauri-plugin-vpnservice = { path = "../../tauri-plugin-vpnservice" }
|
||||||
tauri-plugin-os = "2.0.0-rc"
|
tauri-plugin-os = "2.3.0"
|
||||||
tauri-plugin-autostart = "2.0.0-rc"
|
tauri-plugin-autostart = "2.5.0"
|
||||||
|
uuid = "1.17.0"
|
||||||
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
@@ -51,4 +60,4 @@ tauri-plugin-autostart = "2.0.0-rc"
|
|||||||
custom-protocol = ["tauri/custom-protocol"]
|
custom-protocol = ["tauri/custom-protocol"]
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||||
tauri-plugin-single-instance = "2.0.0-rc.0"
|
tauri-plugin-single-instance = "2.3.2"
|
||||||
|
@@ -1,3 +1,12 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
|
// enable thunk-rs when target os is windows and arch is x86_64 or i686
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
if !std::env::var("TARGET")
|
||||||
|
.unwrap_or_default()
|
||||||
|
.contains("aarch64")
|
||||||
|
{
|
||||||
|
thunk::thunk();
|
||||||
|
}
|
||||||
|
|
||||||
tauri_build::build();
|
tauri_build::build();
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"$schema": "../gen/schemas/desktop-schema.json",
|
||||||
"identifier": "migrated",
|
"identifier": "migrated",
|
||||||
"description": "permissions that were migrated from v1",
|
"description": "permissions that were migrated from v1",
|
||||||
"local": true,
|
"local": true,
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
"core:window:allow-show",
|
"core:window:allow-show",
|
||||||
"core:window:allow-hide",
|
"core:window:allow-hide",
|
||||||
"core:window:allow-set-focus",
|
"core:window:allow-set-focus",
|
||||||
|
"core:window:allow-set-title",
|
||||||
"core:app:default",
|
"core:app:default",
|
||||||
"core:resources:default",
|
"core:resources:default",
|
||||||
"core:menu:default",
|
"core:menu:default",
|
||||||
@@ -24,7 +26,6 @@
|
|||||||
"shell:default",
|
"shell:default",
|
||||||
"process:default",
|
"process:default",
|
||||||
"clipboard-manager:default",
|
"clipboard-manager:default",
|
||||||
"core:tray:default",
|
|
||||||
"core:tray:allow-new",
|
"core:tray:allow-new",
|
||||||
"core:tray:allow-set-menu",
|
"core:tray:allow-set-menu",
|
||||||
"core:tray:allow-set-title",
|
"core:tray:allow-set-title",
|
||||||
@@ -38,7 +39,7 @@
|
|||||||
"vpnservice:allow-prepare-vpn",
|
"vpnservice:allow-prepare-vpn",
|
||||||
"vpnservice:allow-start-vpn",
|
"vpnservice:allow-start-vpn",
|
||||||
"vpnservice:allow-stop-vpn",
|
"vpnservice:allow-stop-vpn",
|
||||||
"vpnservice:allow-register-listener",
|
"vpnservice:allow-registerListener",
|
||||||
"os:default",
|
"os:default",
|
||||||
"os:allow-os-type",
|
"os:allow-os-type",
|
||||||
"os:allow-arch",
|
"os:allow-arch",
|
||||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 34 KiB |
@@ -1,6 +1,7 @@
|
|||||||
#Tue May 10 19:22:52 CST 2022
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
298
easytier-gui/src-tauri/gen/android/gradlew
vendored
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -15,81 +15,115 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH="\\\"\\\""
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -98,88 +132,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=`expr $i + 1`
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
0) set -- ;;
|
|
||||||
1) set -- "$args0" ;;
|
|
||||||
2) set -- "$args0" "$args1" ;;
|
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=`save "$@"`
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
41
easytier-gui/src-tauri/gen/android/gradlew.bat
vendored
@@ -13,8 +13,10 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -25,7 +27,8 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -56,32 +59,34 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
@@ -3,176 +3,22 @@
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use anyhow::Context;
|
|
||||||
use dashmap::DashMap;
|
|
||||||
use easytier::{
|
use easytier::{
|
||||||
common::config::{
|
common::config::{ConfigLoader, FileLoggerConfig, LoggingConfigBuilder, TomlConfigLoader},
|
||||||
ConfigLoader, FileLoggerConfig, Flags, NetworkIdentity, PeerConfig, TomlConfigLoader,
|
instance_manager::NetworkInstanceManager,
|
||||||
VpnPortalConfig,
|
launcher::{ConfigSource, NetworkConfig, NetworkInstanceRunningInfo},
|
||||||
},
|
|
||||||
launcher::{NetworkInstance, NetworkInstanceRunningInfo},
|
|
||||||
utils::{self, NewFilterSender},
|
utils::{self, NewFilterSender},
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
use tauri::Manager as _;
|
use tauri::Manager as _;
|
||||||
|
|
||||||
pub const AUTOSTART_ARG: &str = "--autostart";
|
pub const AUTOSTART_ARG: &str = "--autostart";
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, PartialEq, Debug)]
|
|
||||||
enum NetworkingMethod {
|
|
||||||
PublicServer,
|
|
||||||
Manual,
|
|
||||||
Standalone,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for NetworkingMethod {
|
|
||||||
fn default() -> Self {
|
|
||||||
NetworkingMethod::PublicServer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "android"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Debug, Default)]
|
static INSTANCE_MANAGER: once_cell::sync::Lazy<NetworkInstanceManager> =
|
||||||
struct NetworkConfig {
|
once_cell::sync::Lazy::new(NetworkInstanceManager::new);
|
||||||
instance_id: String,
|
|
||||||
|
|
||||||
dhcp: bool,
|
|
||||||
virtual_ipv4: String,
|
|
||||||
hostname: Option<String>,
|
|
||||||
network_name: String,
|
|
||||||
network_secret: String,
|
|
||||||
networking_method: NetworkingMethod,
|
|
||||||
|
|
||||||
public_server_url: String,
|
|
||||||
peer_urls: Vec<String>,
|
|
||||||
|
|
||||||
proxy_cidrs: Vec<String>,
|
|
||||||
|
|
||||||
enable_vpn_portal: bool,
|
|
||||||
vpn_portal_listen_port: i32,
|
|
||||||
vpn_portal_client_network_addr: String,
|
|
||||||
vpn_portal_client_network_len: i32,
|
|
||||||
|
|
||||||
advanced_settings: bool,
|
|
||||||
|
|
||||||
listener_urls: Vec<String>,
|
|
||||||
rpc_port: i32,
|
|
||||||
latency_first: bool,
|
|
||||||
|
|
||||||
dev_name: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl NetworkConfig {
|
|
||||||
fn gen_config(&self) -> Result<TomlConfigLoader, anyhow::Error> {
|
|
||||||
let cfg = TomlConfigLoader::default();
|
|
||||||
cfg.set_id(
|
|
||||||
self.instance_id
|
|
||||||
.parse()
|
|
||||||
.with_context(|| format!("failed to parse instance id: {}", self.instance_id))?,
|
|
||||||
);
|
|
||||||
cfg.set_hostname(self.hostname.clone());
|
|
||||||
cfg.set_dhcp(self.dhcp);
|
|
||||||
cfg.set_inst_name(self.network_name.clone());
|
|
||||||
cfg.set_network_identity(NetworkIdentity::new(
|
|
||||||
self.network_name.clone(),
|
|
||||||
self.network_secret.clone(),
|
|
||||||
));
|
|
||||||
|
|
||||||
if !self.dhcp {
|
|
||||||
if self.virtual_ipv4.len() > 0 {
|
|
||||||
cfg.set_ipv4(Some(self.virtual_ipv4.parse().with_context(|| {
|
|
||||||
format!("failed to parse ipv4 address: {}", self.virtual_ipv4)
|
|
||||||
})?))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
match self.networking_method {
|
|
||||||
NetworkingMethod::PublicServer => {
|
|
||||||
cfg.set_peers(vec![PeerConfig {
|
|
||||||
uri: self.public_server_url.parse().with_context(|| {
|
|
||||||
format!(
|
|
||||||
"failed to parse public server uri: {}",
|
|
||||||
self.public_server_url
|
|
||||||
)
|
|
||||||
})?,
|
|
||||||
}]);
|
|
||||||
}
|
|
||||||
NetworkingMethod::Manual => {
|
|
||||||
let mut peers = vec![];
|
|
||||||
for peer_url in self.peer_urls.iter() {
|
|
||||||
if peer_url.is_empty() {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
peers.push(PeerConfig {
|
|
||||||
uri: peer_url
|
|
||||||
.parse()
|
|
||||||
.with_context(|| format!("failed to parse peer uri: {}", peer_url))?,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg.set_peers(peers);
|
|
||||||
}
|
|
||||||
NetworkingMethod::Standalone => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut listener_urls = vec![];
|
|
||||||
for listener_url in self.listener_urls.iter() {
|
|
||||||
if listener_url.is_empty() {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
listener_urls.push(
|
|
||||||
listener_url
|
|
||||||
.parse()
|
|
||||||
.with_context(|| format!("failed to parse listener uri: {}", listener_url))?,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
cfg.set_listeners(listener_urls);
|
|
||||||
|
|
||||||
for n in self.proxy_cidrs.iter() {
|
|
||||||
cfg.add_proxy_cidr(
|
|
||||||
n.parse()
|
|
||||||
.with_context(|| format!("failed to parse proxy network: {}", n))?,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg.set_rpc_portal(
|
|
||||||
format!("0.0.0.0:{}", self.rpc_port)
|
|
||||||
.parse()
|
|
||||||
.with_context(|| format!("failed to parse rpc portal port: {}", self.rpc_port))?,
|
|
||||||
);
|
|
||||||
|
|
||||||
if self.enable_vpn_portal {
|
|
||||||
let cidr = format!(
|
|
||||||
"{}/{}",
|
|
||||||
self.vpn_portal_client_network_addr, self.vpn_portal_client_network_len
|
|
||||||
);
|
|
||||||
cfg.set_vpn_portal_config(VpnPortalConfig {
|
|
||||||
client_cidr: cidr
|
|
||||||
.parse()
|
|
||||||
.with_context(|| format!("failed to parse vpn portal client cidr: {}", cidr))?,
|
|
||||||
wireguard_listen: format!("0.0.0.0:{}", self.vpn_portal_listen_port)
|
|
||||||
.parse()
|
|
||||||
.with_context(|| {
|
|
||||||
format!(
|
|
||||||
"failed to parse vpn portal wireguard listen port. {}",
|
|
||||||
self.vpn_portal_listen_port
|
|
||||||
)
|
|
||||||
})?,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
let mut flags = Flags::default();
|
|
||||||
flags.latency_first = self.latency_first;
|
|
||||||
flags.dev_name = self.dev_name.clone();
|
|
||||||
cfg.set_flags(flags);
|
|
||||||
Ok(cfg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static INSTANCE_MAP: once_cell::sync::Lazy<DashMap<String, NetworkInstance>> =
|
|
||||||
once_cell::sync::Lazy::new(DashMap::new);
|
|
||||||
|
|
||||||
static mut LOGGER_LEVEL_SENDER: once_cell::sync::Lazy<Option<NewFilterSender>> =
|
static mut LOGGER_LEVEL_SENDER: once_cell::sync::Lazy<Option<NewFilterSender>> =
|
||||||
once_cell::sync::Lazy::new(Default::default);
|
once_cell::sync::Lazy::new(Default::default);
|
||||||
@@ -196,43 +42,48 @@ fn parse_network_config(cfg: NetworkConfig) -> Result<String, String> {
|
|||||||
Ok(toml.dump())
|
Ok(toml.dump())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
fn generate_network_config(toml_config: String) -> Result<NetworkConfig, String> {
|
||||||
|
let config = TomlConfigLoader::new_from_str(&toml_config).map_err(|e| e.to_string())?;
|
||||||
|
let cfg = NetworkConfig::new_from_config(&config).map_err(|e| e.to_string())?;
|
||||||
|
Ok(cfg)
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn run_network_instance(cfg: NetworkConfig) -> Result<(), String> {
|
fn run_network_instance(cfg: NetworkConfig) -> Result<(), String> {
|
||||||
if INSTANCE_MAP.contains_key(&cfg.instance_id) {
|
let instance_id = cfg.instance_id().to_string();
|
||||||
return Err("instance already exists".to_string());
|
|
||||||
}
|
|
||||||
let instance_id = cfg.instance_id.clone();
|
|
||||||
|
|
||||||
let cfg = cfg.gen_config().map_err(|e| e.to_string())?;
|
let cfg = cfg.gen_config().map_err(|e| e.to_string())?;
|
||||||
let mut instance = NetworkInstance::new(cfg);
|
INSTANCE_MANAGER
|
||||||
instance.start().map_err(|e| e.to_string())?;
|
.run_network_instance(cfg, ConfigSource::GUI)
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
println!("instance {} started", instance_id);
|
println!("instance {} started", instance_id);
|
||||||
INSTANCE_MAP.insert(instance_id, instance);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn retain_network_instance(instance_ids: Vec<String>) -> Result<(), String> {
|
fn retain_network_instance(instance_ids: Vec<String>) -> Result<(), String> {
|
||||||
let _ = INSTANCE_MAP.retain(|k, _| instance_ids.contains(k));
|
let instance_ids = instance_ids
|
||||||
println!(
|
.into_iter()
|
||||||
"instance {:?} retained",
|
.filter_map(|id| uuid::Uuid::parse_str(&id).ok())
|
||||||
INSTANCE_MAP
|
.collect();
|
||||||
.iter()
|
let retained = INSTANCE_MANAGER
|
||||||
.map(|item| item.key().clone())
|
.retain_network_instance(instance_ids)
|
||||||
.collect::<Vec<_>>()
|
.map_err(|e| e.to_string())?;
|
||||||
);
|
println!("instance {:?} retained", retained);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn collect_network_infos() -> Result<BTreeMap<String, NetworkInstanceRunningInfo>, String> {
|
fn collect_network_infos() -> Result<BTreeMap<String, NetworkInstanceRunningInfo>, String> {
|
||||||
|
let infos = INSTANCE_MANAGER
|
||||||
|
.collect_network_infos()
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
let mut ret = BTreeMap::new();
|
let mut ret = BTreeMap::new();
|
||||||
for instance in INSTANCE_MAP.iter() {
|
for (uuid, info) in infos {
|
||||||
if let Some(info) = instance.get_running_info() {
|
ret.insert(uuid.to_string(), info);
|
||||||
ret.insert(instance.key().clone(), info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,6 +94,7 @@ fn get_os_hostname() -> Result<String, String> {
|
|||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn set_logging_level(level: String) -> Result<(), String> {
|
fn set_logging_level(level: String) -> Result<(), String> {
|
||||||
|
#[allow(static_mut_refs)]
|
||||||
let sender = unsafe { LOGGER_LEVEL_SENDER.as_ref().unwrap() };
|
let sender = unsafe { LOGGER_LEVEL_SENDER.as_ref().unwrap() };
|
||||||
sender.send(level).map_err(|e| e.to_string())?;
|
sender.send(level).map_err(|e| e.to_string())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -250,10 +102,10 @@ fn set_logging_level(level: String) -> Result<(), String> {
|
|||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn set_tun_fd(instance_id: String, fd: i32) -> Result<(), String> {
|
fn set_tun_fd(instance_id: String, fd: i32) -> Result<(), String> {
|
||||||
let mut instance = INSTANCE_MAP
|
let uuid = uuid::Uuid::parse_str(&instance_id).map_err(|e| e.to_string())?;
|
||||||
.get_mut(&instance_id)
|
INSTANCE_MANAGER
|
||||||
.ok_or("instance not found")?;
|
.set_tun_fd(&uuid, fd)
|
||||||
instance.set_tun_fd(fd);
|
.map_err(|e| e.to_string())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,7 +113,12 @@ fn set_tun_fd(instance_id: String, fd: i32) -> Result<(), String> {
|
|||||||
fn toggle_window_visibility<R: tauri::Runtime>(app: &tauri::AppHandle<R>) {
|
fn toggle_window_visibility<R: tauri::Runtime>(app: &tauri::AppHandle<R>) {
|
||||||
if let Some(window) = app.get_webview_window("main") {
|
if let Some(window) = app.get_webview_window("main") {
|
||||||
if window.is_visible().unwrap_or_default() {
|
if window.is_visible().unwrap_or_default() {
|
||||||
let _ = window.hide();
|
if window.is_minimized().unwrap_or_default() {
|
||||||
|
let _ = window.unminimize();
|
||||||
|
let _ = window.set_focus();
|
||||||
|
} else {
|
||||||
|
let _ = window.hide();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let _ = window.show();
|
let _ = window.show();
|
||||||
let _ = window.set_focus();
|
let _ = window.set_focus();
|
||||||
@@ -271,18 +128,20 @@ fn toggle_window_visibility<R: tauri::Runtime>(app: &tauri::AppHandle<R>) {
|
|||||||
|
|
||||||
#[cfg(not(target_os = "android"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
fn check_sudo() -> bool {
|
fn check_sudo() -> bool {
|
||||||
use std::env::current_exe;
|
let is_elevated = elevated_command::Command::is_elevated();
|
||||||
let is_elevated = privilege::user::privileged();
|
|
||||||
if !is_elevated {
|
if !is_elevated {
|
||||||
let Ok(exe) = current_exe() else {
|
let exe_path = std::env::var("APPIMAGE")
|
||||||
return true;
|
.ok()
|
||||||
};
|
.or_else(|| std::env::args().next())
|
||||||
|
.unwrap_or_default();
|
||||||
let args: Vec<String> = std::env::args().collect();
|
let args: Vec<String> = std::env::args().collect();
|
||||||
let mut elevated_cmd = privilege::runas::Command::new(exe);
|
let mut stdcmd = std::process::Command::new(&exe_path);
|
||||||
if args.contains(&AUTOSTART_ARG.to_owned()) {
|
if args.contains(&AUTOSTART_ARG.to_owned()) {
|
||||||
elevated_cmd.arg(AUTOSTART_ARG);
|
stdcmd.arg(AUTOSTART_ARG);
|
||||||
}
|
}
|
||||||
let _ = elevated_cmd.force_prompt(true).hide(true).gui(true).run();
|
elevated_command::Command::new(stdcmd)
|
||||||
|
.output()
|
||||||
|
.expect("Failed to run elevated command");
|
||||||
}
|
}
|
||||||
is_elevated
|
is_elevated
|
||||||
}
|
}
|
||||||
@@ -295,7 +154,6 @@ pub fn run() {
|
|||||||
process::exit(0);
|
process::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "android"))]
|
|
||||||
utils::setup_panic_handler();
|
utils::setup_panic_handler();
|
||||||
|
|
||||||
let mut builder = tauri::Builder::default();
|
let mut builder = tauri::Builder::default();
|
||||||
@@ -328,27 +186,32 @@ pub fn run() {
|
|||||||
.plugin(tauri_plugin_shell::init())
|
.plugin(tauri_plugin_shell::init())
|
||||||
.plugin(tauri_plugin_vpnservice::init());
|
.plugin(tauri_plugin_vpnservice::init());
|
||||||
|
|
||||||
builder
|
let app = builder
|
||||||
.setup(|app| {
|
.setup(|app| {
|
||||||
// for logging config
|
// for logging config
|
||||||
let Ok(log_dir) = app.path().app_log_dir() else {
|
let Ok(log_dir) = app.path().app_log_dir() else {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
let config = TomlConfigLoader::default();
|
let config = LoggingConfigBuilder::default()
|
||||||
config.set_file_logger_config(FileLoggerConfig {
|
.file_logger(FileLoggerConfig {
|
||||||
dir: Some(log_dir.to_string_lossy().to_string()),
|
dir: Some(log_dir.to_string_lossy().to_string()),
|
||||||
level: None,
|
level: None,
|
||||||
file: None,
|
file: None,
|
||||||
});
|
})
|
||||||
let Ok(Some(logger_reinit)) = utils::init_logger(config, true) else {
|
.build()
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
|
let Ok(Some(logger_reinit)) = utils::init_logger(&config, true) else {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
unsafe { LOGGER_LEVEL_SENDER.replace(logger_reinit) };
|
#[allow(static_mut_refs)]
|
||||||
|
unsafe {
|
||||||
|
LOGGER_LEVEL_SENDER.replace(logger_reinit)
|
||||||
|
};
|
||||||
|
|
||||||
// for tray icon, menu need to be built in js
|
// for tray icon, menu need to be built in js
|
||||||
#[cfg(not(target_os = "android"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
let _tray_menu = TrayIconBuilder::with_id("main")
|
let _tray_menu = TrayIconBuilder::with_id("main")
|
||||||
.menu_on_left_click(false)
|
.show_menu_on_left_click(false)
|
||||||
.on_tray_icon_event(|tray, event| {
|
.on_tray_icon_event(|tray, event| {
|
||||||
if let TrayIconEvent::Click {
|
if let TrayIconEvent::Click {
|
||||||
button: MouseButton::Left,
|
button: MouseButton::Left,
|
||||||
@@ -370,6 +233,7 @@ pub fn run() {
|
|||||||
})
|
})
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
parse_network_config,
|
parse_network_config,
|
||||||
|
generate_network_config,
|
||||||
run_network_instance,
|
run_network_instance,
|
||||||
retain_network_instance,
|
retain_network_instance,
|
||||||
collect_network_infos,
|
collect_network_infos,
|
||||||
@@ -387,6 +251,20 @@ pub fn run() {
|
|||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
})
|
})
|
||||||
.run(tauri::generate_context!())
|
.build(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.unwrap();
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
app.run(|_app, _event| {});
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
{
|
||||||
|
use tauri::RunEvent;
|
||||||
|
app.run(|app, event| match event {
|
||||||
|
RunEvent::Reopen { .. } => {
|
||||||
|
toggle_window_visibility(app);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
"createUpdaterArtifacts": false
|
"createUpdaterArtifacts": false
|
||||||
},
|
},
|
||||||
"productName": "easytier-gui",
|
"productName": "easytier-gui",
|
||||||
"version": "2.0.2",
|
"version": "2.4.0",
|
||||||
"identifier": "com.kkrainbow.easytier",
|
"identifier": "com.kkrainbow.easytier",
|
||||||
"plugins": {},
|
"plugins": {},
|
||||||
"app": {
|
"app": {
|
||||||
|
@@ -1,3 +1,13 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { getCurrentWindow } from '@tauri-apps/api/window'
|
||||||
|
import pkg from '~/../package.json'
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
await getCurrentWindow().setTitle(`Easytier GUI: v${pkg.version}`)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<Toast position="bottom-right" />
|
||||||
<RouterView />
|
<RouterView />
|
||||||
</template>
|
</template>
|
||||||
|
6
easytier-gui/src/auto-imports.d.ts
vendored
@@ -21,7 +21,9 @@ declare global {
|
|||||||
const definePage: typeof import('unplugin-vue-router/runtime')['definePage']
|
const definePage: typeof import('unplugin-vue-router/runtime')['definePage']
|
||||||
const defineStore: typeof import('pinia')['defineStore']
|
const defineStore: typeof import('pinia')['defineStore']
|
||||||
const effectScope: typeof import('vue')['effectScope']
|
const effectScope: typeof import('vue')['effectScope']
|
||||||
|
const event2human: typeof import('./composables/utils')['event2human']
|
||||||
const generateMenuItem: typeof import('./composables/tray')['generateMenuItem']
|
const generateMenuItem: typeof import('./composables/tray')['generateMenuItem']
|
||||||
|
const generateNetworkConfig: typeof import('./composables/network')['generateNetworkConfig']
|
||||||
const getActivePinia: typeof import('pinia')['getActivePinia']
|
const getActivePinia: typeof import('pinia')['getActivePinia']
|
||||||
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
||||||
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
||||||
@@ -44,6 +46,8 @@ declare global {
|
|||||||
const mapWritableState: typeof import('pinia')['mapWritableState']
|
const mapWritableState: typeof import('pinia')['mapWritableState']
|
||||||
const markRaw: typeof import('vue')['markRaw']
|
const markRaw: typeof import('vue')['markRaw']
|
||||||
const nextTick: typeof import('vue')['nextTick']
|
const nextTick: typeof import('vue')['nextTick']
|
||||||
|
const num2ipv4: typeof import('./composables/utils')['num2ipv4']
|
||||||
|
const num2ipv6: typeof import('./composables/utils')['num2ipv6']
|
||||||
const onActivated: typeof import('vue')['onActivated']
|
const onActivated: typeof import('vue')['onActivated']
|
||||||
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
||||||
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
|
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
|
||||||
@@ -81,6 +85,7 @@ declare global {
|
|||||||
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
||||||
const shallowRef: typeof import('vue')['shallowRef']
|
const shallowRef: typeof import('vue')['shallowRef']
|
||||||
const storeToRefs: typeof import('pinia')['storeToRefs']
|
const storeToRefs: typeof import('pinia')['storeToRefs']
|
||||||
|
const timeAgoCn: typeof import('./composables/utils')['timeAgoCn']
|
||||||
const toRaw: typeof import('vue')['toRaw']
|
const toRaw: typeof import('vue')['toRaw']
|
||||||
const toRef: typeof import('vue')['toRef']
|
const toRef: typeof import('vue')['toRef']
|
||||||
const toRefs: typeof import('vue')['toRefs']
|
const toRefs: typeof import('vue')['toRefs']
|
||||||
@@ -130,6 +135,7 @@ declare module 'vue' {
|
|||||||
readonly defineStore: UnwrapRef<typeof import('pinia')['defineStore']>
|
readonly defineStore: UnwrapRef<typeof import('pinia')['defineStore']>
|
||||||
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
|
readonly effectScope: UnwrapRef<typeof import('vue')['effectScope']>
|
||||||
readonly generateMenuItem: UnwrapRef<typeof import('./composables/tray')['generateMenuItem']>
|
readonly generateMenuItem: UnwrapRef<typeof import('./composables/tray')['generateMenuItem']>
|
||||||
|
readonly generateNetworkConfig: UnwrapRef<typeof import('./composables/network')['generateNetworkConfig']>
|
||||||
readonly getActivePinia: UnwrapRef<typeof import('pinia')['getActivePinia']>
|
readonly getActivePinia: UnwrapRef<typeof import('pinia')['getActivePinia']>
|
||||||
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
|
readonly getCurrentInstance: UnwrapRef<typeof import('vue')['getCurrentInstance']>
|
||||||
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
|
readonly getCurrentScope: UnwrapRef<typeof import('vue')['getCurrentScope']>
|
||||||
|
@@ -1,308 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import InputGroup from 'primevue/inputgroup'
|
|
||||||
import InputGroupAddon from 'primevue/inputgroupaddon'
|
|
||||||
import { ping } from 'tauri-plugin-vpnservice-api'
|
|
||||||
import { getOsHostname } from '~/composables/network'
|
|
||||||
|
|
||||||
import { NetworkingMethod } from '~/types/network'
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
configInvalid?: boolean
|
|
||||||
instanceId?: string
|
|
||||||
}>()
|
|
||||||
|
|
||||||
defineEmits(['runNetwork'])
|
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
|
|
||||||
const networking_methods = ref([
|
|
||||||
{ value: NetworkingMethod.PublicServer, label: () => t('public_server') },
|
|
||||||
{ value: NetworkingMethod.Manual, label: () => t('manual') },
|
|
||||||
{ value: NetworkingMethod.Standalone, label: () => t('standalone') },
|
|
||||||
])
|
|
||||||
|
|
||||||
const networkStore = useNetworkStore()
|
|
||||||
const curNetwork = computed(() => {
|
|
||||||
if (props.instanceId) {
|
|
||||||
// console.log('instanceId', props.instanceId)
|
|
||||||
const c = networkStore.networkList.find(n => n.instance_id === props.instanceId)
|
|
||||||
if (c !== undefined)
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
return networkStore.curNetwork
|
|
||||||
})
|
|
||||||
|
|
||||||
const protos: { [proto: string]: number } = { tcp: 11010, udp: 11010, wg: 11011, ws: 11011, wss: 11012 }
|
|
||||||
|
|
||||||
function searchUrlSuggestions(e: { query: string }): string[] {
|
|
||||||
const query = e.query
|
|
||||||
const ret = []
|
|
||||||
// if query match "^\w+:.*", then no proto prefix
|
|
||||||
if (query.match(/^\w+:.*/)) {
|
|
||||||
// if query is a valid url, then add to suggestions
|
|
||||||
try {
|
|
||||||
new URL(query)
|
|
||||||
ret.push(query)
|
|
||||||
}
|
|
||||||
catch (e) {}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
for (const proto in protos) {
|
|
||||||
let item = `${proto}://${query}`
|
|
||||||
// if query match ":\d+$", then no port suffix
|
|
||||||
if (!query.match(/:\d+$/)) {
|
|
||||||
item += `:${protos[proto]}`
|
|
||||||
}
|
|
||||||
ret.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret
|
|
||||||
}
|
|
||||||
|
|
||||||
const publicServerSuggestions = ref([''])
|
|
||||||
|
|
||||||
function searchPresetPublicServers(e: { query: string }) {
|
|
||||||
const presetPublicServers = [
|
|
||||||
'tcp://public.easytier.top:11010',
|
|
||||||
]
|
|
||||||
|
|
||||||
const query = e.query
|
|
||||||
// if query is sub string of presetPublicServers, add to suggestions
|
|
||||||
let ret = presetPublicServers.filter(item => item.includes(query))
|
|
||||||
// add additional suggestions
|
|
||||||
if (query.length > 0) {
|
|
||||||
ret = ret.concat(searchUrlSuggestions(e))
|
|
||||||
}
|
|
||||||
|
|
||||||
publicServerSuggestions.value = ret
|
|
||||||
}
|
|
||||||
|
|
||||||
const peerSuggestions = ref([''])
|
|
||||||
|
|
||||||
function searchPeerSuggestions(e: { query: string }) {
|
|
||||||
peerSuggestions.value = searchUrlSuggestions(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
const listenerSuggestions = ref([''])
|
|
||||||
|
|
||||||
function searchListenerSuggestiong(e: { query: string }) {
|
|
||||||
const ret = []
|
|
||||||
|
|
||||||
for (const proto in protos) {
|
|
||||||
let item = `${proto}://0.0.0.0:`
|
|
||||||
// if query is a number, use it as port
|
|
||||||
if (e.query.match(/^\d+$/)) {
|
|
||||||
item += e.query
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
item += protos[proto]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.includes(e.query)) {
|
|
||||||
ret.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret.length === 0) {
|
|
||||||
ret.push(e.query)
|
|
||||||
}
|
|
||||||
|
|
||||||
listenerSuggestions.value = ret
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateHostname() {
|
|
||||||
if (curNetwork.value.hostname) {
|
|
||||||
// eslint no-useless-escape
|
|
||||||
let name = curNetwork.value.hostname!.replaceAll(/[^\u4E00-\u9FA5a-z0-9\-]*/gi, '')
|
|
||||||
if (name.length > 32)
|
|
||||||
name = name.substring(0, 32)
|
|
||||||
|
|
||||||
if (curNetwork.value.hostname !== name)
|
|
||||||
curNetwork.value.hostname = name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const osHostname = ref<string>('')
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
osHostname.value = await getOsHostname()
|
|
||||||
osHostname.value = await ping('ffdklsajflkdsjl') || ''
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="flex flex-column h-full">
|
|
||||||
<div class="flex flex-column">
|
|
||||||
<div class="w-10/12 self-center mb-3">
|
|
||||||
<Message severity="warn">
|
|
||||||
{{ t('dhcp_experimental_warning') }}
|
|
||||||
</Message>
|
|
||||||
</div>
|
|
||||||
<div class="w-10/12 self-center ">
|
|
||||||
<Panel :header="t('basic_settings')">
|
|
||||||
<div class="flex flex-column gap-y-2">
|
|
||||||
<div class="flex flex-row gap-x-9 flex-wrap">
|
|
||||||
<div class="flex flex-column gap-2 basis-5/12 grow">
|
|
||||||
<div class="flex align-items-center" for="virtual_ip">
|
|
||||||
<label class="mr-2"> {{ t('virtual_ipv4') }} </label>
|
|
||||||
<Checkbox v-model="curNetwork.dhcp" input-id="virtual_ip_auto" :binary="true" />
|
|
||||||
|
|
||||||
<label for="virtual_ip_auto" class="ml-2">
|
|
||||||
{{ t('virtual_ipv4_dhcp') }}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<InputGroup>
|
|
||||||
<InputText
|
|
||||||
id="virtual_ip" v-model="curNetwork.virtual_ipv4" :disabled="curNetwork.dhcp"
|
|
||||||
aria-describedby="virtual_ipv4-help"
|
|
||||||
/>
|
|
||||||
<InputGroupAddon>
|
|
||||||
<span>/24</span>
|
|
||||||
</InputGroupAddon>
|
|
||||||
</InputGroup>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-row gap-x-9 flex-wrap">
|
|
||||||
<div class="flex flex-column gap-2 basis-5/12 grow">
|
|
||||||
<label for="network_name">{{ t('network_name') }}</label>
|
|
||||||
<InputText id="network_name" v-model="curNetwork.network_name" aria-describedby="network_name-help" />
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-column gap-2 basis-5/12 grow">
|
|
||||||
<label for="network_secret">{{ t('network_secret') }}</label>
|
|
||||||
<InputText
|
|
||||||
id="network_secret" v-model="curNetwork.network_secret"
|
|
||||||
aria-describedby="network_secret-help"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-row gap-x-9 flex-wrap">
|
|
||||||
<div class="flex flex-column gap-2 basis-5/12 grow">
|
|
||||||
<label for="nm">{{ t('networking_method') }}</label>
|
|
||||||
<SelectButton v-model="curNetwork.networking_method" :options="networking_methods" :option-label="(v) => v.label()" option-value="value" />
|
|
||||||
<div class="items-center flex flex-row p-fluid gap-x-1">
|
|
||||||
<AutoComplete
|
|
||||||
v-if="curNetwork.networking_method === NetworkingMethod.Manual" id="chips"
|
|
||||||
v-model="curNetwork.peer_urls" :placeholder="t('chips_placeholder', ['tcp://8.8.8.8:11010'])"
|
|
||||||
class="grow" multiple fluid :suggestions="peerSuggestions" @complete="searchPeerSuggestions"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<AutoComplete
|
|
||||||
v-if="curNetwork.networking_method === NetworkingMethod.PublicServer" v-model="curNetwork.public_server_url"
|
|
||||||
:suggestions="publicServerSuggestions" :virtual-scroller-options="{ itemSize: 38 }" class="grow" dropdown :complete-on-focus="true"
|
|
||||||
@complete="searchPresetPublicServers"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Panel>
|
|
||||||
|
|
||||||
<Divider />
|
|
||||||
|
|
||||||
<Panel :header="t('advanced_settings')" toggleable collapsed>
|
|
||||||
<div class="flex flex-column gap-y-2">
|
|
||||||
<div class="flex flex-row gap-x-9 flex-wrap">
|
|
||||||
<div class="flex flex-column gap-2 basis-5/12 grow">
|
|
||||||
<div class="flex align-items-center">
|
|
||||||
<Checkbox v-model="curNetwork.latency_first" input-id="use_latency_first" :binary="true" />
|
|
||||||
<label for="use_latency_first" class="ml-2"> {{ t('use_latency_first') }} </label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-row gap-x-9 flex-wrap">
|
|
||||||
<div class="flex flex-column gap-2 basis-5/12 grow">
|
|
||||||
<label for="hostname">{{ t('hostname') }}</label>
|
|
||||||
<InputText
|
|
||||||
id="hostname" v-model="curNetwork.hostname" aria-describedby="hostname-help" :format="true"
|
|
||||||
:placeholder="t('hostname_placeholder', [osHostname])" @blur="validateHostname"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-row gap-x-9 flex-wrap w-full">
|
|
||||||
<div class="flex flex-column gap-2 grow p-fluid">
|
|
||||||
<label for="username">{{ t('proxy_cidrs') }}</label>
|
|
||||||
<Chips
|
|
||||||
id="chips" v-model="curNetwork.proxy_cidrs"
|
|
||||||
:placeholder="t('chips_placeholder', ['10.0.0.0/24'])" separator=" " class="w-full"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-row gap-x-9 flex-wrap ">
|
|
||||||
<div class="flex flex-column gap-2 grow">
|
|
||||||
<label for="username">VPN Portal</label>
|
|
||||||
<ToggleButton
|
|
||||||
v-model="curNetwork.enable_vpn_portal" on-icon="pi pi-check" off-icon="pi pi-times"
|
|
||||||
:on-label="t('off_text')" :off-label="t('on_text')" class="w-48"
|
|
||||||
/>
|
|
||||||
<div v-if="curNetwork.enable_vpn_portal" class="items-center flex flex-row gap-x-4">
|
|
||||||
<div class="min-w-64">
|
|
||||||
<InputGroup>
|
|
||||||
<InputText
|
|
||||||
v-model="curNetwork.vpn_portal_client_network_addr"
|
|
||||||
:placeholder="t('vpn_portal_client_network')"
|
|
||||||
/>
|
|
||||||
<InputGroupAddon>
|
|
||||||
<span>/{{ curNetwork.vpn_portal_client_network_len }}</span>
|
|
||||||
</InputGroupAddon>
|
|
||||||
</InputGroup>
|
|
||||||
|
|
||||||
<InputNumber
|
|
||||||
v-model="curNetwork.vpn_portal_listen_port" :allow-empty="false"
|
|
||||||
:format="false" :min="0" :max="65535" class="w-8" fluid
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-row gap-x-9 flex-wrap">
|
|
||||||
<div class="flex flex-column gap-2 grow p-fluid">
|
|
||||||
<label for="listener_urls">{{ t('listener_urls') }}</label>
|
|
||||||
<AutoComplete
|
|
||||||
id="listener_urls" v-model="curNetwork.listener_urls"
|
|
||||||
:suggestions="listenerSuggestions" class="w-full" dropdown :complete-on-focus="true"
|
|
||||||
:placeholder="t('chips_placeholder', ['tcp://1.1.1.1:11010'])"
|
|
||||||
multiple @complete="searchListenerSuggestiong"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-row gap-x-9 flex-wrap">
|
|
||||||
<div class="flex flex-column gap-2 basis-5/12 grow">
|
|
||||||
<label for="rpc_port">{{ t('rpc_port') }}</label>
|
|
||||||
<InputNumber
|
|
||||||
id="rpc_port" v-model="curNetwork.rpc_port" aria-describedby="rpc_port-help"
|
|
||||||
:format="false" :min="0" :max="65535"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-row gap-x-9 flex-wrap">
|
|
||||||
<div class="flex flex-column gap-2 basis-5/12 grow">
|
|
||||||
<label for="dev_name">{{ t('dev_name') }}</label>
|
|
||||||
<InputText
|
|
||||||
id="dev_name" v-model="curNetwork.dev_name" aria-describedby="dev_name-help" :format="true"
|
|
||||||
:placeholder="t('dev_name_placeholder')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Panel>
|
|
||||||
|
|
||||||
<div class="flex pt-4 justify-content-center">
|
|
||||||
<Button
|
|
||||||
:label="t('run_network')" icon="pi pi-arrow-right" icon-pos="right" :disabled="configInvalid"
|
|
||||||
@click="$emit('runNetwork', curNetwork)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
@@ -1,6 +1,9 @@
|
|||||||
|
import type { NetworkTypes } from 'easytier-frontend-lib'
|
||||||
import { addPluginListener } from '@tauri-apps/api/core'
|
import { addPluginListener } from '@tauri-apps/api/core'
|
||||||
|
import { Utils } from 'easytier-frontend-lib'
|
||||||
import { prepare_vpn, start_vpn, stop_vpn } from 'tauri-plugin-vpnservice-api'
|
import { prepare_vpn, start_vpn, stop_vpn } from 'tauri-plugin-vpnservice-api'
|
||||||
import type { Route } from '~/types/network'
|
|
||||||
|
type Route = NetworkTypes.Route
|
||||||
|
|
||||||
const networkStore = useNetworkStore()
|
const networkStore = useNetworkStore()
|
||||||
|
|
||||||
@@ -46,7 +49,7 @@ async function doStartVpn(ipv4Addr: string, cidr: number, routes: string[]) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('start vpn')
|
console.log('start vpn service', ipv4Addr, cidr, routes)
|
||||||
const start_ret = await start_vpn({
|
const start_ret = await start_vpn({
|
||||||
ipv4Addr: `${ipv4Addr}/${cidr}`,
|
ipv4Addr: `${ipv4Addr}/${cidr}`,
|
||||||
routes,
|
routes,
|
||||||
@@ -110,6 +113,7 @@ function getRoutesForVpn(routes: Route[]): string[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onNetworkInstanceChange() {
|
async function onNetworkInstanceChange() {
|
||||||
|
console.error('vpn service watch network instance change ids', JSON.stringify(networkStore.networkInstanceIds))
|
||||||
const insts = networkStore.networkInstanceIds
|
const insts = networkStore.networkInstanceIds
|
||||||
if (!insts) {
|
if (!insts) {
|
||||||
await doStopVpn()
|
await doStopVpn()
|
||||||
@@ -122,19 +126,32 @@ async function onNetworkInstanceChange() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const virtual_ip = curNetworkInfo?.node_info?.virtual_ipv4
|
const virtual_ip = Utils.ipv4ToString(curNetworkInfo?.my_node_info?.virtual_ipv4.address)
|
||||||
if (!virtual_ip || !virtual_ip.length) {
|
if (!virtual_ip || !virtual_ip.length) {
|
||||||
await doStopVpn()
|
await doStopVpn()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if use no tun mode, stop the vpn service
|
||||||
|
const no_tun = networkStore.isNoTunEnabled(insts[0])
|
||||||
|
if (no_tun) {
|
||||||
|
console.error('no tun mode, stop vpn service')
|
||||||
|
await doStopVpn()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let network_length = curNetworkInfo?.my_node_info?.virtual_ipv4.network_length
|
||||||
|
if (!network_length) {
|
||||||
|
network_length = 24
|
||||||
|
}
|
||||||
|
|
||||||
const routes = getRoutesForVpn(curNetworkInfo?.routes)
|
const routes = getRoutesForVpn(curNetworkInfo?.routes)
|
||||||
|
|
||||||
const ipChanged = virtual_ip !== curVpnStatus.ipv4Addr
|
const ipChanged = virtual_ip !== curVpnStatus.ipv4Addr
|
||||||
const routesChanged = JSON.stringify(routes) !== JSON.stringify(curVpnStatus.routes)
|
const routesChanged = JSON.stringify(routes) !== JSON.stringify(curVpnStatus.routes)
|
||||||
|
|
||||||
if (ipChanged || routesChanged) {
|
if (ipChanged || routesChanged) {
|
||||||
console.log('virtual ip changed', JSON.stringify(curVpnStatus), virtual_ip)
|
console.info('vpn service virtual ip changed', JSON.stringify(curVpnStatus), virtual_ip)
|
||||||
try {
|
try {
|
||||||
await doStopVpn()
|
await doStopVpn()
|
||||||
}
|
}
|
||||||
@@ -146,7 +163,7 @@ async function onNetworkInstanceChange() {
|
|||||||
await doStartVpn(virtual_ip, 24, routes)
|
await doStartVpn(virtual_ip, 24, routes)
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.error('start vpn failed, clear all network insts.', e)
|
console.error('start vpn service failed, clear all network insts.', e)
|
||||||
networkStore.clearNetworkInstances()
|
networkStore.clearNetworkInstances()
|
||||||
await retainNetworkInstance(networkStore.networkInstanceIds)
|
await retainNetworkInstance(networkStore.networkInstanceIds)
|
||||||
}
|
}
|
||||||
@@ -167,6 +184,7 @@ async function watchNetworkInstance() {
|
|||||||
}
|
}
|
||||||
subscribe_running = false
|
subscribe_running = false
|
||||||
})
|
})
|
||||||
|
console.error('vpn service watch network instance')
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function initMobileVpnService() {
|
export async function initMobileVpnService() {
|
||||||
|
@@ -1,11 +1,17 @@
|
|||||||
|
import type { NetworkTypes } from 'easytier-frontend-lib'
|
||||||
import { invoke } from '@tauri-apps/api/core'
|
import { invoke } from '@tauri-apps/api/core'
|
||||||
|
|
||||||
import type { NetworkConfig, NetworkInstanceRunningInfo } from '~/types/network'
|
type NetworkConfig = NetworkTypes.NetworkConfig
|
||||||
|
type NetworkInstanceRunningInfo = NetworkTypes.NetworkInstanceRunningInfo
|
||||||
|
|
||||||
export async function parseNetworkConfig(cfg: NetworkConfig) {
|
export async function parseNetworkConfig(cfg: NetworkConfig) {
|
||||||
return invoke<string>('parse_network_config', { cfg })
|
return invoke<string>('parse_network_config', { cfg })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function generateNetworkConfig(tomlConfig: string) {
|
||||||
|
return invoke<NetworkConfig>('generate_network_config', { tomlConfig })
|
||||||
|
}
|
||||||
|
|
||||||
export async function runNetworkInstance(cfg: NetworkConfig) {
|
export async function runNetworkInstance(cfg: NetworkConfig) {
|
||||||
return invoke('run_network_instance', { cfg })
|
return invoke('run_network_instance', { cfg })
|
||||||
}
|
}
|
||||||
|
@@ -5,12 +5,11 @@ import ToastService from 'primevue/toastservice'
|
|||||||
import { createRouter, createWebHistory } from 'vue-router/auto'
|
import { createRouter, createWebHistory } from 'vue-router/auto'
|
||||||
import { routes } from 'vue-router/auto-routes'
|
import { routes } from 'vue-router/auto-routes'
|
||||||
import App from '~/App.vue'
|
import App from '~/App.vue'
|
||||||
import { i18n, loadLanguageAsync } from '~/modules/i18n'
|
import EasyTierFrontendLib, { I18nUtils } from 'easytier-frontend-lib'
|
||||||
|
|
||||||
import { getAutoLaunchStatusAsync, loadAutoLaunchStatusAsync } from './modules/auto_launch'
|
import { getAutoLaunchStatusAsync, loadAutoLaunchStatusAsync } from './modules/auto_launch'
|
||||||
import '~/styles.css'
|
import '~/styles.css'
|
||||||
import 'primeicons/primeicons.css'
|
import 'easytier-frontend-lib/style.css'
|
||||||
import 'primeflex/primeflex.css'
|
|
||||||
|
|
||||||
if (import.meta.env.PROD) {
|
if (import.meta.env.PROD) {
|
||||||
document.addEventListener('keydown', (event) => {
|
document.addEventListener('keydown', (event) => {
|
||||||
@@ -29,7 +28,7 @@ if (import.meta.env.PROD) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
await loadLanguageAsync(localStorage.getItem('lang') || 'en')
|
await I18nUtils.loadLanguageAsync(localStorage.getItem('lang') || 'en')
|
||||||
await loadAutoLaunchStatusAsync(getAutoLaunchStatusAsync())
|
await loadAutoLaunchStatusAsync(getAutoLaunchStatusAsync())
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
@@ -41,18 +40,22 @@ async function main() {
|
|||||||
|
|
||||||
app.use(router)
|
app.use(router)
|
||||||
app.use(createPinia())
|
app.use(createPinia())
|
||||||
app.use(i18n, { useScope: 'global' })
|
app.use(EasyTierFrontendLib)
|
||||||
|
// app.use(i18n, { useScope: 'global' })
|
||||||
app.use(PrimeVue, {
|
app.use(PrimeVue, {
|
||||||
theme: {
|
theme: {
|
||||||
preset: Aura,
|
preset: Aura,
|
||||||
options: {
|
options: {
|
||||||
prefix: 'p',
|
prefix: 'p',
|
||||||
darkModeSelector: 'system',
|
darkModeSelector: 'system',
|
||||||
cssLayer: false,
|
cssLayer: {
|
||||||
|
name: 'primevue',
|
||||||
|
order: 'tailwind-base, primevue, tailwind-utilities',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
app.use(ToastService)
|
app.use(ToastService as any)
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,16 @@ import { disable, enable, isEnabled } from '@tauri-apps/plugin-autostart'
|
|||||||
|
|
||||||
export async function loadAutoLaunchStatusAsync(target_enable: boolean): Promise<boolean> {
|
export async function loadAutoLaunchStatusAsync(target_enable: boolean): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
target_enable ? await enable() : await disable()
|
if (target_enable) {
|
||||||
|
await enable()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// 消除没有配置自启动时进行关闭操作报错
|
||||||
|
try {
|
||||||
|
await disable()
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
localStorage.setItem('auto_launch', JSON.stringify(await isEnabled()))
|
localStorage.setItem('auto_launch', JSON.stringify(await isEnabled()))
|
||||||
return isEnabled()
|
return isEnabled()
|
||||||
}
|
}
|
||||||
|
@@ -8,14 +8,11 @@ import { exit } from '@tauri-apps/plugin-process'
|
|||||||
import { open } from '@tauri-apps/plugin-shell'
|
import { open } from '@tauri-apps/plugin-shell'
|
||||||
import TieredMenu from 'primevue/tieredmenu'
|
import TieredMenu from 'primevue/tieredmenu'
|
||||||
import { useToast } from 'primevue/usetoast'
|
import { useToast } from 'primevue/usetoast'
|
||||||
import Config from '~/components/Config.vue'
|
import { NetworkTypes, Config, Status, Utils, I18nUtils, ConfigEditDialog } from 'easytier-frontend-lib'
|
||||||
|
|
||||||
import Status from '~/components/Status.vue'
|
|
||||||
import { isAutostart, setLoggingLevel } from '~/composables/network'
|
import { isAutostart, setLoggingLevel } from '~/composables/network'
|
||||||
import { useTray } from '~/composables/tray'
|
import { useTray } from '~/composables/tray'
|
||||||
import { getAutoLaunchStatusAsync as getAutoLaunchStatus, loadAutoLaunchStatusAsync } from '~/modules/auto_launch'
|
import { getAutoLaunchStatusAsync as getAutoLaunchStatus, loadAutoLaunchStatusAsync } from '~/modules/auto_launch'
|
||||||
import { loadLanguageAsync } from '~/modules/i18n'
|
|
||||||
import { type NetworkConfig, NetworkingMethod } from '~/types/network'
|
|
||||||
|
|
||||||
const { t, locale } = useI18n()
|
const { t, locale } = useI18n()
|
||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
@@ -26,7 +23,7 @@ useTray(true)
|
|||||||
|
|
||||||
const items = ref([
|
const items = ref([
|
||||||
{
|
{
|
||||||
label: () => t('show_config'),
|
label: () => activeStep.value == "2" ? t('show_config') : t('edit_config'),
|
||||||
icon: 'pi pi-file-edit',
|
icon: 'pi pi-file-edit',
|
||||||
command: async () => {
|
command: async () => {
|
||||||
try {
|
try {
|
||||||
@@ -65,6 +62,27 @@ const toast = useToast()
|
|||||||
|
|
||||||
const networkStore = useNetworkStore()
|
const networkStore = useNetworkStore()
|
||||||
|
|
||||||
|
const curNetworkConfig = computed(() => {
|
||||||
|
if (networkStore.curNetworkId) {
|
||||||
|
// console.log('instanceId', props.instanceId)
|
||||||
|
const c = networkStore.networkList.find(n => n.instance_id === networkStore.curNetworkId)
|
||||||
|
if (c !== undefined)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
return networkStore.curNetwork
|
||||||
|
})
|
||||||
|
|
||||||
|
const curNetworkInst = computed<NetworkTypes.NetworkInstance | null>(() => {
|
||||||
|
let ret = networkStore.networkInstances.find(n => n.instance_id === curNetworkConfig.value.instance_id)
|
||||||
|
console.log('curNetworkInst', ret)
|
||||||
|
if (ret === undefined) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
function addNewNetwork() {
|
function addNewNetwork() {
|
||||||
networkStore.addNewNetwork()
|
networkStore.addNewNetwork()
|
||||||
networkStore.curNetwork = networkStore.lastNetwork
|
networkStore.curNetwork = networkStore.lastNetwork
|
||||||
@@ -82,7 +100,7 @@ networkStore.$subscribe(async () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
async function runNetworkCb(cfg: NetworkConfig, cb: () => void) {
|
async function runNetworkCb(cfg: NetworkTypes.NetworkConfig, cb: () => void) {
|
||||||
if (type() === 'android') {
|
if (type() === 'android') {
|
||||||
await prepareVpnService()
|
await prepareVpnService()
|
||||||
networkStore.clearNetworkInstances()
|
networkStore.clearNetworkInstances()
|
||||||
@@ -106,7 +124,7 @@ async function runNetworkCb(cfg: NetworkConfig, cb: () => void) {
|
|||||||
cb()
|
cb()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stopNetworkCb(cfg: NetworkConfig, cb: () => void) {
|
async function stopNetworkCb(cfg: NetworkTypes.NetworkConfig, cb: () => void) {
|
||||||
// console.log('stopNetworkCb', cfg, cb)
|
// console.log('stopNetworkCb', cfg, cb)
|
||||||
cb()
|
cb()
|
||||||
networkStore.removeNetworkInstance(cfg.instance_id)
|
networkStore.removeNetworkInstance(cfg.instance_id)
|
||||||
@@ -145,7 +163,7 @@ const setting_menu_items = ref([
|
|||||||
label: () => t('exchange_language'),
|
label: () => t('exchange_language'),
|
||||||
icon: 'pi pi-language',
|
icon: 'pi pi-language',
|
||||||
command: async () => {
|
command: async () => {
|
||||||
await loadLanguageAsync((locale.value === 'en' ? 'cn' : 'en'))
|
await I18nUtils.loadLanguageAsync((locale.value === 'en' ? 'cn' : 'en'))
|
||||||
await setTrayMenu([
|
await setTrayMenu([
|
||||||
await MenuItemExit(t('tray.exit')),
|
await MenuItemExit(t('tray.exit')),
|
||||||
await MenuItemShow(t('tray.show')),
|
await MenuItemShow(t('tray.show')),
|
||||||
@@ -181,7 +199,7 @@ const setting_menu_items = ref([
|
|||||||
label: () => t('logging_open_dir'),
|
label: () => t('logging_open_dir'),
|
||||||
icon: 'pi pi-folder-open',
|
icon: 'pi pi-folder-open',
|
||||||
command: async () => {
|
command: async () => {
|
||||||
console.log('open log dir', await appLogDir())
|
// console.log('open log dir', await appLogDir())
|
||||||
await open(await appLogDir())
|
await open(await appLogDir())
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -221,7 +239,7 @@ onBeforeMount(async () => {
|
|||||||
getCurrentWindow().hide()
|
getCurrentWindow().hide()
|
||||||
const autoStartIds = networkStore.autoStartInstIds
|
const autoStartIds = networkStore.autoStartInstIds
|
||||||
for (const id of autoStartIds) {
|
for (const id of autoStartIds) {
|
||||||
const cfg = networkStore.networkList.find(item => item.instance_id === id)
|
const cfg = networkStore.networkList.find((item: NetworkTypes.NetworkConfig) => item.instance_id === id)
|
||||||
if (cfg) {
|
if (cfg) {
|
||||||
networkStore.addNetworkInstance(cfg.instance_id)
|
networkStore.addNetworkInstance(cfg.instance_id)
|
||||||
await runNetworkInstance(cfg)
|
await runNetworkInstance(cfg)
|
||||||
@@ -232,31 +250,34 @@ onBeforeMount(async () => {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (type() === 'android') {
|
if (type() === 'android') {
|
||||||
await initMobileVpnService()
|
try {
|
||||||
|
await initMobileVpnService()
|
||||||
|
console.error("easytier init vpn service done")
|
||||||
|
} catch (e: any) {
|
||||||
|
console.error("easytier init vpn service failed", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function isRunning(id: string) {
|
function isRunning(id: string) {
|
||||||
return networkStore.networkInstanceIds.includes(id)
|
return networkStore.networkInstanceIds.includes(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function saveTomlConfig(tomlConfig: string) {
|
||||||
|
const config = await generateNetworkConfig(tomlConfig)
|
||||||
|
networkStore.replaceCurNetwork(config);
|
||||||
|
toast.add({ severity: 'success', detail: t('config_saved'), life: 3000 })
|
||||||
|
visible.value = false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div id="root" class="flex flex-column">
|
<div id="root" class="flex flex-col">
|
||||||
<Dialog v-model:visible="visible" modal header="Config File" :style="{ width: '70%' }">
|
<ConfigEditDialog v-model:visible="visible" :cur-network="curNetworkConfig" :readonly="activeStep !== '1'"
|
||||||
<Panel>
|
:save-config="saveTomlConfig" :generate-config="parseNetworkConfig" />
|
||||||
<ScrollPanel style="width: 100%; height: 300px">
|
|
||||||
<pre>{{ tomlConfig }}</pre>
|
|
||||||
</ScrollPanel>
|
|
||||||
</Panel>
|
|
||||||
<Divider />
|
|
||||||
<div class="flex gap-2 justify-content-end">
|
|
||||||
<Button type="button" :label="t('close')" @click="visible = false" />
|
|
||||||
</div>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<Dialog v-model:visible="aboutVisible" modal :header="t('about.title')" :style="{ width: '70%' }">
|
<Dialog v-model:visible="aboutVisible" modal :header="t('about.title')" :style="{ width: '70%' }">
|
||||||
<About />
|
<About />
|
||||||
@@ -265,65 +286,55 @@ function isRunning(id: string) {
|
|||||||
<div>
|
<div>
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
<template #start>
|
<template #start>
|
||||||
<div class="flex align-items-center">
|
<div class="flex items-center">
|
||||||
<Button icon="pi pi-plus" severity="primary" :label="t('add_new_network')" @click="addNewNetwork" />
|
<Button icon="pi pi-plus" severity="primary" :label="t('add_new_network')" @click="addNewNetwork" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #center>
|
<template #center>
|
||||||
<div class="min-w-40">
|
<div class="min-w-40">
|
||||||
<Dropdown
|
<Select v-model="networkStore.curNetwork" :options="networkStore.networkList" :highlight-on-select="false"
|
||||||
v-model="networkStore.curNetwork" :options="networkStore.networkList" :highlight-on-select="false"
|
:placeholder="t('select_network')" class="w-full">
|
||||||
:placeholder="t('select_network')" class="w-full"
|
|
||||||
>
|
|
||||||
<template #value="slotProps">
|
<template #value="slotProps">
|
||||||
<div class="flex items-start content-center">
|
<div class="flex items-start content-center">
|
||||||
<div class="mr-3 flex-column">
|
<div class="mr-4 flex-col">
|
||||||
<span>{{ slotProps.value.network_name }}</span>
|
<span>{{ slotProps.value.network_name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<Tag
|
<Tag class="my-auto leading-3" :severity="isRunning(slotProps.value.instance_id) ? 'success' : 'info'"
|
||||||
class="my-auto leading-3" :severity="isRunning(slotProps.value.instance_id) ? 'success' : 'info'"
|
:value="t(isRunning(slotProps.value.instance_id) ? 'network_running' : 'network_stopped')" />
|
||||||
:value="t(isRunning(slotProps.value.instance_id) ? 'network_running' : 'network_stopped')"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #option="slotProps">
|
<template #option="slotProps">
|
||||||
<div class="flex flex-col items-start content-center max-w-full">
|
<div class="flex flex-col items-start content-center max-w-full">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="mr-3">
|
<div class="mr-4">
|
||||||
{{ t('network_name') }}: {{ slotProps.option.network_name }}
|
{{ t('network_name') }}: {{ slotProps.option.network_name }}
|
||||||
</div>
|
</div>
|
||||||
<Tag
|
<Tag class="my-auto leading-3"
|
||||||
class="my-auto leading-3"
|
|
||||||
:severity="isRunning(slotProps.option.instance_id) ? 'success' : 'info'"
|
:severity="isRunning(slotProps.option.instance_id) ? 'success' : 'info'"
|
||||||
:value="t(isRunning(slotProps.option.instance_id) ? 'network_running' : 'network_stopped')"
|
:value="t(isRunning(slotProps.option.instance_id) ? 'network_running' : 'network_stopped')" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div v-if="slotProps.option.networking_method !== NetworkTypes.NetworkingMethod.Standalone"
|
||||||
v-if="slotProps.option.networking_method !== NetworkingMethod.Standalone"
|
class="max-w-full overflow-hidden text-ellipsis">
|
||||||
class="max-w-full overflow-hidden text-ellipsis"
|
{{ slotProps.option.networking_method === NetworkTypes.NetworkingMethod.Manual
|
||||||
>
|
|
||||||
{{ slotProps.option.networking_method === NetworkingMethod.Manual
|
|
||||||
? slotProps.option.peer_urls.join(', ')
|
? slotProps.option.peer_urls.join(', ')
|
||||||
: slotProps.option.public_server_url }}
|
: slotProps.option.public_server_url }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="isRunning(slotProps.option.instance_id) && networkStore.instances[slotProps.option.instance_id].detail && (networkStore.instances[slotProps.option.instance_id].detail?.my_node_info.virtual_ipv4 !== '')"
|
v-if="isRunning(slotProps.option.instance_id) && networkStore.instances[slotProps.option.instance_id].detail && (!!networkStore.instances[slotProps.option.instance_id].detail?.my_node_info.virtual_ipv4)">
|
||||||
>
|
{{
|
||||||
{{ networkStore.instances[slotProps.option.instance_id].detail
|
Utils.ipv4InetToString(networkStore.instances[slotProps.option.instance_id].detail?.my_node_info.virtual_ipv4)
|
||||||
? networkStore.instances[slotProps.option.instance_id].detail?.my_node_info.virtual_ipv4 : '' }}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Dropdown>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #end>
|
<template #end>
|
||||||
<Button
|
<Button icon="pi pi-cog" severity="secondary" aria-haspopup="true" :label="t('settings')"
|
||||||
icon="pi pi-cog" severity="secondary" aria-haspopup="true" :label="t('settings')"
|
aria-controls="overlay_setting_menu" @click="toggle_setting_menu" />
|
||||||
aria-controls="overlay_setting_menu" @click="toggle_setting_menu"
|
|
||||||
/>
|
|
||||||
<TieredMenu id="overlay_setting_menu" ref="setting_menu" :model="setting_menu_items" :popup="true" />
|
<TieredMenu id="overlay_setting_menu" ref="setting_menu" :model="setting_menu_items" :popup="true" />
|
||||||
</template>
|
</template>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
@@ -341,20 +352,16 @@ function isRunning(id: string) {
|
|||||||
</StepList>
|
</StepList>
|
||||||
<StepPanels value="1">
|
<StepPanels value="1">
|
||||||
<StepPanel v-slot="{ activateCallback = (s: string) => { } } = {}" value="1">
|
<StepPanel v-slot="{ activateCallback = (s: string) => { } } = {}" value="1">
|
||||||
<Config
|
<Config :instance-id="networkStore.curNetworkId" :config-invalid="messageBarSeverity !== Severity.None"
|
||||||
:instance-id="networkStore.curNetworkId" :config-invalid="messageBarSeverity !== Severity.None"
|
:cur-network="curNetworkConfig" @run-network="runNetworkCb($event, () => activateCallback('2'))" />
|
||||||
@run-network="runNetworkCb($event, () => activateCallback('2'))"
|
|
||||||
/>
|
|
||||||
</StepPanel>
|
</StepPanel>
|
||||||
<StepPanel v-slot="{ activateCallback = (s: string) => { } } = {}" value="2">
|
<StepPanel v-slot="{ activateCallback = (s: string) => { } } = {}" value="2">
|
||||||
<div class="flex flex-column">
|
<div class="flex flex-col">
|
||||||
<Status :instance-id="networkStore.curNetworkId" />
|
<Status :cur-network-inst="curNetworkInst" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex pt-4 justify-content-center">
|
<div class="flex pt-6 justify-center">
|
||||||
<Button
|
<Button :label="t('stop_network')" severity="danger" icon="pi pi-arrow-left"
|
||||||
:label="t('stop_network')" severity="danger" icon="pi pi-arrow-left"
|
@click="stopNetworkCb(networkStore.curNetwork, () => activateCallback('1'))" />
|
||||||
@click="stopNetworkCb(networkStore.curNetwork, () => activateCallback('1'))"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</StepPanel>
|
</StepPanel>
|
||||||
</StepPanels>
|
</StepPanels>
|
||||||
|
@@ -1,26 +1,25 @@
|
|||||||
import type { NetworkConfig, NetworkInstance, NetworkInstanceRunningInfo } from '~/types/network'
|
import { NetworkTypes } from 'easytier-frontend-lib'
|
||||||
import { DEFAULT_NETWORK_CONFIG } from '~/types/network'
|
|
||||||
|
|
||||||
export const useNetworkStore = defineStore('networkStore', {
|
export const useNetworkStore = defineStore('networkStore', {
|
||||||
state: () => {
|
state: () => {
|
||||||
const networkList = [DEFAULT_NETWORK_CONFIG()]
|
const networkList = [NetworkTypes.DEFAULT_NETWORK_CONFIG()]
|
||||||
return {
|
return {
|
||||||
// for initially empty lists
|
// for initially empty lists
|
||||||
networkList: networkList as NetworkConfig[],
|
networkList: networkList as NetworkTypes.NetworkConfig[],
|
||||||
// for data that is not yet loaded
|
// for data that is not yet loaded
|
||||||
curNetwork: networkList[0],
|
curNetwork: networkList[0],
|
||||||
|
|
||||||
// uuid -> instance
|
// uuid -> instance
|
||||||
instances: {} as Record<string, NetworkInstance>,
|
instances: {} as Record<string, NetworkTypes.NetworkInstance>,
|
||||||
|
|
||||||
networkInfos: {} as Record<string, NetworkInstanceRunningInfo>,
|
networkInfos: {} as Record<string, NetworkTypes.NetworkInstanceRunningInfo>,
|
||||||
|
|
||||||
autoStartInstIds: [] as string[],
|
autoStartInstIds: [] as string[],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
lastNetwork(): NetworkConfig {
|
lastNetwork(): NetworkTypes.NetworkConfig {
|
||||||
return this.networkList[this.networkList.length - 1]
|
return this.networkList[this.networkList.length - 1]
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -28,7 +27,7 @@ export const useNetworkStore = defineStore('networkStore', {
|
|||||||
return this.curNetwork.instance_id
|
return this.curNetwork.instance_id
|
||||||
},
|
},
|
||||||
|
|
||||||
networkInstances(): Array<NetworkInstance> {
|
networkInstances(): Array<NetworkTypes.NetworkInstance> {
|
||||||
return Object.values(this.instances)
|
return Object.values(this.instances)
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ export const useNetworkStore = defineStore('networkStore', {
|
|||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
addNewNetwork() {
|
addNewNetwork() {
|
||||||
this.networkList.push(DEFAULT_NETWORK_CONFIG())
|
this.networkList.push(NetworkTypes.DEFAULT_NETWORK_CONFIG())
|
||||||
},
|
},
|
||||||
|
|
||||||
delCurNetwork() {
|
delCurNetwork() {
|
||||||
@@ -49,6 +48,12 @@ export const useNetworkStore = defineStore('networkStore', {
|
|||||||
this.curNetwork = this.networkList[nextCurNetworkIdx]
|
this.curNetwork = this.networkList[nextCurNetworkIdx]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
replaceCurNetwork(cfg: NetworkTypes.NetworkConfig) {
|
||||||
|
const curNetworkIdx = this.networkList.indexOf(this.curNetwork)
|
||||||
|
this.networkList[curNetworkIdx] = cfg
|
||||||
|
this.curNetwork = cfg
|
||||||
|
},
|
||||||
|
|
||||||
removeNetworkInstance(instanceId: string) {
|
removeNetworkInstance(instanceId: string) {
|
||||||
delete this.instances[instanceId]
|
delete this.instances[instanceId]
|
||||||
},
|
},
|
||||||
@@ -66,7 +71,7 @@ export const useNetworkStore = defineStore('networkStore', {
|
|||||||
this.instances = {}
|
this.instances = {}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateWithNetworkInfos(networkInfos: Record<string, NetworkInstanceRunningInfo>) {
|
updateWithNetworkInfos(networkInfos: Record<string, NetworkTypes.NetworkInstanceRunningInfo>) {
|
||||||
this.networkInfos = networkInfos
|
this.networkInfos = networkInfos
|
||||||
for (const [instanceId, info] of Object.entries(networkInfos)) {
|
for (const [instanceId, info] of Object.entries(networkInfos)) {
|
||||||
if (this.instances[instanceId] === undefined)
|
if (this.instances[instanceId] === undefined)
|
||||||
@@ -79,17 +84,17 @@ export const useNetworkStore = defineStore('networkStore', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
loadFromLocalStorage() {
|
loadFromLocalStorage() {
|
||||||
let networkList: NetworkConfig[]
|
let networkList: NetworkTypes.NetworkConfig[]
|
||||||
|
|
||||||
// if localStorage default is [{}], instanceId will be undefined
|
// if localStorage default is [{}], instanceId will be undefined
|
||||||
networkList = JSON.parse(localStorage.getItem('networkList') || '[]')
|
networkList = JSON.parse(localStorage.getItem('networkList') || '[]')
|
||||||
networkList = networkList.map((cfg) => {
|
networkList = networkList.map((cfg) => {
|
||||||
return { ...DEFAULT_NETWORK_CONFIG(), ...cfg } as NetworkConfig
|
return { ...NetworkTypes.DEFAULT_NETWORK_CONFIG(), ...cfg } as NetworkTypes.NetworkConfig
|
||||||
})
|
})
|
||||||
|
|
||||||
// prevent a empty list from localStorage, should not happen
|
// prevent a empty list from localStorage, should not happen
|
||||||
if (networkList.length === 0)
|
if (networkList.length === 0)
|
||||||
networkList = [DEFAULT_NETWORK_CONFIG()]
|
networkList = [NetworkTypes.DEFAULT_NETWORK_CONFIG()]
|
||||||
|
|
||||||
this.networkList = networkList
|
this.networkList = networkList
|
||||||
this.curNetwork = this.networkList[0]
|
this.curNetwork = this.networkList[0]
|
||||||
@@ -129,6 +134,13 @@ export const useNetworkStore = defineStore('networkStore', {
|
|||||||
}
|
}
|
||||||
this.saveAutoStartInstIdsToLocalStorage()
|
this.saveAutoStartInstIdsToLocalStorage()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isNoTunEnabled(instanceId: string): boolean {
|
||||||
|
const cfg = this.networkList.find((cfg) => cfg.instance_id === instanceId)
|
||||||
|
if (!cfg)
|
||||||
|
return false
|
||||||
|
return cfg.no_tun ?? false
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|
||||||
color: #0f0f0f;
|
|
||||||
|
|
||||||
font-synthesis: none;
|
font-synthesis: none;
|
||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
@@ -45,3 +43,11 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: #0000005d;
|
background-color: #0000005d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.p-password {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-password>input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
@@ -1,9 +1,11 @@
|
|||||||
|
import { networkInterfaces } from 'node:os'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
import process from 'node:process'
|
import process from 'node:process'
|
||||||
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
|
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
|
||||||
import { PrimeVueResolver } from '@primevue/auto-import-resolver'
|
import { PrimeVueResolver } from '@primevue/auto-import-resolver'
|
||||||
import Vue from '@vitejs/plugin-vue'
|
import Vue from '@vitejs/plugin-vue'
|
||||||
import { internalIpV4Sync } from 'internal-ip'
|
import { containsCidr, parseCidr } from 'cidr-tools'
|
||||||
|
import { gateway4sync } from 'default-gateway'
|
||||||
import AutoImport from 'unplugin-auto-import/vite'
|
import AutoImport from 'unplugin-auto-import/vite'
|
||||||
import Components from 'unplugin-vue-components/vite'
|
import Components from 'unplugin-vue-components/vite'
|
||||||
import VueMacros from 'unplugin-vue-macros/vite'
|
import VueMacros from 'unplugin-vue-macros/vite'
|
||||||
@@ -13,6 +15,20 @@ import { defineConfig } from 'vite'
|
|||||||
import VueDevTools from 'vite-plugin-vue-devtools'
|
import VueDevTools from 'vite-plugin-vue-devtools'
|
||||||
import Layouts from 'vite-plugin-vue-layouts'
|
import Layouts from 'vite-plugin-vue-layouts'
|
||||||
|
|
||||||
|
function findIp(gateway: string) {
|
||||||
|
// Look for the matching interface in all local interfaces
|
||||||
|
console.log('gateway', gateway)
|
||||||
|
for (const addresses of Object.values(networkInterfaces())) {
|
||||||
|
if (!addresses)
|
||||||
|
continue
|
||||||
|
for (const { cidr } of addresses) {
|
||||||
|
if (cidr && containsCidr(cidr, gateway)) {
|
||||||
|
return parseCidr(cidr).ip
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const host = process.env.TAURI_DEV_HOST
|
const host = process.env.TAURI_DEV_HOST
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
@@ -99,10 +115,10 @@ export default defineConfig(async () => ({
|
|||||||
},
|
},
|
||||||
hmr: host
|
hmr: host
|
||||||
? {
|
? {
|
||||||
protocol: 'ws',
|
protocol: 'ws',
|
||||||
host: internalIpV4Sync(),
|
host: findIp(gateway4sync().gateway),
|
||||||
port: 1430,
|
port: 1430,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|