aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2019-09-28 18:08:10 -0400
committerGitHub <noreply@github.com>2019-09-28 18:08:10 -0400
commitc069496b2740315ca9db406d5eddde2af6aa894c (patch)
tree8eaab77611071200292998327063ba9df5bf0ee1
parentc1e8087b114bf55dc1ed873b45ad83d726057b2f (diff)
parent208c8b2b9daa13e4980833676a9d60926e03a84b (diff)
Merge pull request #1770 from sparky8251/remove-wan-ip
Remove WAN IP Detection
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs75
-rw-r--r--MediaBrowser.Model/System/PublicSystemInfo.cs8
2 files changed, 1 insertions, 82 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 24f59478c..c9dccb16a 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -1403,17 +1403,6 @@ namespace Emby.Server.Implementations
{
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
- string wanAddress;
-
- if (string.IsNullOrEmpty(ServerConfigurationManager.Configuration.WanDdns))
- {
- wanAddress = await GetWanApiUrlFromExternal(cancellationToken).ConfigureAwait(false);
- }
- else
- {
- wanAddress = GetWanApiUrl(ServerConfigurationManager.Configuration.WanDdns);
- }
-
return new SystemInfo
{
HasPendingRestart = HasPendingRestart,
@@ -1435,7 +1424,6 @@ namespace Emby.Server.Implementations
OperatingSystemDisplayName = OperatingSystem.Name,
CanSelfRestart = CanSelfRestart,
CanLaunchWebBrowser = CanLaunchWebBrowser,
- WanAddress = wanAddress,
HasUpdateAvailable = HasUpdateAvailable,
TranscodingTempPath = ApplicationPaths.TranscodingTempPath,
ServerName = FriendlyName,
@@ -1457,24 +1445,12 @@ namespace Emby.Server.Implementations
{
var localAddress = await GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
- string wanAddress;
-
- if (string.IsNullOrEmpty(ServerConfigurationManager.Configuration.WanDdns))
- {
- wanAddress = await GetWanApiUrlFromExternal(cancellationToken).ConfigureAwait(false);
- }
- else
- {
- wanAddress = GetWanApiUrl(ServerConfigurationManager.Configuration.WanDdns);
- }
-
return new PublicSystemInfo
{
Version = ApplicationVersion,
ProductName = ApplicationProductName,
Id = SystemId,
OperatingSystem = OperatingSystem.Id.ToString(),
- WanAddress = wanAddress,
ServerName = FriendlyName,
LocalAddress = localAddress
};
@@ -1506,31 +1482,6 @@ namespace Emby.Server.Implementations
return null;
}
- public async Task<string> GetWanApiUrlFromExternal(CancellationToken cancellationToken)
- {
- const string Url = "http://ipv4.icanhazip.com";
- try
- {
- using (var response = await HttpClient.Get(new HttpRequestOptions
- {
- Url = Url,
- LogErrorResponseBody = false,
- BufferContent = false,
- CancellationToken = cancellationToken
- }).ConfigureAwait(false))
- {
- string res = await response.ReadToEndAsync().ConfigureAwait(false);
- return GetWanApiUrl(res.Trim());
- }
- }
- catch (Exception ex)
- {
- Logger.LogError(ex, "Error getting WAN Ip address information");
- }
-
- return null;
- }
-
/// <summary>
/// Removes the scope id from IPv6 addresses.
/// </summary>
@@ -1573,32 +1524,6 @@ namespace Emby.Server.Implementations
HttpPort.ToString(CultureInfo.InvariantCulture));
}
- public string GetWanApiUrl(IPAddress ipAddress)
- {
- if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
- {
- var str = RemoveScopeId(ipAddress.ToString());
-
- return GetWanApiUrl("[" + str + "]");
- }
-
- return GetWanApiUrl(ipAddress.ToString());
- }
-
- public string GetWanApiUrl(string host)
- {
- if (EnableHttps)
- {
- return string.Format("https://{0}:{1}",
- host,
- ServerConfigurationManager.Configuration.PublicHttpsPort.ToString(CultureInfo.InvariantCulture));
- }
-
- return string.Format("http://{0}:{1}",
- host,
- ServerConfigurationManager.Configuration.PublicPort.ToString(CultureInfo.InvariantCulture));
- }
-
public Task<List<IPAddress>> GetLocalIpAddresses(CancellationToken cancellationToken)
{
return GetLocalIpAddressesInternal(true, 0, cancellationToken);
diff --git a/MediaBrowser.Model/System/PublicSystemInfo.cs b/MediaBrowser.Model/System/PublicSystemInfo.cs
index d6e031e42..23f6d378c 100644
--- a/MediaBrowser.Model/System/PublicSystemInfo.cs
+++ b/MediaBrowser.Model/System/PublicSystemInfo.cs
@@ -9,12 +9,6 @@ namespace MediaBrowser.Model.System
public string LocalAddress { get; set; }
/// <summary>
- /// Gets or sets the wan address.
- /// </summary>
- /// <value>The wan address.</value>
- public string WanAddress { get; set; }
-
- /// <summary>
/// Gets or sets the name of the server.
/// </summary>
/// <value>The name of the server.</value>
@@ -25,7 +19,7 @@ namespace MediaBrowser.Model.System
/// </summary>
/// <value>The version.</value>
public string Version { get; set; }
-
+
/// <summary>
/// The product name. This is the AssemblyProduct name.
/// </summary>