Skip to content

feat(core): get the public IP from SteamWorks instead of an HTTP endpoint - #31

Merged
Rushaway merged 1 commit into
masterfrom
feat/steamworks-public-ip
Nov 3, 2026
Merged

Rushaway merged 1 commit into
masterfrom
feat/steamworks-public-ip

Conversation

@Rushaway

Copy link
Copy Markdown
Member

Summary

  • Method 0 now asks Steam instead of an HTTP endpoint: the public IP comes from SteamWorks_GetPublicIP() instead of a ripext request to api.ipify.org. This removes the external service, the HTTP request and the JSON parsing.
  • Fallback to hostip until Steam knows the IP: before the server is logged on to Steam (server start, -insecure, LAN), GetPublicIPFromSteam() uses hostip. SteamWorks_SteamServersConnected() then sets the Steam IP as soon as the server logs on. Late loads and map changes get the Steam IP directly from OnConfigsExecuted.
  • sm_fixnetpublicaddr_public_ip_endpoint is removed: it only fed the HTTP request. The method values are unchanged (0 = Steam, 1 = Hostip, 2 = Custom).
  • Dependency: SteamWorks instead of ripext. CI now pulls the include from alliedmodders/SM-SteamWorks, the SteamWorks fork now maintained by AlliedModders.
  • .github/copilot-instructions.md is updated to match.
  • Version bump 1.1.4 -> 1.2.0.

Deployment notes

Test plan

  • Compiles with spcomp 1.12.0.7259 and 1.13.0.7427 (same deps as CI), no warnings
  • CI build passes
  • Method 0, fresh server start: net_public_adr is hostip at first, then the public IP once the server logs on to Steam
  • Method 0, map change / sm plugins reload FixNetPublicAdr: net_public_adr is the public IP right away
  • Methods 1 and 2 behave as before
    🤖 Generated with Claude Code

…oint

- Method 0 reads the public IP with SteamWorks_GetPublicIP(): no
  external service, no HTTP request, no JSON.
- Use hostip until the server is logged on to Steam, then set the
  Steam IP from SteamWorks_SteamServersConnected().
- Remove sm_fixnetpublicaddr_public_ip_endpoint; depend on SteamWorks
  (alliedmodders/SM-SteamWorks) instead of ripext.
- Bump version 1.1.4 -> 1.2.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 22:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@WareZ57 WareZ57 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM.

Getting the IP from Steam is simpler and removes the dependency on api.ipify.org and ripext. I checked:

  • SteamWorks_GetPublicIP() in alliedmodders/SM-SteamWorks (Extension/gsnatives.cpp) returns false when there is no game server interface or GetPublicIP() is 0, so the hostip fallback covers startup, -insecure and LAN as described.
  • Byte order: the native fills ip[0] with the most significant byte, so "%d.%d.%d.%d" with ip[0..3] gives the right dotted address.
  • SteamWorks_SteamServersConnected is a real forward in the include, and it also fires again after a Steam reconnect, which is a nice bonus.
  • Pawn/includes/SteamWorks.inc exists at the path the CI copies from, and the CI build is green.
  • Compiles locally with spcomp 1.12 and the SteamWorks include, no warnings.

One small note, not blocking: on a map change while the server is temporarily disconnected from Steam, OnConfigsExecuted overwrites the Steam IP with hostip until SteamServersConnected fires again. That is short-lived and self-healing, so fine as is.

Not tested: no runtime test on a server (fresh start, map change, reload, methods 1/2), so I only reviewed the code and the extension source.

@Rushaway
Rushaway merged commit a09dbda into master Nov 3, 2026
7 checks passed
@Rushaway
Rushaway deleted the feat/steamworks-public-ip branch November 3, 2026 21:50
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