microtik

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address  string
	Port     int
	Username string
	Password string
}

Config is a struct which contains the configuration parameters which are needed to connect to your microtik device

type Microtik

type Microtik struct {
	*routeros.Client
	// contains filtered or unexported fields
}

Microtik is a struct holding the parameters and the connection to a microtik device.

func New

func New(c Config, opts ...Option) *Microtik

New is a constructor method and returns an initalized (but not yet connected) instance of a Microtik object

func (*Microtik) Reset4G

func (m *Microtik) Reset4G() error

Reset4G cuts the power of a USB LTE/4G modem connected to the routerboard for a period of 5 seconds.

func (*Microtik) RouteStatus

func (m *Microtik) RouteStatus(name string) (RouteResult, error)

RouteStatus allows to query this status of a particular route on a microtik device (ip/route). The corresponding route must be registered during construction of the Microtik object, otherwise this method will fail. This method returns three parameters: 1. route disabled (bool) 2. route active (bool) 3. error

func (*Microtik) SetRoute

func (m *Microtik) SetRoute(name, command string) error

SetRoute allows to set parameters for a particular route on a microtik device (ip/route). The corresponding route must be registered during construction of the Microtik object, otherwise this method will fail.

type Option

type Option func(m *Microtik)

Option is a function argument type for the Microtik constructor

func RouteID

func RouteID(name, comment string) Option

RouteID is a functional option. It is used when working with ip/routes on microtik router. In order to work with routes there needs to be a way to identify them. This most reliable way is to identify them through their unique comment. With this option a route can be registered with an arbitrary name and a string matching the route's comment in the microtik router.

type RouteResult

type RouteResult map[string]bool

RouteResult is type used to return route results.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL