rosapi — vendored RouterOS API client#
Vendored copy of github.com/go-routeros/routeros/v3
at v3.0.1 (upstream commit of 2025-02-16), MIT licensed — see LICENSE.
Why vendored#
Upstream is effectively unmaintained: the last commit predates this copy by
eighteen months, and the pull requests and issues filed against the async mode
in mid-2026 (#31–#34) have had no maintainer response. No maintained alternative
exists — swoga/go-routeros is a copy that only receives dependabot bumps for
its GitHub Actions, and jda/routeros-api-go stopped in 2016. Vendoring keeps
the code buildable forever and lets this repo fix and prune what it uses.
Local changes relative to upstream v3.0.1#
-
The async/listen mode is removed (
async.go,listen.go,chan_reply.go, their tests, and the async branch ofRunArgsContext). The bouncer'sRouterConninterface exposesRunArgsandCloseonly; nothing in this repository ever calledAsync(),Listen(), or the context-cancelling run variants. The sentence-kind constants that lived inlisten.gomoved toreply.go, which is what consumes them. -
proto.ctxReader/ctxWriterread and write directly instead of dispatching every call to a fresh goroutine with a channel and a copy buffer. Upstream's dispatch existed to letCancel()interrupt an in-flight read — and only the removed async mode ever calledCancel(). At this bouncer's production scale (22k address-list entries fetched every cycle) the goroutine-per-Read layer cost ~294,000 goroutine spawns, ~62 MB of garbage and ~76% of all allocations per reconcile cycle. The rewrite was validated against the pristine upstream with a differential test: SHA-256 fingerprint over all 22,037 parsed sentences identical, error shapes identical (io.ErrUnexpectedEOFon truncation,*DeviceErroron!trap), and upstream's own suite green undergo test -race. The committedproto/reader_shape_test.gopins that behaviour. -
The pre-6.43 MD5 challenge login is removed. The two-stage login only exists before RouterOS 6.43 (2018), the bouncer documents 7.x as its floor, and answering the challenge means hashing the password with MD5 — flagged, rightly, by every scanner that reads it. A router that sends a
retchallenge now getsErrLegacyLoginUnsupportedinstead of an MD5 answer. -
TestRunAsyncand the listen-mode tests are removed with the mode; the pre-6.43 login tests assert the rejection instead of the handshake. The rest of upstream's test suite is kept and passing.
When comparing against upstream, diff against the v3.0.1 tag, not master.