Skip to content

Commit afdb597

Browse files
committed
Send local IP in heartbeat
1 parent 7814157 commit afdb597

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.13")]
36-
[assembly: AssemblyFileVersion("1.0.0.13")]
35+
[assembly: AssemblyVersion("1.0.0.14")]
36+
[assembly: AssemblyFileVersion("1.0.0.14")]

XRFAgent.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<UpdatePeriodically>false</UpdatePeriodically>
2626
<UpdateRequired>false</UpdateRequired>
2727
<MapFileExtensions>true</MapFileExtensions>
28-
<ApplicationRevision>13</ApplicationRevision>
28+
<ApplicationRevision>14</ApplicationRevision>
2929
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
3030
<UseApplicationTrust>false</UseApplicationTrust>
3131
<BootstrapperEnabled>true</BootstrapperEnabled>

modNetwork.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ public static string GetLocalIPAddress()
6868
if (IsOnline == true)
6969
{
7070
// https://stackoverflow.com/a/44226831
71-
// TODO: We need to account for wireless adapters too.
7271
List<string> iplist = NetworkInterface.GetAllNetworkInterfaces()
73-
.Where(x => x.NetworkInterfaceType == NetworkInterfaceType.Ethernet && x.OperationalStatus == OperationalStatus.Up)
72+
.Where(x => (x.NetworkInterfaceType == NetworkInterfaceType.Ethernet || x.NetworkInterfaceType == NetworkInterfaceType.Wireless80211) && x.OperationalStatus == OperationalStatus.Up)
7473
.SelectMany(x => x.GetIPProperties().UnicastAddresses)
7574
.Where(x => x.Address.AddressFamily == AddressFamily.InterNetwork)
7675
.Select(x => x.Address.ToString())
@@ -200,6 +199,7 @@ private static void PingInternetHandler(object sender, EventArgs e)
200199
if (IsOnline == false)
201200
{
202201
modLogging.LogEvent("System is now connected to the Internet", EventLogEntryType.Information);
202+
GetLocalIPAddress();
203203
GetPublicIPAddress();
204204
}
205205
IsOnline = true;

modSync.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ public static async void SendMessage(string Destination, string MessageType, str
6464
try
6565
{
6666
HttpClient MessageClient = new HttpClient();
67+
string localIP = modDatabase.GetConfig("Ping_LastKnownLocalIP");
6768
string publicIP = modDatabase.GetConfig("Ping_LastKnownPublicIP");
6869
string windowsVersion = modDatabase.GetConfig("System_LastKnownWindowsVersion");
69-
HttpRequestMessage MessageBuilder = new HttpRequestMessage(HttpMethod.Post, Sync_ServerURL + "?message_type=" + MessageType + "&destination=" + Destination + "&access_key=" + Sync_AccessKey + "&message=" + Message + "&user_agent=XRFAgent/" + Assembly.GetExecutingAssembly().GetName().Version + "&ip_address=" + publicIP + "&windows_version=" + windowsVersion);
70+
HttpRequestMessage MessageBuilder = new HttpRequestMessage(HttpMethod.Post, Sync_ServerURL + "?message_type=" + MessageType + "&destination=" + Destination + "&access_key=" + Sync_AccessKey + "&message=" + Message + "&user_agent=XRFAgent/" + Assembly.GetExecutingAssembly().GetName().Version + "&ip_address=" + publicIP + "&ip_local=" + localIP + "&windows_version=" + windowsVersion);
7071
TimeSpan httpTimeout = TimeSpan.FromSeconds(10);
7172
MessageClient.Timeout = httpTimeout;
7273
string EncodedCreds = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes("sandstorm:" + Sync_SandstormToken));

0 commit comments

Comments
 (0)