Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sir-go/utm5-mk-sync
subs statuses sync between UTM5 and mikrotik routers
https://github.com/sir-go/utm5-mk-sync
go mikrotik rabbitmq routeros traffic-shaping
Last synced: 23 days ago
JSON representation
subs statuses sync between UTM5 and mikrotik routers
- Host: GitHub
- URL: https://github.com/sir-go/utm5-mk-sync
- Owner: sir-go
- Created: 2022-10-04T03:01:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-05T08:31:18.000Z (about 2 years ago)
- Last Synced: 2024-11-06T22:08:34.532Z (2 months ago)
- Topics: go, mikrotik, rabbitmq, routeros, traffic-shaping
- Language: Go
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# UTM5 <-> Mikrotik sync
[![Go](https://github.com/sir-go/utm5-mk-sync/actions/workflows/go.yml/badge.svg)](https://github.com/sir-go/utm5-mk-sync/actions/workflows/go.yml)A tool for synchronizing subscribers' statuses between UTM5 billing and Mikrotik routers (with auto-balancing the shaping load between routers)
## How it works
Runs as a daemon and listens to the commands from the RabbitMQ broker.The commands have a certain format convenient for use in the UTM5 billing.
Billing sends the commands using `mk-d-client.sh` script as a client.
By accepting the `sync_all` command, the daemon gets all subscriber's profiles from the billing's MySQL
database directly (due to performance issues).Also, it automatically balances the network load between the shapers in the case of using several devices.
The daemon communicates with Mikrotik routers via Mikrotik API.
Commands:
- `slink_add` - add service link (add the IP address to the subscriber's profile)
- `slink_change` - change the service link (change IP addresses in the subscriber's profile)
- `slink_del` - remove the service link (remove IP addresses from the subscriber's profile)
- `internet_on` - move the subscriber's profile to the service-allowed list
- `internet_off` - move the subscriber's profile to the service-denied list
- `sync_all` - get all subscriber's statuses from the billing and apply changes to the routers
- `rebalance_q` - force run the network balancing between routers## Configuration
All necessary configurations are provided in the configuration file `config.toml`
(can be set in the `-c` running option).## Docker
```bash
docker build -t mk-daemon .
docker run --rm -it -v ${PWD}/config.toml:/config.toml:ro mk-daemon:latest
```## Tests
```bash
go test -v ./...
gosec ./...
```## Build & run
```bash
go mod download
go build -o mk-daemon ./cmd/mk_daemon
./mk-daemon -c config.toml
```