Releases: fscarmen/cfnat
Release list
v0.0.14
v0.0.14 fix: ignore SIGHUP to prevent unexpected termination on daemon reload
- register SIG_IGN for SIGHUP alongside existing SIGPIPE handling
- prevent process stop when OpenWrt service reload or terminal disconnect triggers SIGHUP
v0.0.14 fix: 忽略 SIGHUP 信号,防止守护进程重载时意外退出
- 在已有 SIGPIPE 忽略基础上增加 SIGHUP 信号忽略注册
- 避免 OpenWrt 服务重载或终端断开时 SIGHUP 导致进程退出
v0.0.13
v0.0.13 feat: add DNS resolver system with Fake-IP bypass, TLS SNI support, and connection tracking
- add complete DNS resolver system: Fake-IP detection (198.18.0.0/15), DoH via curl (AliDNS, Cloudflare), UDP DNS (223.5.5.5, 119.29.29.29, 1.1.1.1, 8.8.8.8), 12 hardcoded Baidu proxy fallback IPs
- add baidu_resolver config field with custom resolver spec support (doh://IP/path?host=HOST, udp://IP)
- enhance resolve_host_ips() with Fake-IP detection and automatic fallback chain
- add TLS SNI support: build_tls_client_hello, tls_probe_host, read_tls_client_hello, parse_tls_sni
- add kqueue EV_CLEAR flag for macOS (edge-triggered, matching Linux EPOLLET)
- add connection tracking: conn_id, client_addr in ConnCtx, global atomic g_conn_seq counter
- refactor Baidu proxy pool: build_baidu_pool_from_ips(), carrier_init_baidu_pool(), carrier_check_baidu_ipv6_support()
- add SNI-aware IP selection: carrier_tls_sni_check_ip(), carrier_choose_ip_for_sni()
- add TLS-aware health check: port 443 uses tls_probe() instead of http_probe()
- enhance connection accept logging with sequential conn_id and client_addr
v0.0.13 feat: 新增 DNS 解析系统支持 Fake-IP 绕过、TLS SNI 支持与连接追踪
- 新增完整 DNS 解析系统:Fake-IP 检测 (198.18.0.0/15)、DoH via curl (AliDNS、Cloudflare)、UDP DNS (223.5.5.5、119.29.29.29、1.1.1.1、8.8.8.8)、12 个硬编码百度代理备用 IP
- 新增 baidu_resolver 配置字段,支持自定义解析器规格 (doh://IP/path?host=HOST, udp://IP)
- 增强 resolve_host_ips(),支持 Fake-IP 检测与自动回退链
- 新增 TLS SNI 支持:build_tls_client_hello、tls_probe_host、read_tls_client_hello、parse_tls_sni
- macOS kqueue 增加 EV_CLEAR 标志 (边缘触发,与 Linux EPOLLET 一致)
- 新增连接追踪:ConnCtx 增加 conn_id、client_addr,全局原子计数器 g_conn_seq
- 重构百度代理池:build_baidu_pool_from_ips()、carrier_init_baidu_pool()、carrier_check_baidu_ipv6_support()
- 新增 SNI 感知 IP 选择:carrier_tls_sni_check_ip()、carrier_choose_ip_for_sni()
- 新增 TLS 感知健康检查:443 端口使用 tls_probe() 替代 http_probe()
- 增强连接接收日志,包含顺序 conn_id 与 client_addr
v0.0.12
v0.0.12 feat: add support for interface binding, IPv6, TLS SNI, and connection tracking
- add -bind-if interface binding support with cross-platform implementation
- add IPv6 tool functions: rand_u64, ipv6_cidr_sample, is_ip_literal, format_host_literal, format_addr_port
- add send_all_timeout for reliable timed data transmission
- add TLS SNI feature: ClientHello construction, SNI parsing, tls_probe, recv_more_timeout
- add conn_msg connection-level logging and extend ConnCtx with client_addr, runtime, conn_id
- upgrade connection_thread with SNI-based routing, send_all_timeout, fast-fail detection
- enhance scan_worker HTTP probe with alternating Host headers
- make carrier_probe_and_check TLS-aware (tls_probe for port 443, http_probe otherwise)
- add carrier_tls_sni_check_ip and carrier_choose_ip_for_sni for SNI-aware IP selection
- add carrier_note_connection_result for fast-disconnect tracking (<3000ms)
- update carrier_accept_thread to populate client_addr, runtime, conn_id
v0.0.12 feat: 新增接口绑定、IPv6、TLS SNI、连接追踪功能
- 新增 -bind-if 出站接口绑定功能,跨平台实现
- 新增 IPv6 工具函数:rand_u64、ipv6_cidr_sample、is_ip_literal、format_host_literal、format_addr_port
- 新增 send_all_timeout 可靠超时发送
- 新增 TLS SNI 功能:ClientHello 构造、SNI 解析、tls_probe、recv_more_timeout
- 新增 conn_msg 连接级日志,扩展 ConnCtx 增加 client_addr、runtime、conn_id 字段
- 升级 connection_thread:支持 SNI 路由、send_all_timeout、快速断开检测
- 增强 scan_worker HTTP 探测:交替使用不同 Host 头
- carrier_probe_and_check 支持 TLS 感知探测(443 端口使用 tls_probe)
- 新增 carrier_tls_sni_check_ip 和 carrier_choose_ip_for_sni SNI 路由
- 新增 carrier_note_connection_result 快速断开追踪(<3000ms)
- 更新 carrier_accept_thread 填充 client_addr、runtime、conn_id
v0.0.11
v0.0.11 fix: improve EventLoop header receiving, colo selection, and startup retry on empty scan
- add platform guard and fd validation to
recv_headers_ev, fallback to blocking read on unsupported platforms - fix colo selection to use
<=latency comparison so same-latency colos are also recorded - retry scan with 3s delay when carrier mode finds no candidates or health checks all fail
- free stale IP list and reload IP range before each retry
- skip candidate cache print in single-scan mode when result set is empty
v0.0.11 fix: 改进 EventLoop 响应头接收、colo 选择逻辑及空扫描启动重试
recv_headers_ev增加平台守卫和 fd 校验,不支持的平台回退阻塞读取- 修复 colo 选择条件,使用
<=比较延迟,同等延迟的 colo 也能被记录 - 监听模式扫描不到候选或健康检查全部失败时,等待 3 秒后重试
- 每次重试前释放旧 IP 列表并重新加载 IP 段
- 单次扫描模式结果为空时跳过候选池打印
v0.0.10
v0.0.10 perf: rewrite scan engine with EventLoop, CIDR lazy expansion, and Keep-Alive
- replace select() with epoll/kqueue/select conditional compilation for I/O
- replace BatchIterator with CidrList (prefix-sum + binary search, O(log n))
- reuse HTTP Keep-Alive connections across probes, reconnect on disconnect
- add EWMA scoring (α=0.125) with jitter smoothing and exponential fail penalty
- add 5-second proxy node selection cache to BaiduProxyPool
v0.0.10 perf: 重写扫描引擎,引入 EventLoop、CIDR 惰性展开与 Keep-Alive
- select() 替换为 epoll/kqueue/select 条件编译事件循环
- BatchIterator 替换为 CidrList(前缀和 + 二分查找,O(log n))
- 复用 HTTP Keep-Alive 连接探测,断连自动重连
- 新增 EWMA 评分(α=0.125),含抖动平滑与指数级失败惩罚
- 百度前置代理池新增 5 秒节点选择缓存
v0.0.9
refactor: release v0.0.9 — EventLoop abstraction, BatchIterator, cache-valid optimization, and race fix
- add cross-platform EventLoop I/O framework (epoll / kqueue / IOCP) replacing select()
- add BatchIterator for lazy CIDR expansion (1024 IPs per batch), reducing memory usage
- add cache_valid flag to CandidatePool, skipping redundant health checks on known-good IPs
- add recv_timeout() with configurable timeout, replace blocking recv in pipe_worker and connection_thread
- use Linux splice() for zero-copy forwarding in pipe_worker; unify all platforms on recv_timeout(300s)
- fix race between carrier_rescan_and_select_ip free(items) and carrier_choose_ip_for_connection items traversal by protecting with candidates.mu
- remove global candidate state (g_candidates, g_current_ip, etc.) in favor of per-pool management
- add version string (CFNAT_VERSION "0.0.9") and -V / -version flag
refactor: 发布 v0.0.9 — 引入 EventLoop 抽象层、BatchIterator、缓存有效优化与竞态修复
- 新增跨平台 EventLoop 事件驱动 I/O 框架(epoll / kqueue / IOCP),替代 select() 模型
- 新增 BatchIterator 惰性 CIDR 批量迭代(每批 1024 个 IP),降低内存占用
- CandidatePool 新增 cache_valid 标志,健康 IP 跳过冗余检测,直接复用
- 新增 recv_timeout() 可配置超时接收,替换 pipe_worker 与 connection_thread 中的阻塞 recv
- pipe_worker Linux 平台使用 splice() 零拷贝转发;全平台统一 recv_timeout(300s)
- 修复 carrier_rescan_and_select_ip 中 free(items) 与 carrier_choose_ip_for_connection 遍历 items 的竞态,使用 candidates.mu 互斥锁保护
- 移除全局候选状态(g_candidates、g_current_ip 等),状态归入 CandidatePool 管理
- 新增版本号(CFNAT_VERSION "0.0.9")及 -V / -version 命令行参数
v0.0.8
fix: v0.0.8 align health check timeout with user-configured delay_ms
- replace hardcoded 2000ms timeout in
health_check_ipandcarrier_health_check_ipwithg_cfg.delay_ms - fix mismatch where a low
-delay(e.g. 500ms) kept an IP alive in health checks while client connections timed out against the same IP - apply the fix to all 8 dial + probe calls across Baidu and Carrier health check paths
fix: v0.0.8 健康检查超时改为与用户设置的 -delay 一致
- 将
health_check_ip和carrier_health_check_ip中硬编码的 2000ms 超时替换为g_cfg.delay_ms - 修复当
-delay设为较低值(如 500ms)时,健康检查用 2000ms 判定 IP 可用,但客户端连接用 500ms 超时而连不上的问题 - 同步修复百度直连模式和运营商模式共 8 处 dial + probe 调用
v0.0.7
feat: release v0.0.7 with dual listening mode (direct + baidu proxy)
- support -direct-listen and -baidu-listen parameters
- add mixed mode when direct-listen and baidu-listen are the same address
- refactor carrier listening logic and health check for better clarity and stability
- simplify Config structure and remove legacy multi-carrier resolver code
- improve connection selection and fallback between direct and baidu proxy
feat: 发布 v0.0.7,支持双监听模式(直连 + 百度前置代理)
- 支持 -direct-listen 和 -baidu-listen 参数
- 新增两个监听地址相同时的 mixed 混合模式
- 重构运营商监听逻辑与健康检查,提升代码清晰度和稳定性
- 精简 Config 结构体,移除遗留的多运营商解析代码
- 优化直连与百度前置代理的连接选择和回退机制
v0.0.6
feat: release v0.0.6 with carrier listen priority over Baidu proxy config
- force
-baidu-proxy=trueautomatically when-carrier-listensis configured - make carrier split-port mode take priority over explicit
-baidu-proxy=false - add startup notice when carrier listen mode enables Baidu proxy automatically
- simplify carrier listen examples by removing the need to set
-baidu-proxy=true - update README to document
-carrier-listenspriority and automatic Baidu proxy behavior
feat: 发布 v0.0.6,让运营商监听优先于百度代理配置
- 配置
-carrier-listens时自动强制启用-baidu-proxy=true - 让运营商分端口模式优先于显式设置的
-baidu-proxy=false - 添加启动提示,说明运营商监听模式会自动启用百度前置代理
- 简化运营商分池示例,不再需要手动设置
-baidu-proxy=true - 更新 README,说明
-carrier-listens的优先级和自动启用百度前置代理行为
v0.0.5
feat: release v0.0.5 with unified C source and simplified cache startup
- merge Linux, macOS, and Windows implementations into cfnat.c
- replace split source files with platform-specific conditional compilation
- keep Windows support for Winsock2, WinINet, DNS API, and Unicode console output
- keep Linux and macOS support for POSIX sockets, pthreads, and built-in DNS TXT lookup
- update GitHub Actions to build all platforms from cfnat.c
- update release packaging to include the unified source file
- refresh README with single-source build commands and platform notes
feat: 发布 v0.0.5,合并 C 源码并简化缓存启动逻辑
- 将 Linux、macOS、Windows 三个平台实现合并到 cfnat.c
- 使用平台条件编译替代分裂源码维护
- 保留 Windows 的 Winsock2、WinINet、DNS API 和 Unicode 控制台输出支持
- 保留 Linux 与 macOS 的 POSIX socket、pthread 和内置 DNS TXT 查询支持
- 更新 GitHub Actions,所有平台统一从 cfnat.c 构建
- 更新 release 打包,只附带统一后的源码文件
- 更新 README,补充单源码构建命令和平台说明