Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 943 Bytes

README.md

File metadata and controls

37 lines (25 loc) · 943 Bytes

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.