--- /dev/null
+namespace Impostor.Api.Config
+{
+ public class AntiCheatConfig
+ {
+ public const string Section = "AntiCheat";
+
+ public bool Enabled { get; set; } = true;
+
+ public bool BanIpFromGame { get; set; } = true;
+ }
+}
--- /dev/null
+namespace Impostor.Api.Config
+{
+ public class CompatibilityConfig
+ {
+ public const string Section = "Compatibility";
+
+ public bool AllowFutureGameVersions { get; set; } = false;
+
+ public bool AllowVersionMixing { get; set; } = false;
+ }
+}
--- /dev/null
+namespace Impostor.Api.Config
+{
+ public class DebugConfig
+ {
+ public const string Section = "Debug";
+
+ public bool GameRecorderEnabled { get; set; }
+
+ public string GameRecorderPath { get; set; } = string.Empty;
+ }
+}
--- /dev/null
+namespace Impostor.Api.Config
+{
+ public static class DisconnectMessages
+ {
+ public const string Error = "There was an internal server error. " +
+ "Check the server console for more information. " +
+ "Please report the issue on the Impostor GitHub if it keeps happening.";
+
+ public const string ClientOutdated = "Please update your game to play in this lobby.";
+
+ public const string ClientTooNew = "Your game version is too new for this lobby. " +
+ "If you want to join this lobby you need to downgrade your client.";
+
+ public const string Destroyed = "The game you tried to join is being destroyed. " +
+ "Please create a new game.";
+
+ public const string NotImplemented = "Game listing has not been implemented in Impostor yet for servers " +
+ "running in server redirection mode.";
+
+ public const string UsernameLength = "Your username is too long, please make it shorter.";
+
+ public const string UsernameIllegalCharacters = "Your username contains illegal characters, please remove them.";
+
+ public const string VersionClientTooOld = "Please update your game to play on this server.";
+
+ public const string VersionServerTooOld = "Your client is too new, please update your Impostor server to play.";
+
+ public const string VersionUnsupported = "Your client version is unsupported, please update your Game and/or Impostor server.";
+ }
+}
--- /dev/null
+using Impostor.Api.Utils;
+
+namespace Impostor.Api.Config
+{
+ public class ServerConfig
+ {
+ public const string Section = "Server";
+
+ private string? _resolvedPublicIp;
+ private string? _resolvedListenIp;
+
+ public string PublicIp { get; set; } = "127.0.0.1";
+
+ public ushort PublicPort { get; set; } = 22023;
+
+ public string ListenIp { get; set; } = "127.0.0.1";
+
+ public ushort ListenPort { get; set; } = 22023;
+
+ public string ResolvePublicIp()
+ {
+ return _resolvedPublicIp ??= IpUtils.ResolveIp(PublicIp);
+ }
+
+ public string ResolveListenIp()
+ {
+ return _resolvedListenIp ??= IpUtils.ResolveIp(ListenIp);
+ }
+ }
+}
--- /dev/null
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+
+namespace Impostor.Api.Config
+{
+ public class ServerRedirectorConfig
+ {
+ public const string Section = "ServerRedirector";
+
+ public bool Enabled { get; set; }
+
+ public bool Master { get; set; }
+
+ public NodeLocator? Locator { get; set; }
+
+ public List<ServerRedirectorNode>? Nodes { get; set; }
+
+ public class NodeLocator
+ {
+ [AllowNull]
+ public string Redis { get; set; }
+
+ [AllowNull]
+ public string UdpMasterEndpoint { get; set; }
+ }
+ }
+}
--- /dev/null
+using System.Diagnostics.CodeAnalysis;
+
+namespace Impostor.Api.Config
+{
+ public class ServerRedirectorNode
+ {
+ [AllowNull]
+ public string Ip { get; set; }
+
+ [AllowNull]
+ public ushort Port { get; set; }
+ }
+}
--- /dev/null
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+
+namespace Impostor.Api.Utils
+{
+ internal static class IpUtils
+ {
+ public static string ResolveIp(string ip)
+ {
+ // Check if valid ip was entered.
+ if (!IPAddress.TryParse(ip, out var ipAddress))
+ {
+ // Attempt to resolve DNS.
+ try
+ {
+ var hostAddresses = Dns.GetHostAddresses(ip);
+ if (hostAddresses.Length == 0)
+ {
+ throw new ImpostorConfigException($"Invalid IP Address entered '{ip}'.");
+ }
+
+ // Use first IPv4 result.
+ ipAddress = hostAddresses.First(x => x.AddressFamily == AddressFamily.InterNetwork);
+ }
+ catch (SocketException)
+ {
+ throw new ImpostorConfigException($"Failed to resolve hostname '{ip}'.");
+ }
+ }
+
+ // Only IPv4.
+ if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
+ {
+ throw new ImpostorConfigException($"Invalid IP Address entered '{ipAddress}', only IPv4 is supported by Among Us.");
+ }
+
+ return ipAddress.ToString();
+ }
+ }
+}
+++ /dev/null
-namespace Impostor.Server.Config
-{
- public class AntiCheatConfig
- {
- public const string Section = "AntiCheat";
-
- public bool Enabled { get; set; } = true;
-
- public bool BanIpFromGame { get; set; } = true;
- }
-}
+++ /dev/null
-namespace Impostor.Server.Config
-{
- public class CompatibilityConfig
- {
- public const string Section = "Compatibility";
-
- public bool AllowFutureGameVersions { get; set; } = false;
-
- public bool AllowVersionMixing { get; set; } = false;
- }
-}
+++ /dev/null
-namespace Impostor.Server.Config
-{
- public class DebugConfig
- {
- public const string Section = "Debug";
-
- public bool GameRecorderEnabled { get; set; }
-
- public string GameRecorderPath { get; set; } = string.Empty;
- }
-}
+++ /dev/null
-namespace Impostor.Server.Config
-{
- public static class DisconnectMessages
- {
- public const string Error = "There was an internal server error. " +
- "Check the server console for more information. " +
- "Please report the issue on the Impostor GitHub if it keeps happening.";
-
- public const string ClientOutdated = "Please update your game to play in this lobby.";
-
- public const string ClientTooNew = "Your game version is too new for this lobby. " +
- "If you want to join this lobby you need to downgrade your client.";
-
- public const string Destroyed = "The game you tried to join is being destroyed. " +
- "Please create a new game.";
-
- public const string NotImplemented = "Game listing has not been implemented in Impostor yet for servers " +
- "running in server redirection mode.";
-
- public const string UsernameLength = "Your username is too long, please make it shorter.";
-
- public const string UsernameIllegalCharacters = "Your username contains illegal characters, please remove them.";
-
- public const string VersionClientTooOld = "Please update your game to play on this server.";
-
- public const string VersionServerTooOld = "Your client is too new, please update your Impostor server to play.";
-
- public const string VersionUnsupported = "Your client version is unsupported, please update your Game and/or Impostor server.";
- }
-}
+++ /dev/null
-using Impostor.Server.Utils;
-
-namespace Impostor.Server.Config
-{
- internal class ServerConfig
- {
- public const string Section = "Server";
-
- private string? _resolvedPublicIp;
- private string? _resolvedListenIp;
-
- public string PublicIp { get; set; } = "127.0.0.1";
-
- public ushort PublicPort { get; set; } = 22023;
-
- public string ListenIp { get; set; } = "127.0.0.1";
-
- public ushort ListenPort { get; set; } = 22023;
-
- public string ResolvePublicIp()
- {
- return _resolvedPublicIp ??= IpUtils.ResolveIp(PublicIp);
- }
-
- public string ResolveListenIp()
- {
- return _resolvedListenIp ??= IpUtils.ResolveIp(ListenIp);
- }
- }
-}
+++ /dev/null
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-
-namespace Impostor.Server.Config
-{
- public class ServerRedirectorConfig
- {
- public const string Section = "ServerRedirector";
-
- public bool Enabled { get; set; }
-
- public bool Master { get; set; }
-
- public NodeLocator? Locator { get; set; }
-
- public List<ServerRedirectorNode>? Nodes { get; set; }
-
- public class NodeLocator
- {
- [AllowNull]
- public string Redis { get; set; }
-
- [AllowNull]
- public string UdpMasterEndpoint { get; set; }
- }
- }
-}
+++ /dev/null
-using System.Diagnostics.CodeAnalysis;
-
-namespace Impostor.Server.Config
-{
- public class ServerRedirectorNode
- {
- [AllowNull]
- public string Ip { get; set; }
-
- [AllowNull]
- public ushort Port { get; set; }
- }
-}
using System.Linq;
using System.Threading.Tasks;
using Impostor.Api;
+using Impostor.Api.Config;
using Impostor.Api.Games;
using Impostor.Api.Innersloth;
using Impostor.Api.Net;
using Impostor.Api.Net.Messages.C2S;
using Impostor.Api.Net.Messages.S2C;
using Impostor.Hazel;
-using Impostor.Server.Config;
using Impostor.Server.Net.Manager;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using Impostor.Api.Config;
using Impostor.Api.Events.Managers;
using Impostor.Api.Innersloth;
using Impostor.Api.Net;
using Impostor.Api.Net.Messages;
using Impostor.Hazel;
-using Impostor.Server.Config;
using Impostor.Server.Events.Client;
using Impostor.Server.Net.Factories;
using Microsoft.Extensions.Logging;
using System.Net;
using System.Threading.Tasks;
using Impostor.Api;
+using Impostor.Api.Config;
using Impostor.Api.Events.Managers;
using Impostor.Api.Games;
using Impostor.Api.Games.Managers;
using Impostor.Api.Innersloth;
using Impostor.Api.Net;
-using Impostor.Server.Config;
using Impostor.Server.Events;
using Impostor.Server.Net.Redirector;
using Impostor.Server.Net.State;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
-using Impostor.Server.Config;
+using Impostor.Api.Config;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Threading.Tasks;
+using Impostor.Api.Config;
using Impostor.Api.Innersloth;
using Impostor.Api.Net.Messages;
using Impostor.Api.Net.Messages.C2S;
using Impostor.Api.Net.Messages.S2C;
using Impostor.Hazel;
-using Impostor.Server.Config;
using Impostor.Server.Net.Hazel;
using Impostor.Server.Net.Manager;
using Serilog;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
-using Impostor.Server.Config;
+using Impostor.Api.Config;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using Impostor.Server.Config;
+using Impostor.Api.Config;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Collections.Generic;
using System.Net;
-using Impostor.Server.Config;
+using Impostor.Api.Config;
using Microsoft.Extensions.Options;
namespace Impostor.Server.Net.Redirector
using System.Net;
using System.Numerics;
using System.Threading.Tasks;
+using Impostor.Api.Config;
using Impostor.Api.Events.Managers;
using Impostor.Api.Games;
using Impostor.Api.Innersloth;
using Impostor.Api.Net;
using Impostor.Api.Net.Messages;
using Impostor.Api.Net.Messages.S2C;
-using Impostor.Server.Config;
using Impostor.Server.Events;
using Impostor.Server.Net.Manager;
using Microsoft.Extensions.Logging;
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
+using Impostor.Api.Config;
using Impostor.Api.Events.Managers;
using Impostor.Api.Games;
using Impostor.Api.Games.Managers;
using Impostor.Api.Net.Messages;
using Impostor.Api.Utils;
using Impostor.Hazel.Extensions;
-using Impostor.Server.Config;
using Impostor.Server.Events;
using Impostor.Server.Net;
using Impostor.Server.Net.Custom;
using System.Threading.Tasks;
+using Impostor.Api.Config;
using Impostor.Api.Innersloth;
using Impostor.Api.Net.Custom;
using Impostor.Api.Net.Messages;
-using Impostor.Server.Config;
using Impostor.Server.Net;
using Impostor.Server.Net.Hazel;
using Impostor.Server.Net.Manager;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
+using Impostor.Api.Config;
using Impostor.Api.Games;
using Impostor.Api.Net.Messages;
-using Impostor.Server.Config;
using Impostor.Server.Net;
using Impostor.Server.Utils;
using Microsoft.Extensions.Hosting;
+++ /dev/null
-using System.Linq;
-using System.Net;
-using System.Net.Sockets;
-using Impostor.Api;
-
-namespace Impostor.Server.Utils
-{
- internal static class IpUtils
- {
- public static string ResolveIp(string ip)
- {
- // Check if valid ip was entered.
- if (!IPAddress.TryParse(ip, out var ipAddress))
- {
- // Attempt to resolve DNS.
- try
- {
- var hostAddresses = Dns.GetHostAddresses(ip);
- if (hostAddresses.Length == 0)
- {
- throw new ImpostorConfigException($"Invalid IP Address entered '{ip}'.");
- }
-
- // Use first IPv4 result.
- ipAddress = hostAddresses.First(x => x.AddressFamily == AddressFamily.InterNetwork);
- }
- catch (SocketException)
- {
- throw new ImpostorConfigException($"Failed to resolve hostname '{ip}'.");
- }
- }
-
- // Only IPv4.
- if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
- {
- throw new ImpostorConfigException($"Invalid IP Address entered '{ipAddress}', only IPv4 is supported by Among Us.");
- }
-
- return ipAddress.ToString();
- }
- }
-}