PinkD / corplink-rs

使用 rust 实现的飞连客户端
GNU General Public License v2.0
229 stars 30 forks source link

MacOS启动corplink-rs失败,Failed to create TUN device: Interface name must be utun[0-9]* #13

Closed LionheartLann closed 1 year ago

LionheartLann commented 1 year ago

复现流程

安装过程手动编译运行

git clone https://github.com/PinkD/corplink-rs --depth 1
cd corplink-rs
cargo build --release
# install corplink-rs to your PATH
mv target/release/corplink-rs **/usr/local/bin/**
cd ..
git clone https://github.com/PinkD/wireguard-go --depth 1
cd wireguard-go
# you can build with `go build` on windows maunally
make
# install wg-corplink to your PATH
# your can also install it to somewhere else and use wg_binary config to tell corplink-rs where it is
mv wireguard-go **/usr/local/bin/wg-corplink**

注:由于macOS权限限制(terminal已开启full disk access),mv目录由 /usr/bin/ 改为 /usr/local/bin/

sudo mv target/release/corplink-rs /usr/bin/                                                                                           
Password:
mv: fastcopy: open() failed (to): /usr/bin/corplink-rs: Operation not permitted

预期现象

corplink-rs config.json正常启动

实际现象

corplink-rs config.json 无法启动,提示 /var/run/wireguard/corplink.sock not ready

环境信息

corplink-rs 版本:3.5 macOS 13.3.1 (a) (22E772610a) chip Apple M2 Pro

uname -v
Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:58 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6020

日志输出

corplink-rs config.json

$ corplink-rs config.json     

running corplink-rs@0.3.5
running corplink-rs@0.3.5
cookie file is: corplink_cookies.json
try to connect
found set-cookie in header, saving cookie
found 4 vpn(s), details: ["GZ-01", "SH-01", "BJ-02", "BJ-01"]
check if udp vpn XXX:443 is available
available
try to get wg conf from remote
2fa code generated: 861248, 3 seconds left
start wg-corplink for corplink
launch wg-corplink with env: {"CORPLINK_PROTOCOL_VERSION": "v2"}
socket file /var/run/wireguard/corplink.sock not ready, sleep 1s
ERROR: (corplink) 2023/07/26 13:28:57 Failed to create TUN device: Interface name must be utun[0-9]*

socket file /var/run/wireguard/corplink.sock not ready, sleep 1s
socket file /var/run/wireguard/corplink.sock not ready, sleep 1s
try to connect unix sock: /var/run/wireguard/corplink.sock
failed to config interface with uapi for corplink: No such file or directory (os error 2)

PS:

wg-quick@corplink.service 未运行

sudo launchctl list | grep wg-quick@corplink.service
PinkD commented 1 year ago

将配置文件中的 interface_name 改为符合 mac 规范的格式,即正则 utun[0-9]* ,比如 utun114514

LionheartLann commented 1 year ago

感谢解答,已解决