<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[yezicheng2011]]></title><description><![CDATA[yezicheng2011]]></description><link>https://yezicheng2011.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sun, 01 Nov 2026 20:01:35 GMT</lastBuildDate><atom:link href="https://yezicheng2011.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[MockMini: building a small, fuzzed proxy core for macOS in ~2,600 lines]]></title><description><![CDATA[MockMini is a small, auditable proxy core in C and Swift. It speaks Shadowsocks AEAD, VMess, Trojan and VLESS over TCP, TLS or WebSocket, on top of its own…]]></description><link>https://yezicheng2011.hashnode.dev/mockmini-building-a-small-fuzzed-proxy-core-for-macos-in-2-600-lines</link><guid isPermaLink="true">https://yezicheng2011.hashnode.dev/mockmini-building-a-small-fuzzed-proxy-core-for-macos-in-2-600-lines</guid><category><![CDATA[Open Source]]></category><category><![CDATA[macOS]]></category><category><![CDATA[networking]]></category><category><![CDATA[Swift]]></category><dc:creator><![CDATA[叶子诚]]></dc:creator><pubDate>Sat, 24 Oct 2026 03:52:22 GMT</pubDate><content:encoded><![CDATA[<p>MockMini is a small, auditable proxy core in C and Swift. It speaks <strong>Shadowsocks AEAD, VMess, Trojan and VLESS</strong> over TCP, TLS or WebSocket, on top of its own bounded userspace TCP/IP endpoint. It is about 2,600 lines, fuzzed, and licensed under Apache-2.0. v0.1.0 is the first tagged release.</p>
<p>Repo: <a href="https://github.com/yezicheng2011/mockmini">https://github.com/yezicheng2011/mockmini</a> · Site: <a href="https://mockmini.com/">https://mockmini.com/</a></p>
<h2>Why write one from scratch</h2>
<p>Most proxy apps ship a large third-party kernel such as mihomo, Clash or sing-box, often with a Go runtime. MockMini is deliberately different: no vendored proxy kernel, no third-party TCP/IP stack, no Go runtime, and it is not based on mihomo, Clash, sing-box, gVisor or WireGuard. The goal is a core small enough that one person can read and review all of it.</p>
<h2>Protocols and transports</h2>
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody><tr>
<td>Protocols</td>
<td>Shadowsocks AEAD (aes-128-gcm, aes-256-gcm, chacha20-ietf-poly1305), VMess (legacy + AEAD), Trojan (TCP and UDP), VLESS (TCP and UDP)</td>
</tr>
<tr>
<td>Transports</td>
<td>TCP, TLS, WebSocket (RFC 6455)</td>
</tr>
<tr>
<td>Packet engine</td>
<td>IPv4/IPv6 TCP + UDP, fragment reassembly, up to 1024 flows; portable C</td>
</tr>
<tr>
<td>Platforms</td>
<td>macOS 13+ (Network.framework, CryptoKit); the packet engine builds anywhere</td>
</tr>
</tbody></table>
<h2>A layered design</h2>
<p>Each connection is a stack of independent layers: protocol (<code>ProxySession</code>), framing (raw or WebSocket), security (none or system TLS) and dial (TCP or UDP). A new protocol is a new <code>ProxySession</code>; a new transport is a new plan case. The portable core also builds on Linux with swift-crypto.</p>
<h2>Embedding</h2>
<pre><code class="language-c">#include "wlp.h"

wlp_callbacks cb = { on_connect, on_data, on_close, on_packet, on_eof };
wlp_engine *engine = wlp_new(cb, ctx);

wlp_tick(engine, now_ms());                 // then at least every 100 ms
wlp_input(engine, ip_packet, length);       // raw IP packet from your tun device
wlp_remote_open(engine, flow);
wlp_remote_data(engine, flow, bytes, n);    // upstream -&gt; client
</code></pre>
<p>Or add it with Swift Package Manager:</p>
<pre><code class="language-swift">.package(url: "https://github.com/yezicheng2011/mockmini.git", branch: "main")
// products: "MockMiniPacket" (C packet engine), "MockMiniVPN" (protocols and transports)
</code></pre>
<h2>Testing</h2>
<p>A stateful, checksum-aware fuzzer builds valid traffic so it reaches the TCP state machine, reassembly, fragment cache and flow limit, with about 99% line coverage of the packet engine, and checks byte-exact in-order delivery on every run. CI runs it on Linux (gcc and clang) under ASan/UBSan, as a libFuzzer smoke test, and on macOS with the Swift protocol tests. On macOS CI, a pinned, checksum-verified Xray release serves every supported protocol on loopback and MockMini pushes verified TCP streams and UDP datagrams through each one.</p>
<h2>Known limits (honest)</h2>
<p>The packet engine is a small TCP/UDP proxy endpoint, not a general IP stack: up to 1024 concurrent flows; MSS and window scaling only (no SACK, timestamps or ECN); no ICMP or PMTUD. There is no gRPC transport, no Reality or uTLS fingerprinting, and no VLESS flow control yet. Throughput is still behind mature kernels; that gap is expected while MockMini stays original and small.</p>
<h2>Try it</h2>
<p>MockMini is young and actively developed. Reviews, issues and pull requests are very welcome: <a href="https://github.com/yezicheng2011/mockmini">https://github.com/yezicheng2011/mockmini</a></p>
]]></content:encoded></item></channel></rss>