get remote ip fix (#254)
* get remote ip fix * add GetIp fix to chat command
This commit is contained in:
@@ -151,8 +151,11 @@ namespace Torch.Server.Managers
|
||||
//Largely copied from SE
|
||||
private void ValidateAuthTicketResponse(ulong steamId, JoinResult response, ulong steamOwner)
|
||||
{
|
||||
//SteamNetworking.GetP2PSessionState(new CSteamID(steamId), out P2PSessionState_t state);
|
||||
var ip = "0"; //state.GetRemoteIP();
|
||||
//SteamNetworking.GetP2PSessionState(new CSteamID(steamId), out P2PSessionState_t state);
|
||||
//state.GetRemoteIP();
|
||||
MyP2PSessionState statehack = new MyP2PSessionState();
|
||||
VRage.Steam.MySteamService.Static.Peer2Peer.GetSessionState(steamId, ref statehack);
|
||||
var ip = new IPAddress(BitConverter.GetBytes(statehack.RemoteIP).Reverse().ToArray());
|
||||
|
||||
Torch.CurrentSession.KeenSession.PromotedUsers.TryGetValue(steamId, out MyPromoteLevel promoteLevel);
|
||||
|
||||
|
@@ -33,14 +33,12 @@ namespace Torch.Commands
|
||||
[Permission(MyPromoteLevel.None)]
|
||||
public void GetIP(ulong steamId = 0)
|
||||
{
|
||||
Context.Respond("Cannot obtain client IP.");
|
||||
return;
|
||||
|
||||
if (steamId == 0)
|
||||
steamId = Context.Player.SteamUserId;
|
||||
|
||||
SteamNetworking.GetP2PSessionState(new CSteamID(steamId), out P2PSessionState_t state);
|
||||
var ip = new IPAddress(BitConverter.GetBytes(state.m_nRemoteIP).Reverse().ToArray());
|
||||
|
||||
VRage.GameServices.MyP2PSessionState statehack = new VRage.GameServices.MyP2PSessionState();
|
||||
VRage.Steam.MySteamService.Static.Peer2Peer.GetSessionState(steamId, ref statehack);
|
||||
var ip = new IPAddress(BitConverter.GetBytes(statehack.RemoteIP).Reverse().ToArray());
|
||||
Context.Respond($"Your IP is {ip}");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user