feat: handle X-Forward-For for log output

- add Gorilla handlers package for enhanced HTTP handling
- refactor HTTP server to use a new ServeMux for routing
- update ListenAndServe to utilize ProxyHeaders for better proxy support
- add RealIP field to client model
  - use RealIP fild for connect/disconnect log output
This commit is contained in:
Sebastian Mark 2024-11-03 10:00:14 +01:00
parent dd9490bb3b
commit 44a64bfce4
6 changed files with 17 additions and 7 deletions

View file

@ -21,8 +21,8 @@ func handleClientCommands(c models.WebsocketClient) {
_, message, err := ws.ReadMessage()
if err != nil {
log.Info("Client disconnected:", "msg", err, "host", ws.RemoteAddr(), "clients", len(Clients)-1)
delete(Clients, ws.LocalAddr())
log.Info("Client disconnected:", "msg", err, "host", c.RealIP, "clients", len(Clients))
break
}