Mikrotik Configuration Generator

A desktop application that standardizes router configurations for ISP technicians

Introduction

The Mikrotik Configuration Generator was developed for First Step Internet to address the lack of standardization in home router installations. Without standards, each router was configured uniquely, increasing the complexity of troubleshooting and maintenance.

As the developer, I needed to create a solution that would work offline, be self-contained, and provide a simple interface for technicians to generate standardized configurations for Mikrotik routers.

Project Highlights

  • Cross-platform desktop application
  • Built with Go and Wails framework
  • Evolved through multiple iterations and technologies
  • Simplified workflow for ISP technicians
  • Self-contained executable with embedded filesystem

Project Overview

The Mikrotik Configuration Generator went through several iterations, starting as a Python console application and eventually evolving into a modern desktop application built with Go and Wails.

The application allows technicians to input customer and network details through a simple interface, then generates standardized configuration scripts for Mikrotik routers. These scripts can be directly applied to the routers, ensuring consistent setup across all installations.

The project's evolution reflects a journey through different technologies and approaches, each addressing specific requirements and constraints.

Mikrotik Configuration Generator Screenshot

Technology Stack

GoWailsReactJSMaterial UIHTML Templates

Challenges Faced

Technical Requirements

The application needed to work offline and be a self-contained executable, which limited the choice of frameworks and technologies.

User Experience

The initial TUI (Text User Interface) was easy to develop but difficult for entry-level technicians to learn and use efficiently.

Cross-Platform Compatibility

Finding a framework that could produce a lightweight, cross-platform application with a modern UI proved challenging.

Framework Exploration

Several frameworks were considered during development:

  • Flutter Desktop - Too new and still in alpha at the time
  • Electron - Memory footprint was too high for the target laptops
  • Winforms - Well-documented and supported native solution
  • Fyne - The GUI library written in Go with the most stars on Github
  • C# with .NET 5.0 - Single File Executables for Windows were pushed back to .NET 6.0

Solutions Implemented

Version 1.0: Python Console Program

The initial version was a Python console application with a text-based interface. While functional, it had limitations:

  • Lots of duplicated code, particularly in string templates
  • TUI was difficult for entry-level technicians to learn

Example Python Function

def input_validation(x):
    '''This function substitutes characters that will break
    Mikrotik Scripting Syntax with their
    corresponding hex code.'''
    syntax_breakers = {
        '[': '\5B',
        ']': '\5C',
        '(': '\28',
        ')': '\29',
        '$': '\$',
        '?': '\?',
        '{': '\7B',
        '}': '\7D',
        ':': '\3A',
        ';': '\3B',
        '\': '\\'
    }
    syntax_breakers_list = list(syntax_breakers.keys())
    for c in x:
        for key in syntax_breakers_list:
            if c == key:
                x = x.replace(c, syntax_breakers.get(c))
                syntax_breakers_list.remove(c)
    return x

Version 2.0: Go with Wails

The final solution was built with Go and Wails, which offered several advantages:

  • Go's Embed feature made it trivial to include an entire filesystem in the binary
  • The templating engine in Go's standard library allowed reuse of templates with minor changes
  • Wails provided a modern UI framework that met all project requirements

Example Go Code

app := wails.CreateApp(&wails.AppConfig{
    Width:     576,
    Height:    576,
    Title:     "Mikrotik Configuration Generator v" + version,
    JS:        js,
    CSS:       css,
    Colour:    "#131313",
    Resizable: true,
})

app.Bind(builder.BuildFiber)
app.Bind(builder.BuildeFiber)
app.Bind(builder.BuildRadio)
app.Bind(builder.BuildRouter)
app.Run()

Results Achieved

Standardized Configurations

The application successfully standardized router configurations, reducing the complexity of troubleshooting and maintenance. Technicians could now generate consistent configurations with minimal training.

Improved Efficiency

The intuitive UI significantly reduced the time required to configure routers, allowing technicians to complete installations more quickly and with fewer errors.

Technical Achievements

  • Created a cross-platform desktop application that works offline
  • Developed a self-contained executable with an embedded filesystem
  • Built a modern UI that's easy for entry-level technicians to use
  • Implemented a templating system for generating configuration scripts
  • Successfully navigated through multiple technologies to find the optimal solution

Conclusion

The Mikrotik Configuration Generator project demonstrates the importance of selecting the right tools for specific requirements. Through multiple iterations and technology explorations, the final solution successfully addressed the need for standardized router configurations.

The journey from a text-based interface to a modern desktop application highlights the evolution of the project and the developer's commitment to finding the optimal solution. The final product not only met the technical requirements but also provided a user-friendly experience for technicians.

Looking forward, there are opportunities for further improvement, such as adding animations, swapping Material UI components for Headless UI and TailwindCSS, or potentially rebuilding with newer frameworks like .NET 6/MAUI or Tauri.

Interested in learning more?