Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

routeros

test Documentation release

A thick layer over the MikroTik RouterOS API for the Jennifer language.

The bundled mikrotik module speaks the raw binary API: command paths, =key=value words, reply sentences. routeros wraps that in plain verbs and typed structs so you can configure interfaces, bridges, and the firewall without knowing RouterOS internals. All input is validated before it touches the wire; every failure is an Error{kind: "routeros"} (or kind: "mikrotik" from the transport) with a human-readable message.

Usage

import "@jennifer/routeros/" as mt;

def c as mt.Client init mt.connect("192.168.88.1", "admin", "secret");

# see what gets sent (credentials are redacted); MT_VERBOSE=1 does the same
$c = mt.setVerbose($c, true);

# bridges
mt.addBridge($c, "brlan");
mt.addBridgePort($c, "brlan", "ether2");

# interfaces
mt.disableInterface($c, "ether5");
mt.commentInterface($c, "ether1", "uplink");

# firewall
mt.allowService($c, "tcp", 22, "ssh management");
mt.blockAddress($c, "203.0.113.7", "known scanner");

def r as mt.FirewallRule init mt.firewallRule(mt.CHAIN_FORWARD, mt.ACTION_DROP);
$r = mt.withProtocol($r, "tcp");
$r = mt.withDstPort($r, "445");
$r = mt.withComment($r, "no smb forwarding");
mt.addFirewallRule($c, $r);

mt.disconnect($c);

See examples/ for one runnable example per topic, e.g. MT_HOST=... MT_USER=... MT_PASSWORD=... jennifer run examples/firewall.j.

Documentation

  • docs/cheatsheet.md - the full API surface, project layout, tests, requirements
  • docs/index.md - per-topic guides with background and worked examples
  • examples/ - one runnable, read-only example per topic (examples/<topic>.j)
  • RouterOS documentation - MikroTik's official reference for everything behind the paths this module wraps

Disclaimer

MikroTik and RouterOS are trademarks of SIA Mikrotīkls. This project is an independent, community-written client library; it is not affiliated with, endorsed, or supported by SIA Mikrotīkls. It configures live network equipment - review what a call does before pointing it at production hardware. Use at your own risk; no warranty of any kind.

License

Licensed under the GNU LGPL v3.0 only - see LICENSE. Copyright © 2026 mplx <jennifer@mplx.dev>. Every source file carries an SPDX-License-Identifier: LGPL-3.0-only header.

About

Thick layer over the MikroTik RouterOS API

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages