modulepackage
0.0.0-20201109180148-7697f7653880
Repository: https://github.com/sg3des/mikrotik.git
Documentation: pkg.go.dev
# README
Mikrotik/RouterOS API Client
WIP
Common methods fully workable, but not all API elements released.
install:
go get -u github.com/sg3des/mikrotik
usage:
router, err := mikrotik.Dial(addr, user, pass)
// OR
router, err := mikrotik.DialTimeout(addr, user, pass, timeout)
API methods are presented how a tree, similar to the CLI commands RouterOS.
//get router name
router.System.Identity.Name()
//add ip address
ip := mikrotik.IPAddress{Address: ..., Interface: ...}
router.IP.Address.Add(&ip)
//get all network interfaces
var intfs []mikrotik.Interface
router.Interface.List(&intfs)
Most methods accepts a pointer on the appropriate structure, example: mikrotik.IPAddress
, mikrotik.NATRule
etc... Structure field names can by founded by tag mikrotik
. If tag not specified, go field name auto convert to RouterOS like format, example: FieldName
converted to field-name
, and back.
# Functions
Dial to mikrotik router.
DialTimeout dial to mikrotik router with timeout.
No description provided by the author
No description provided by the author
No description provided by the author
ToFieldName convert incoming fieldname to struct fieldname, example: address -> Address actual-interface -> ActualInterface.
ToMikrotikName convert struct fieldname to mikrotik like: Address -> address ActualInterface -> actual-interface.
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
IPAddress /ip/address.
No description provided by the author
No description provided by the author
MangleRule /ip/firewall/mangle.
Mikrotik is common struct contains connection to device and API-tree.
NATRule /ip/firewall/nat.
No description provided by the author
No description provided by the author
No description provided by the author
Resource from `/system resource print`.
Route /ip/route.
Routerboard - information from /system/routerboard/print.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author