nicocha30 / ligolo-ng

An advanced, yet simple, tunneling/pivoting tool that uses a TUN interface.
GNU General Public License v3.0
2.61k stars 260 forks source link

Remove calls to logrus.Fatal() and panic() in library components #57

Closed dismantl closed 7 months ago

dismantl commented 7 months ago

I use the ligolo-ng library packages in my own application, and noticed when attempting to listen on a port that was already in use, instead of returning an error the whole program would exit due to a call to logrus.Fatal. According to Go best practices, libraries should avoid exposing panics and prefer to log/return errors when possible (and I would say this extends to functions like logrus.Fatal), so that's what this PR attempts to do. It also adds a check to make sure port 80 is available before starting a web server for Let's Encrypt cert generation.

Thanks for all your work on ligolo-ng, it is a fantastic tool!

nicocha30 commented 7 months ago

Lgtm! Thanks @dismantl