Jonathon Reinhart
ef3f9c8ea0
Move parsing of "allowed_nets" out to ConfigLoad()
...
This has several benefits:
- Configuration errors are caught at startup rather than upon a connection
- connectionChecker() has less work to do for each connection
2021-03-13 20:34:48 -05:00
Jonathon Reinhart
4036213dd5
Simplify peerIP determination in connectionChecker()
...
peerIP = net.ParseIP(addr.IP.String())
can be simplified to just:
peerIP = addr.IP
but we can also skip the safe cast since we know the net.Addr will always
be net.TCPAddr because we only have TCP listeners.
2021-03-13 20:19:07 -05:00
Jonathon Reinhart
20ca816160
Discard mail if remote_host is not set
...
This is useful for test environments.
2021-03-13 09:28:04 -05:00
Jonathon Reinhart
9921b38046
Explicitly configure default logfile for stderr
2021-03-13 03:25:57 -05:00
Jonathon Reinhart
095fba119a
Change default logfile to empty string (meaning stderr)
...
The causes logrus to write to stderr.
2021-03-13 03:25:57 -05:00
Jonathon Reinhart
34cb47c364
Implement structured logs using logrus
...
This was based loosely on an earlier implementation by
Danny Kopping <danny.kopping@grafana.com >
2021-03-13 03:25:57 -05:00
Jonathon Reinhart
009ae8f73a
hasher: Check number of arguments
...
This makes for a better user experience than a go segfault.
2021-02-15 00:18:15 -05:00
Jonathon Reinhart
70dfe6b128
Only call AuthLoadFile() once at startup
2021-02-15 00:08:37 -05:00
Jonathon Reinhart
7fa0eebf95
Simplify range code for setting up listeners
2021-02-15 00:00:38 -05:00
Jonathon Reinhart
ecf830865c
Add helpful log messages for various error cases
2021-02-14 23:49:17 -05:00
Jonathon Reinhart
4fd6bb1004
Refactor common code in listener setup
2021-02-14 23:30:31 -05:00
Jonathon Reinhart
fd3f513b18
Don't run ListenAndServe in a goroutine
...
Any errors returned in ListenAndServe() (e.g. port already in use) will be
swallowed and not evident to the user.
2021-02-14 23:24:25 -05:00
Jonathon Reinhart
b202a2209e
Refactor out getTLSConfig()
2021-02-14 23:21:42 -05:00
Jonathon Reinhart
f33105f83c
Allow email field to be empty in allowedUsers file
...
In this case, it is not checked.
2021-02-09 00:00:36 -05:00