xterm-inator / MikroGuard

Web interface for managing WireGuard peers on MikroTik routers
GNU General Public License v3.0
12 stars 7 forks source link

Create remote image and add new features #37

Closed millad221 closed 3 weeks ago

millad221 commented 2 months ago

Hi David Is it possible to add traffic consumption and expiration date for the user? This should be done by the front itself and disable the peer when it reaches the desired traffic, for example 50 gigs, or check the date by the system and when it reaches the desired date, disable it by api and allow the number of connections to be added to the peer. For example, when we confirm a user to connect in the user creation, how many users can't use the same config and also prepare it as a container for Mikrotik? I am new to Docker and your explanation is a bit complicated for me

xterm-inator commented 2 months ago

Hey,

I should be able to have a look at adding an expiration date for peers.

As for the data consumption method might be a bit out of scope for now as the software doesn't store any traffic usage it just gets the values from the router when someone is viewing those pages and those values get cleared when the router is reset so wouldn't be reliable. In the future I may look into more in depth traffic monitoring possibly using snmp which then I would be able to look into this also.

The wireguard protocol is only made for 1 concurrent connection per client config so it isn't recommended to share a config.

I have thought about looking into how to create a container for MikroTik, I am a bit concerned on memory usage, but will look into this sometime soon.

Thanks for your ideas. Find a getting started with docker and docker compose guide, then getting it running with docker compose should be fairly simple and if you have issues with getting it running with docker add a comment I'm happy to try and help.

millad221 commented 2 months ago

Hello David This work should be done by maintaining the data on the sqllite database and according to the checks I made, the display traffic is completely correct and the accuracy is very high, only the functions should be written in such a way that when the api queries go to Mikrotik and at the moment It displays the traffic, sums it up for its peers and stores it in the database, and the function is such that it sees the previous one that has been stored and sums it up with the new information, and in this way the total traffic of the previous and the new ones are added together and from the traffic The principal given to the peer is checked until it is smaller or equal, the peer is allowed to operate, and when the number is greater than the desired traffic, the peer is disabled. For the time, the date of the system should be checked with our desired date every day and call this information in the database. If it is less than or equal to our desired date, it should be allowed to work. If it is greater than our desired date, the system itself will check. and instruct the api to disable the peer

xterm-inator commented 3 weeks ago

hey, Sorry for the late reply.

After thinking about it I feel like adding both an expiry date and usage limiting might be out of scope for this project for now. Mainly because it is made to reflect what mikrotik can do when creating peers and it was made around the concept that users manage their own connections e.g a company with many users.

However I might add the ability for a user to have an expiry date in the future