diff --git a/server/relay.go b/server/relay.go index d45b641..1004408 100644 --- a/server/relay.go +++ b/server/relay.go @@ -40,7 +40,7 @@ func WebSocketHandler(ws *websocket.Conn) { currentConnections++ mu.Unlock() - clientInfo := relay.ClientInfo{ + clientInfo := utils.ClientInfo{ IP: utils.GetClientIP(ws.Request()), UserAgent: ws.Request().Header.Get("User-Agent"), Origin: ws.Request().Header.Get("Origin"), diff --git a/server/types/clientInfo.go b/server/types/clientInfo.go deleted file mode 100644 index 8f08429..0000000 --- a/server/types/clientInfo.go +++ /dev/null @@ -1,7 +0,0 @@ -package relay - -type ClientInfo struct { - IP string - UserAgent string - Origin string -} \ No newline at end of file diff --git a/server/utils/getClientInfo.go b/server/utils/getClientInfo.go index 99613e4..1963ad1 100644 --- a/server/utils/getClientInfo.go +++ b/server/utils/getClientInfo.go @@ -5,6 +5,12 @@ import ( "strings" ) +type ClientInfo struct { + IP string + UserAgent string + Origin string +} + func GetClientIP(r *http.Request) string { xff := r.Header.Get("X-Forwarded-For") if xff != "" {