routeros

package module
v0.0.0-...-c2f74b2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2016 License: MIT Imports: 11 Imported by: 0

README

Documentation

Overview

Package routeros provides a programmatic interface to the Mikrotik RouterOS API

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type AsyncReply

type AsyncReply struct {
	*Reply
	Tag string
	Err error
	C   chan struct{}
}

type Client

type Client struct {
	Address   string
	Username  string
	Password  string
	TLSConfig *tls.Config

	sync.Mutex
	// contains filtered or unexported fields
}

Client is a RouterOS API client.

func (*Client) Async

func (c *Client) Async()

Async starts asynchronous mode. It returns immediately.

func (*Client) Call

func (c *Client) Call(command string, params []Pair) (*Reply, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) Query

func (c *Client) Query(command string, q Query) (*Reply, error)

type DeviceError

type DeviceError struct {
	Sentence *proto.Sentence
}

DeviceError records the sentence containing the error received from the device. The sentence may have Word !trap or !fatal.

func (*DeviceError) Error

func (err *DeviceError) Error() string

type Pair

type Pair struct {
	Key   string
	Value string
	// Op is used for Query words to signify logical operations
	// valid operators are -, =, <, >
	// see http://wiki.mikrotik.com/wiki/Manual:API#Queries for details.
	Op string
}

Pair is a Key-Value pair for RouterOS Attribute, Query, and Reply words use slices of pairs instead of map because we care about order

type Query

type Query struct {
	Pairs    []Pair
	Op       string
	Proplist []string
}

type Reply

type Reply struct {
	Re   []*proto.Sentence
	Done *proto.Sentence
}

Reply has all lines from a reply. They must all have the same .tag value.

func (*Reply) String

func (r *Reply) String() string

type UnknownReplyError

type UnknownReplyError struct {
	Sentence *proto.Sentence
}

UnknownReplyError records the sentence whose Word is unknown.

func (*UnknownReplyError) Error

func (err *UnknownReplyError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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