-
Notifications
You must be signed in to change notification settings - Fork 36
Extras
Currently, when the node-routeros
throws errors, it throws in english. We can change the language using the node-routeros
's property locale
when creating a new object:
const RouterOSClient = require('routeros-client').RouterOSClient;
const routeros = new RouterOSClient({
host: "someplace.com",
user: "admin",
password: "somepassword",
locale: "br"
});
You can find the currently available languages here. You can contribute sending a translation to your language if you don't find it there =].
In case you are using the snake_case pattern for your development workflow, you can change the way routeros-client
parses the routerOS dashed properties by invoking the useSnakeCase()
method of the client object:
routeros.connect().then((client) => {
// Changing to snake_case pattern
client.useSnakeCase();
}).catch((err) => {
// Error when trying to connect
console.log(err);
});
Note: you can use snake_case anywhere you wan't, like:
client.menu("/ip proxy access").select([
"id",
"dst_host",
"dst_port",
"comment"
]).where({
local_port: 8080
}).get();
This library doesn't directly deal with communications with the routerOS, all of that is node-routeros
's job. This library is only a big wrapper for common commands of the routerOS through the api.
As stated before, this library is intended to use on the server-side with NodeJS, it won't work on the client-side since it can't handle network sockets like NodeJS do. If you need interaction with the front-end, you can either use ExpressJS or socket.io for a layer of communication.
Any issues you encounter that is related to the connection, please head to my node-routeros
page and open an issue there, it'll be easier to track and fix.
Feel free to do any push requests for fixes, tests or new features, I'll be happy to improve this lib with your help =].