Repository navigation
feat(core): get the public IP from SteamWorks instead of an HTTP endpoint - #31
Merged
Merged
Conversation
…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>
Merged
3 of 4 tasks
WareZ57
approved these changes
Oct 30, 2026
WareZ57
left a comment
There was a problem hiding this comment.
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 orGetPublicIP()is 0, so the hostip fallback covers startup,-insecureand LAN as described.- Byte order: the native fills
ip[0]with the most significant byte, so"%d.%d.%d.%d"withip[0..3]gives the right dotted address. SteamWorks_SteamServersConnectedis a real forward in the include, and it also fires again after a Steam reconnect, which is a nice bonus.Pawn/includes/SteamWorks.incexists 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SteamWorks_GetPublicIP()instead of a ripext request toapi.ipify.org. This removes the external service, the HTTP request and the JSON parsing.-insecure, LAN),GetPublicIPFromSteam()useshostip.SteamWorks_SteamServersConnected()then sets the Steam IP as soon as the server logs on. Late loads and map changes get the Steam IP directly fromOnConfigsExecuted.sm_fixnetpublicaddr_public_ip_endpointis removed: it only fed the HTTP request. The method values are unchanged (0 = Steam, 1 = Hostip, 2 = Custom)..github/copilot-instructions.mdis updated to match.Deployment notes
cfg/sourcemod/FixNetPublicAdr.cfgkeeps the oldsm_fixnetpublicaddr_public_ip_endpointline, becauseAutoExecConfigdoes not rewrite existing files. The line is harmless and can be deleted.Test plan
net_public_adris hostip at first, then the public IP once the server logs on to Steamsm plugins reload FixNetPublicAdr:net_public_adris the public IP right away🤖 Generated with Claude Code