Skip to content

use player location instead of nakama server - #175

Draft
iav-uk wants to merge 1 commit into
mainfrom
iav-geo-ip
Draft

use player location instead of nakama server#175
iav-uk wants to merge 1 commit into
mainfrom
iav-geo-ip

Conversation

@iav-uk

@iav-uk iav-uk commented Aug 7, 2026

Copy link
Copy Markdown

summary:
SatoriPersonalizer.Authenticate and SatoriPersonalizer.Send called nk.GetSatori().Authenticate(...) / EventsPublish(...) without an IP address, and, in calls from the Nakama node to Satori, Satori's geo-IP lookup (satori/server/api_authenticate.go / extractClientAddressFromContext) is falling back to the Nakama server's own peer address instead of the player's

@iav-uk
iav-uk requested a review from Copilot August 7, 2026 14:52
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Satori integration to forward the player’s client IP address (when available in the Nakama runtime context) to Satori on server-to-server calls, so Satori’s geo-IP resolution uses the player location rather than the Nakama node’s own address.

Changes:

  • Pass runtime.RUNTIME_CTX_CLIENT_IP through to nk.GetSatori().Authenticate(...).
  • Pass runtime.RUNTIME_CTX_CLIENT_IP through to nk.GetSatori().EventsPublish(...).
  • Add a small helper (satoriClientIPAddress) to extract the client IP from context.Context and pass it as a variadic argument.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread personalizer_satori.go
return
}
if _, err := nk.GetSatori().Authenticate(ctx, userID, nil, nil, !p.IsPublishAuthenticateRequestWithSession()); err != nil && !errors.Is(err, runtime.ErrSatoriConfigurationInvalid) {
if _, err := nk.GetSatori().Authenticate(ctx, userID, nil, nil, !p.IsPublishAuthenticateRequestWithSession(), satoriClientIPAddress(ctx)...); err != nil && !errors.Is(err, runtime.ErrSatoriConfigurationInvalid) {
@iav-uk iav-uk changed the title fix(location): use player location instead of nakama server use player location instead of nakama server Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants