后 续有打算 用 netfilter的 开源替 代品 Divert重 新 实现,但 是 两者的 api完全 不同 ,暂时没 时间搞,所以 先 将 就用这个了
为什么不
(说的就是你 v2ray)
就,
cgo/include
,nftapi.dll
cgo/include
go build -o nft.exe
注意 ,该项目 依 赖 cgo ,因 此需要 CGO_ENABLE=1
,该选项默认启用 ,但 是 如果你之前 改 成 了 禁 用 ,就需要 手 动启用 才能 正常 编译
因 为启用 cgo会 链接 libc ,导致没 法 一处编译多处运行,所以 我 一般 都 禁 用 了 的
启动时需netfilter2.sys
nfapi.dll
这两个文
f
: filter process name or directory- 如果
是 指定 的 目 录,会 自 动找到该目录下所有 .exe
文 件 并加到 过滤规则里 - 如果
是 进程名 ,则会直接 使用 该名字 。指定 进程名 的 情 况下可 以指定 多 次
- 如果
-c
: config file- 标准
的 wireguard的 配置 文 件 ,需要 以下 字 段 :- Peer
- PublicKey
- Endpoint
- MTU (optional)
- Interface
- PrivateKey
- PersistentKeepalive (optional)
- Peer
- 标准
# with log
.\nft.exe -f r5apex.exe -c .\nft.conf
# without log
.\nft.exe -f r5apex.exe -c .\nft.conf >nul 2>nul