Skip to content

Lissy93/OLD_AdGuardian-Term

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AdGuardian-Term (Go Version)

Real-time terminal monitoring & stats for AdGuard Home
🌐 adguardian.as93.net

About

Note

This app has now been re-written in Rust
See Lissy93/AdGuardian-Term instead!

My purpose for uploading this (failed) project is to show that not everything goes according to plan, and that's okay - it's just part of the learning process! I've written more about my learnings in the Background & Lessons Learned section below.

Although now re-written, this app is still fully functional, and pretty much feature complete. If you wish to continue, see the usage instructions for development and deployment docs.



Background & Lessons Learned

Initially, I chose Go, because it's quite performant, has a neat concurrency model, is reasonably quick to write, and (most importantly) compiles into a tidy single binary. I'd also come across the gizak/termui package, which seemed to be the perfect choice for plotting the charts.

However, I found Go's memory safety to be less than ideal. The compiler was irritating and managing threads manually was difficult. I also came across an issue which, for the life of me, I could not resolve - when termui updated the screen, random characters from the previous view would remain, making the charts hard for the user to read.

After spending nearly an entire weekend building out this project, I arrived at the tough realization that I had probably chosen the wrong tech stack. I was initially reluctant to scrap everything I had written so far, but it was the best way forward.

Instead, I picked up Rust - a language I'd been curious about but hadn't found the right opportunity to dive into. Rust, much like Go, is fast and efficient, but with one key difference - it emphasizes safety and manages memory exceptionally well. Rust also compiles into a single binary and has a robust concurrency model. In short, it seemed to address many of the issues I had encountered with Go.

Rebuilding my app in Rust wasn't a walk in the park, though. It has a steep learning curve and some unique concepts, like ownership and borrowing, which took a while to wrap my head around. Nevertheless, the more I delved into it, the more I found myself appreciating its design. In particular, its ability to prevent common programming errors, like null pointer dereferencing and data races, was a huge win for me.

As developers, we need to remind ourselves that it's okay to take a step back, reassess our decisions, and change our course if necessary. After all, in the long run, it's not about how quickly we can finish a project but about how well we can adapt, learn, and grow along the way. That's how we build not just better software, but also become better developers.

The new project is uploaded here:

Lissy93/AdGuardian-Term - GitHub


Usage

Prerequisites

If you haven't already done so, you'll need to install Go Lang.
Then clone the repo git clone https://github.com/Lissy93/OLD_AdGuardian-Term.git && cd OLD_AdGuardian-Term

Developing

Run go run . to start the app

Deploying

Run go build to generate the executable for your system.
You can then launch that with ./adguardian-term

Docker

There's also a Dockerfile, although the image is not published to any registry.
This can be built with: docker build -t adguardian .
And then run, with: docker run adguardian

Configuring

The app requires details of your AdGuard Home instance (endpoint and credentials). I didn't get round to making these parameters into environmental variables. So currently you'll need to set them in values.go


License

Lissy93/OLD_AdGuardian is licensed under MIT © Alicia Sykes 2022.
For information, see TLDR Legal > MIT

Expand License
The MIT License (MIT)
Copyright (c) Alicia Sykes <[email protected]> 

Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights 
to use, copy, modify, merge, publish, distribute, sub-license, and/or sell 
copies of the Software, and to permit persons to whom the Software is furnished 
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included install 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANT ABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

© Alicia Sykes 2022
Licensed under MIT

Thanks for visiting :)