@aisymbiote/ifly
v0.1.9
Published
Dual inbound chain proxy CLI for macOS arm64
Readme
ifly
ifly 是一个给本机程序提供固定本地代理入口的双入口链式代理。
它默认提供两个本地入口:
- HTTP:
127.0.0.1:8341 - SOCKS5:
127.0.0.1:8342
也支持把这两个入口配置成同一个端口,让一个端口同时接受 HTTP 和 SOCKS5。
适合这类场景:
- 你想让某个本机程序始终走一个固定、可控、只影响它自身的代理入口
- 你平时会开 Surge / Clash / Stash / sing-box 等本地代理客户端,但不想把远端节点直接塞进客户端里
- 你希望本地代理客户端可用时走完整链路,不可用时还能自动回退继续工作
安装
npm install -g @aisymbiote/ifly当前 npm 包首发支持:
- macOS
- Apple Silicon(
darwin-arm64)
安装后默认配置文件路径:
~/ifly/config.yaml如果安装脚本没有自动生成配置模板,可以手动执行:
ifly init快速开始
1)准备配置
默认配置文件:
~/ifly/config.yaml你至少需要配置好 local_proxies 或 remote_proxies 中的至少一项。
- 只配
local_proxies:ifly会走inbounds -> local_proxies -> target - 只配
remote_proxies:ifly会走inbounds -> remote_proxies -> target - 两者都配:优先走
inbounds -> local_proxies -> remote_proxies -> target
如果上游代理不需要认证,把模板里的认证字段改成:
username: ""
password: ""如果你平时会开 Surge / Clash / Stash / sing-box,也建议把它们的本地监听端口填进 local_proxies。
如果你想只暴露一个本地入口,也可以把 inbounds 里的 http-in.port 和 socks-in.port 都设成同一个值,比如都设成 8341。
模板示例见:
examples/config.example.yaml最小配置可以参考这三种:
- 只用本地代理客户端:
inbounds:
- name: http-in
protocol: http
host: 127.0.0.1
port: 8341
- name: socks-in
protocol: socks5
host: 127.0.0.1
port: 8342
local_proxies:
- name: local-http
protocol: http
host: 127.0.0.1
port: 6152
priority: 0- 只用远端专用代理:
inbounds:
- name: http-in
protocol: http
host: 127.0.0.1
port: 8341
remote_proxies:
- name: remote-http
protocol: http
host: 1.2.3.4
port: 50100
username: ""
password: ""
priority: 0- 本地代理客户端 + 远端专用代理:
inbounds:
- name: http-in
protocol: http
host: 127.0.0.1
port: 8341
local_proxies:
- name: local-http
protocol: http
host: 127.0.0.1
port: 6152
priority: 0
remote_proxies:
- name: remote-http
protocol: http
host: 1.2.3.4
port: 50100
username: ""
password: ""
priority: 02)前台运行
ifly dev如果你已经有一份配置文件,想导入为默认配置再运行:
ifly dev \
-config /path/to/config.yaml3)验证是否可用
HTTP:
curl -x 'http://127.0.0.1:8341' \
'https://checkip.amazonaws.com'SOCKS5:
curl -x 'socks5h://127.0.0.1:8342' \
'https://checkip.amazonaws.com'常用命令
初始化默认配置:
ifly init导入一份配置到默认位置:
ifly init \
-config /path/to/config.yaml前台运行:
ifly dev安装成 macOS 用户级常驻服务:
ifly install \
-config /path/to/config.yaml查看状态:
ifly status实时查看事件日志:
ifly log重启常驻服务:
ifly restart卸载常驻服务:
ifly uninstall文件位置
默认配置:
~/ifly/config.yamlLaunchAgent plist:
~/Library/LaunchAgents/com.ifly.plist日志:
~/ifly/logs/ifly.log
~/ifly/logs/ifly.err.log运行状态与事件订阅:
~/ifly/state/status.json
~/ifly/state/events.sock常见提示
init -config PATH和dev -config PATH都会把那份配置导入到默认配置路径,不是临时切换配置文件。ifly启动时只做配置语法/结构校验;像your-port这种不是合法端口号的值仍然会失败。- 测试 SOCKS5 时建议用
socks5h://,让域名通过 SOCKS5 传递,而不是由curl在本地先解析。 - 对
localhost、127.0.0.1和明确的私网/链路本地 IP 目标,ifly会自动直连,不再送进远端代理链。
更多文档
- 想看链路选择、健康检查、fallback 回切、状态语义等技术细节:
TECHNICAL_SUMMARY.md - 想看演进历史:
DEVELOPMENT_HISTORY.md - 想看原始设计/方案材料:
双入口代理链自动选择方案.md - 想看项目动机背景:
ifly.md
