use distinct types for player and session ids

This commit is contained in:
2024-01-31 22:40:12 -06:00
parent d61c70da86
commit 73b5ac7960
8 changed files with 42 additions and 32 deletions

View File

@@ -6,6 +6,8 @@ import (
"net/netip"
"strings"
"github.com/google/uuid"
"git.sunturtle.xyz/studio/shotgun/player"
)
@@ -21,7 +23,7 @@ func WithPlayerID(next http.Handler) http.Handler {
http.Error(w, "missing or invalid X-Forwarded-For header; check server configuration", http.StatusInternalServerError)
return
}
id := player.ID(addr.As16())
id := player.ID{UUID: uuid.UUID(addr.As16())}
ctx := ctxWith(r.Context(), id)
next.ServeHTTP(w, r.WithContext(ctx))
})