Added the localhost listen variant.
This commit is contained in:
@@ -32,7 +32,7 @@ Error message: {0}", error); }
|
||||
public static string WebserverPortDescription { get { return LC.L(@"The port the webserver listens on. Multiple values may be supplied with a comma in between."); } }
|
||||
public static string WebserverCertificateFileDescription { get { return LC.L(@"The certificate and key file in PKCS #12 format the webserver use for SSL. Only RSA/DSA keys are supported."); } }
|
||||
public static string WebserverCertificatePasswordDescription { get { return LC.L(@"The password for decryption of certificate PKCS #12 file."); } }
|
||||
public static string WebserverInterfaceDescription { get { return LC.L(@"The interface the webserver listens on. The special values ""*"" and ""any"" means any interface. The special value ""loopback"" means the loopback adapter and ""ipv6loopback"" means IPv6 loopback."); } }
|
||||
public static string WebserverInterfaceDescription { get { return LC.L(@"The interface the webserver listens on. The special values ""*"" and ""any"" means any interface. The special value ""loopback"" means the loopback adapter"); } }
|
||||
public static string WebserverPasswordDescription { get { return LC.L(@"The password required to access the webserver. This option is saved so you do not need to set it on each run. Setting an empty value disables the password."); } }
|
||||
public static string WebserverAllowedhostnamesDescription { get { return LC.L(@"The hostnames that are accepted, separated with semicolons. If any of the hostnames are ""*"", all hostnames are allowed and the hostname checking is disabled."); } }
|
||||
public static string PingpongkeepaliveLong { get { return LC.L(@"When running as a server, the service daemon must verify that the process is responding. If this option is enabled, the server reads stdin and writes a reply to each line read."); } }
|
||||
|
||||
@@ -173,8 +173,6 @@ public static class WebServerLoader
|
||||
interfacestring = interfacestring.Trim();
|
||||
if (new[] { "*", "all", "any" }.Any(x => x.Equals(interfacestring, StringComparison.OrdinalIgnoreCase)))
|
||||
listenInterface = System.Net.IPAddress.Any;
|
||||
else if (interfacestring == "ipv6loopback")
|
||||
listenInterface = System.Net.IPAddress.IPv6Loopback;
|
||||
else if (interfacestring != "loopback")
|
||||
listenInterface = System.Net.IPAddress.Parse(interfacestring);
|
||||
|
||||
|
||||
@@ -107,6 +107,14 @@ public partial class DuplicatiWebserver
|
||||
listenOptions.UseHttps(settings.Certificate);
|
||||
});
|
||||
}
|
||||
else if (settings.Interface == System.Net.IPAddress.Loopback)
|
||||
{
|
||||
options.ListenLocalhost(settings.Port, listenOptions =>
|
||||
{
|
||||
if (settings.Certificate != null)
|
||||
listenOptions.UseHttps(settings.Certificate);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
options.Listen(settings.Interface, settings.Port, listenOptions =>
|
||||
|
||||
Reference in New Issue
Block a user