2051 words
10 minutes

My 256MB Router Can’t Run OpenClash, So I Built TinyLane and Open-Sourced It

My 256MB Router Can’t Run OpenClash, So I Built TinyLane and Open-Sourced It

Scope: Small routers with 128–256 MB RAM, arm64 architecture, and OpenWrt 25.12 (I use a Xiaomi AX3000T). Nature of this article: A development log and introduction for a personal-use project. TinyLane is my own independent project; it is unrelated to and not endorsed by the sing-box official project.

1. Why I Stopped Using OpenClash

In the previous two posts, I wrote about flashing OpenWrt on the AX3000T, installing OpenClash, and later troubleshooting lag and configuring WireGuard. It worked, but it was never comfortable:

  • On 256 MB of RAM, OpenClash plus dependencies such as Ruby takes up a not-insignificant amount of resident memory; when memory gets tight, it easily lags;
  • Many features were ones I didn't need, while what I actually wanted was missing: for example, seeing at a glance on my phone "which device is connected to which website, and whether it's going through the proxy or direct";
  • If I broke the configuration and wasn't home, the router would become a brick.

So on the evening of November 18, I decided to build my own version with only the features I needed. The idea was simple: use sing-box directly as the proxy core, wrap it in a Go-based daemon responsible for generating configs, switching nodes, and acting as a watchdog, then add a mobile web panel—all three compiled into the same binary. That same night I replaced OpenClash on the AX3000T; before uninstalling all the old plugins, I made a complete backup.

Most of the code was written together with an AI coding assistant: I defined requirements, reviewed the results, used it every day on my own router, and fixed issues as I found them.

2. What It Looks Like

The panel is a mobile-first iOS-style interface. The entire panel is about 36 KB compressed and embedded in the binary; open http://<router IP>:9999 to use it, or enter it from LuCI "Services → TinyLane" (if already logged in to LuCI, you'll be logged in automatically).

TinyLane panel: Overview, Nodes, Devices (demo data)
TinyLane panel: Overview, Nodes, Devices (demo data)
TinyLane panel: Subscription, Rules, Settings (demo data)
TinyLane panel: Subscription, Rules, Settings (demo data)

As for memory, here are readings from this AX3000T under everyday home load: the core is about 35 MB, the panel daemon 20–28 MB, and system available memory 77–93 MB. These are just daily observations; I haven't done long-duration peak measurements under full load and many connections, nor have I compared it with OpenClash on the same machine, so I won't use them to conclude that it "uses less memory."

3. Core Features

1. Three Modes, One-Click Proxy Off

Mode Effect
Rule-based routing (default) Domestic websites and domestic IPs go direct; everything else goes through the proxy according to rules
Global proxy Except for rules marked "Fixed," everything goes through the main route
Global direct The proxy does not run; it behaves like an ordinary router

After turning off "Enable Proxy," the whole household goes direct, and the router itself works as usual.

2. Domestic IPs Go Direct at the Firewall Layer

This was the feature I wanted most. Traffic to domestic IPs is allowed directly at the nftables firewall layer and never enters the proxy core, which saves CPU and makes speed more stable. The cost was that these connections were originally invisible in the panel; later I applied a one-line patch to sing-box to expose DNS replies through a bypass, so connections that are "direct at the core" can also show their domains and record byte counts in the panel.

3. Per-Device Routing

LAN devices are discovered automatically, and each can be set individually to:

  • Follow global: use the three modes above;
  • Global proxy / Global direct;
  • Domestic direct, foreign via a group: domestic traffic goes direct as usual, and only foreign traffic goes through the specified group. For example, the iPhone's foreign traffic goes through the US group, and the Mac's foreign traffic goes through the Japan group;
  • All via a group (including domestic): even domestic websites go through the specified group (called "All via a certain group" in older versions).

Regardless of which mode a device is set to, custom rules take priority over the device mode.

Guest devices can only go direct, and you can also set "New devices are treated as guests by default." There are also blocklisting, kicking offline, and "View what this device is currently connecting to."

I changed device status once: when the Mac lid is closed it disconnects from Wi‑Fi, and it is occasionally woken by Power Nap, so the panel once showed it as online. Later I changed it to three states—Online / Sleeping / Offline—and residual connections from offline devices are automatically cleaned up.

4. Groups, Failover, and Network-Outage Protection

  • Groups = manually selected nodes + “include if the name contains XX” + “exclude if the name contains XX”. After a subscription update, membership is recalculated automatically, so you don’t need to reselect anything.
  • Failover: Nodes in a group are prioritized in order. A watchdog measures both latency and download speed. If the current node fails, it switches to the next one, and switches back after recovery.
  • Network-outage protection: Once enabled for a group, if all nodes in the group are unavailable, it prefers to disconnect rather than fall back to a direct connection or another route. This suits scenarios where “some websites can only be accessed from specific regions.”

I hit a snag here once: one time in the early morning, my home internet went down for about 5 minutes. Investigation showed the upstream broadband was down entirely—not a TinyLane issue—but the watchdog thought all nodes were down and started switching back and forth. I later changed it to test domestic connectivity first; if domestic connectivity is also unreachable, it judges that the broadband is down, does not count a failure, and does not switch.

5. Subscriptions and Rules

Subscriptions support Clash YAML, sing-box JSON, share links, and Base64. Protocols include Hysteria2, VLESS (including Reality, WS+TLS), AnyTLS, and more. Before updating, it lists which nodes were added and removed, and applies only after confirmation; fake nodes such as “remaining traffic” and “expiration time” are automatically filtered by keyword. Rules support domain, suffix, keyword, IP range, port, and source device, and can be reordered by long-press and drag; when you see a website in the connection list, tap it once to add it as a rule.

4. Two Designs That Let Me Remotely Change Configs with Peace of Mind

Safe Test Run

Breaking the config while I’m away from home was what I feared most when using OpenClash. TinyLane can be started like this on first install or after major changes:

Safe trial run
tinylane-safe-apply 5 # Start; if not confirmed within 5 minutes, it automatically reverts to normal routing
# After opening the panel and confirming everything is normal:
tinylane-safe-apply confirm

Within the set N minutes, if confirm is not executed, the router automatically reverts to normal router mode. During the test run, TinyLane temporarily disables autostart on boot, then restores it after confirm, so if the router restarts during this period, it will also boot in normal router mode.

A limitation to note: the rollback timer is an ordinary background process. If the router completely freezes and does not reboot, it cannot guarantee rollback on time. The same applies to editing raw JSON directly in advanced mode: it fully validates and marks error line numbers before saving; after applying, if you don’t confirm within 90 seconds, it automatically rolls back.

Router local traffic and remote management links such as WireGuard always stay direct. This can be hardcoded into the binary at compile time and cannot be deleted from the config, preventing you from locking yourself out.

5. Pitfall: A Speed Test Pushed the Router into OOM

The panel has a one-click speed test to fill in suggested values for smart rate limiting. The earliest version opened multiple concurrent streams during the test, instantly exhausting the 256 MB machine’s memory and triggering OOM.

The fix came in three steps:

  1. Prioritize processes: Set the proxy core’s oom_score_adj to -800 and the daemon to -500. When memory is tight, the system kills other processes first and tries to keep the core alive;
  2. Make the speed test smaller: Change to 2 concurrent streams and streaming upload, no longer buffering the whole block of data;
  3. Reject outright on low memory: Refuse to run the speed test when available memory is below 40 MB; better not to test than to drag the router to death.

There is also a fallback: if the proxy core crashes 3 times within 2 minutes, it automatically removes the transparent proxy, temporarily letting the whole household go direct, and switches back after the core is stable again. The panel and the core are two processes, so if the core has problems, the panel can still open as usual.

6. Domestic Direct-Connection Optimization: I Built It, but Turned It Off Myself

TinyLane can enable a cake queue on the WAN port and work with cake-autorate to automatically adjust upload and download speeds based on latency. The night I left it on for testing, packet loss under full domestic load dropped from 80%–95% to 0, and new HTTPS connections dropped from 1–5 seconds to 0.02–0.04 seconds.

But I eventually turned it off. My home broadband is shared with others, and the actual available bandwidth varies greatly by time of day, so automatic tuning struggles to stay at the optimal value. That’s why the README also says: if your broadband is unstable, it’s recommended to keep it off for now, and new installs default to off.

Seven, How to Install

Currently only a precompiled linux/arm64 version is available (tested on the AX3000T); other architectures need to be compiled yourself.

Install dependencies
apk add kmod-nft-tproxy dnsmasq-full curl ca-bundle

Then download tinylane-<version>-linux-arm64 from the Release page and put it in /usr/bin/tinylane, copy the startup scripts, firewall scripts, etc. under files/ in the repository to the router at their original paths, fill in /etc/tinylane/tinylane.json (it can also be left blank, and you can add subscriptions in the panel after installation), and finally start it with the safe dry run above. See the repository README for the complete steps.

Uninstalling is also simple: stop the service, delete the binary, /etc/tinylane/ and the files you copied over, and the router returns to being an ordinary router.

Eight, Known Limitations

  • IPv6 proxying is not supported for now;
  • Connection records and device activity are only kept in memory and are cleared after a restart;
  • The precompiled version is only arm64, and the panel is currently only in Chinese.

Nine, Open Source and License

TinyLane is statically linked with sing-box, so the whole thing is released under GPL-3.0-or-later. The first public version, 0.4.3, was released on November 21, followed by 0.4.4 the same day. GitHub Actions automatically compiles it and attaches the binary, and every change is recorded in the repository's CHANGELOG.md.

I use it myself every day and will keep updating it. If you also have a small-memory router that OpenClash has been dragging down badly, you can go to the repository and download it to try; if you find it useful, give it a Star, and feel free to open an Issue if you run into problems.

GitHub repo ↗sprigly/tinylaneOpen on GitHub for details

Share Article

If this article helped you, please share it with others!

My 256MB Router Can’t Run OpenClash, So I Built TinyLane and Open-Sourced It
https://codqor.com/posts/tinylane-openclash/
Author
Liam
Published at
Related PostsSmart
1
Xiaomi AX3000T OpenWrt Guide: HomeProxy Traffic Splitting and WireGuard Remote Management
TechUsing the Xiaomi AX3000T (RD03) as an example, this practical guide covers unlocking SSH on the stock firmware, making a full backup, flashing OpenWrt while preserving the stock bootloader, and setting up basic networking, HomeProxy, and WireGuard.
2
Xiaomi AX3000T Follow-up: OpenClash Primary/Backup Routing, WireGuard Coexistence, and Lag Troubleshooting
TechTwo weeks after flashing OpenWrt on the AX3000T: switching routing from HomeProxy to OpenClash (Meta core) with primary/backup lines, running WireGuard remote management alongside OpenClash, and tracing cross-ocean link lag from 41 KB/s to 7–8 MB/s.
3
One API for Multiple TTS Providers: OpenAI Standard Parameter Mapping (MOSS Example)
TechWhen creating voiceovers for short videos, I used Edge TTS, Gemini, and MOSS together, each with different parameters. I later added /v1/audio/speech to my AI relay: clients call it using the OpenAI standard format while the gateway maps parameters per provider (for MOSS, just one line: voice→voice_id), and this article covers the parameter comparison table, mapping implementation, usage examples, and pitfalls.
4
Self-Hosting an Astro Blog: Pitfalls with R2 Image Hosting, D1, Caddy, and SEO
Techcodqor.com is itself an Astro static blog: posts are stored in Cloudflare D1, images in R2, pages are served from its own server via Caddy, comments use Turnstile, and there is an English mirror. This article records the build process and pitfalls in real chronological order, including overly long Bing titles, missed noindex directives, a build machine being cooled down, and the remediation approach after AdSense rejected the site for "low-value content."
5
Resend Email Sending from 0 to Launch: Domain Verification, Sending Relay, and Bounce Monitoring
TechA complete record of moving server notification emails from QQ Mail SMTP to Resend: choosing a new account and domain, DKIM/SPF/DMARC on Cloudflare, a sending API where only one relay holds the key, the gotchas that quota resets at UTC and receiving also consumes quota, Bark alerts for bounces, and protection against duplicate sends. Together with the previous post on Cloudflare receiving, it covers both sending and receiving.
Random PostsRandom

Comments

Leave a comment

Share your thoughts

Shown after review
Leave the name empty to post as “Anonymous”0 / 3000

Comments

Newest first · 5 at a time

Loading comments…

Profile Image of the Author
Liam
Notes on tech, life, and thoughts.
Categories
Tags
Latest Moments
Site Statistics
Posts
21
Categories
4
Tags
72
Total Words
87,292
Running Days
0 days
Last Activity
0 days ago
Table of Contents