diff --git a/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Endpoint.cs b/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Endpoint.cs index 32c3dae..194e16e 100644 --- a/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Endpoint.cs +++ b/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Endpoint.cs @@ -184,8 +184,8 @@ namespace LightReflectiveMirror.LoadBalancing services.Configure(options => options.MinLevel = LogLevel.None); }, (server) => { - server.Prefixes.Add($"http://{GetLocalIp()}:{port}/"); - server.Prefixes.Add($"http://*:{port}/"); + foreach(string ip in GetLocalIps()) + server.Prefixes.Add($"http://{ip}:{port}/"); }).Build(); server.Router.Options.SendExceptionMessages = false; @@ -199,19 +199,20 @@ namespace LightReflectiveMirror.LoadBalancing } } - private static string GetLocalIp() + private static List GetLocalIps() { var host = Dns.GetHostEntry(Dns.GetHostName()); + List bindableIPv4Addresses = new(); foreach (var ip in host.AddressList) { - if (ip.AddressFamily == AddressFamily.InterNetwork && ip.ToString() != "127.0.0.1") + if (ip.AddressFamily == AddressFamily.InterNetwork) { - return ip.ToString(); + bindableIPv4Addresses.Add(ip.ToString()); } } - return null; + return bindableIPv4Addresses; } #endregion