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:
parent
dd9490bb3b
commit
44a64bfce4
6 changed files with 17 additions and 7 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue