mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-24 16:46:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b341bea14 | ||
|
|
af371c92ef | ||
|
|
ff49e895ec | ||
|
|
0e9fb4b41c | ||
|
|
4f00bf1ee7 | ||
|
|
a519c0daed | ||
|
|
1f98102e5a | ||
|
|
93fdc83ce7 | ||
|
|
e29552ca28 | ||
|
|
8eee7f888f |
No files matched your search
+2
-2
@@ -39,7 +39,7 @@ WORKDIR /app
|
||||
COPY --from=build /app ./
|
||||
|
||||
# Add Impostor.Http as a default built-in plugin
|
||||
ADD https://github.com/Impostor/Impostor.Http/releases/download/v0.4.0/Impostor.Http.dll /app/builtin-plugins/
|
||||
ADD https://github.com/Impostor/Impostor.Http/releases/download/v0.5.0/Impostor.Http.dll /app/builtin-plugins/
|
||||
# Make it listen to 0.0.0.0 to expose it to the outside world.
|
||||
ENV IMPOSTOR_HTTP_HttpServer__ListenIp=0.0.0.0
|
||||
# Override ASPNETCORE_URLS to stop warning.
|
||||
@@ -47,5 +47,5 @@ ENV ASPNETCORE_URLS=
|
||||
# Enable the built-in plugin folder. Use a high number to prevent conflicts with existing configurations
|
||||
ENV IMPOSTOR_PluginLoader__Paths__76=/app/builtin-plugins
|
||||
|
||||
EXPOSE 22000/tcp 22023/udp
|
||||
EXPOSE 22023/tcp 22023/udp
|
||||
ENTRYPOINT ["./Impostor.Server"]
|
||||
@@ -8,19 +8,18 @@ This section applies to both the normal installation as well as the Docker (Comp
|
||||
|
||||
To connect to the server, you need to configure and install a region file on https://impostor.github.io/Impostor/
|
||||
|
||||
Depending on your host you may also need to port forward Impostor to the internet or pass Impostor traffic by your firewall. By default Impostor uses two ports:
|
||||
Among Us connects to the server using two network services: the (TCP) HTTP service points Among Us to the UDP service, then the UDP service hosts the actual game traffic. Because of this, Impostor uses port 22023 using **both** the TCP and UDP protocols.
|
||||
|
||||
- Port **22023** using the **UDP** protocol
|
||||
- Port **22000** using the **TCP** protocol
|
||||
As the phone version of Among Us requires this HTTP connection to be secure, we recommend using a HTTP reverse proxy to terminate SSL on the HTTP service. Setup instructions for this are in the [Impostor.Http readme](https://github.com/Impostor/Impostor.Http#readme).
|
||||
|
||||
As port forwarding changes per host or router configuration, port forwarding is not covered by this guide.
|
||||
Depending on your host you may also need to port forward Impostor to the internet or pass Impostor traffic by your firewall. Port 22023 UDP needs to be accessible for everyone that wants to play on the server, then you also need to portforward your HTTP reverse proxy or port 22023 TCP if you don't use a reverse proxy. As port forwarding changes per host or router configuration, port forwarding is not covered by this guide.
|
||||
|
||||
## Normal installation
|
||||
|
||||
1. Install [.NET 7.0](https://dotnet.microsoft.com/download/dotnet/7.0). We recommend either the ASP.NET Core Runtime or the SDK. The SDK is necessary in case you want to develop Impostor or Impostor plugins.
|
||||
2. Download the [latest release](https://github.com/Impostor/Impostor/releases) or the [latest CI build](https://nightly.link/Impostor/Impostor/workflows/ci/master). Note that Impostor is built for multiple CPU-architectures and operating systems, you most likely want the x64 version, unless you are running on a Raspberry Pi or another device with an ARM processor.
|
||||
2. Download the [latest release](https://github.com/Impostor/Impostor/releases) or the [latest CI build](https://nightly.link/Impostor/Impostor/workflows/ci/master). Note that Impostor is built for multiple CPU-architectures and operating systems, you most likely want the x64 version, unless you are running on a Raspberry Pi or another device with an Arm processor.
|
||||
3. Extract the zip.
|
||||
4. Download the [Impostor.Http](https://github.com/Impostor/Impostor.Http) plugin and put it in your `plugins` folder.
|
||||
4. Download the [Impostor.Http](https://github.com/Impostor/Impostor.Http) plugin and put it in your `plugins` folder. Please note the Reverse Proxy configuration: you either need to configure a reverse proxy to terminate SSL or expose the service to the world by changing ListenIp.
|
||||
5. Modify `config.json` to your liking. Documentation can be found [here](Server-configuration.md). You need to at least change `PublicIp` to the address people will connect to your server to.
|
||||
6. Run `Impostor.Server` (Linux/macOS) or `Impostor.Server.exe` (Windows)
|
||||
7. (OPTIONAL - Linux) Configure a systemd definition file and enable the service to start on boot - [systemd configuration](Server-configuration.md#systemd)
|
||||
@@ -35,7 +34,7 @@ Docker is a program that allows you to run programs like Impostor in a container
|
||||
After installing Docker, you can just start a Docker container with `docker run`:
|
||||
|
||||
```
|
||||
docker run -p 22000:22000/tcp -p 22023:22023/udp -e IMPOSTOR_Server__PublicIp=your.public.ip.here aeonlucid/impostor:nightly
|
||||
docker run -p 127.0.0.1:22023:22023/tcp -p 22023:22023/udp -e IMPOSTOR_Server__PublicIp=your.public.ip.here aeonlucid/impostor:nightly
|
||||
```
|
||||
|
||||
Please replace `your.public.ip.here` with the public IP address of your server. This is the address Among Us will try to reach your client at.
|
||||
@@ -54,7 +53,7 @@ services:
|
||||
image: aeonlucid/impostor:nightly
|
||||
container_name: impostor
|
||||
ports:
|
||||
- 22000:22000/tcp
|
||||
- 127.0.0.1:22023:22023/tcp
|
||||
- 22023:22023/udp
|
||||
environment: # Either configure Impostor using environment variables or mount a copy of config.json
|
||||
- IMPOSTOR_Server__PublicIp=your.public.ip.here
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<LangVersion>11</LangVersion>
|
||||
<VersionPrefix>1.8.2</VersionPrefix>
|
||||
<VersionPrefix>1.8.4</VersionPrefix>
|
||||
<VersionSuffix>dev</VersionSuffix>
|
||||
<EnforceCodeStyleInBuild Condition="$(MSBuildProjectName)!='Hazel'">true</EnforceCodeStyleInBuild>
|
||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Impostor.Api.Config
|
||||
{
|
||||
public class TimeoutConfig
|
||||
{
|
||||
public const string Section = "Timeout";
|
||||
|
||||
public int SpawnTimeout { get; set; } = 2500;
|
||||
|
||||
public int ConnectionTimeout { get; set; } = 2500;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Impostor.Server
|
||||
{
|
||||
internal static class Constants
|
||||
{
|
||||
public const int SpawnTimeout = 2500;
|
||||
public const int ConnectionTimeout = 2500;
|
||||
}
|
||||
}
|
||||
@@ -513,36 +513,40 @@ namespace Impostor.Server.Net.Inner.Objects
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!RequestedPlayerName.Any())
|
||||
if (RequestedPlayerName.Any())
|
||||
{
|
||||
_logger.LogWarning($"Client sent {nameof(RpcCalls.SetName)} for a player that didn't request it");
|
||||
return false;
|
||||
}
|
||||
var expected = RequestedPlayerName.Dequeue();
|
||||
|
||||
var expected = RequestedPlayerName.Dequeue();
|
||||
|
||||
if (Game.Players.Any(x => x.Character != null && x.Character != this && x.Character.PlayerInfo.PlayerName == expected))
|
||||
{
|
||||
var i = 1;
|
||||
while (true)
|
||||
if (Game.Players.Any(x => x.Character != null && x.Character != this && x.Character.PlayerInfo.PlayerName == expected))
|
||||
{
|
||||
var text = expected + " " + i;
|
||||
|
||||
if (Game.Players.All(x => x.Character == null || x.Character == this || x.Character.PlayerInfo.PlayerName != text))
|
||||
var i = 1;
|
||||
while (true)
|
||||
{
|
||||
expected = text;
|
||||
break;
|
||||
}
|
||||
var text = expected + " " + i;
|
||||
|
||||
i++;
|
||||
if (Game.Players.All(x => x.Character == null || x.Character == this || x.Character.PlayerInfo.PlayerName != text))
|
||||
{
|
||||
expected = text;
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (name != expected)
|
||||
{
|
||||
_logger.LogWarning($"Client sent {nameof(RpcCalls.SetName)} with incorrect name");
|
||||
await SetNameAsync(expected);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (name != expected)
|
||||
else
|
||||
{
|
||||
_logger.LogWarning($"Client sent {nameof(RpcCalls.SetName)} with incorrect name");
|
||||
await SetNameAsync(expected);
|
||||
return false;
|
||||
if (await sender.Client.ReportCheatAsync(RpcCalls.SetName, $"Client sent {nameof(RpcCalls.SetName)} for a player that didn't request it"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace Impostor.Server.Net.Manager
|
||||
GameVersion.GetVersion(2022, 12, 2), // 2023.2.28
|
||||
GameVersion.GetVersion(2023, 1, 11), // 2023.3.28s
|
||||
GameVersion.GetVersion(2023, 3, 13), // 2023.3.28a
|
||||
GameVersion.GetVersion(2023, 4, 21), // 2023.6.13
|
||||
GameVersion.GetVersion(2023, 5, 20), // 2023.7.11
|
||||
};
|
||||
|
||||
private readonly ILogger<ClientManager> _logger;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Net;
|
||||
@@ -13,11 +13,13 @@ namespace Impostor.Server.Net.State
|
||||
{
|
||||
private readonly ILogger<ClientPlayer> _logger;
|
||||
private readonly Timer _spawnTimeout;
|
||||
private readonly int _spawnTimeoutTime;
|
||||
|
||||
public ClientPlayer(ILogger<ClientPlayer> logger, ClientBase client, Game game)
|
||||
public ClientPlayer(ILogger<ClientPlayer> logger, ClientBase client, Game game, int timeOutTime)
|
||||
{
|
||||
_logger = logger;
|
||||
_spawnTimeout = new Timer(RunSpawnTimeout!, null, -1, -1);
|
||||
_spawnTimeoutTime = timeOutTime;
|
||||
|
||||
Game = game;
|
||||
Client = client;
|
||||
@@ -41,7 +43,7 @@ namespace Impostor.Server.Net.State
|
||||
|
||||
public void InitializeSpawnTimeout()
|
||||
{
|
||||
_spawnTimeout.Change(Constants.SpawnTimeout, -1);
|
||||
_spawnTimeout.Change(_spawnTimeoutTime, -1);
|
||||
}
|
||||
|
||||
public void DisableSpawnTimeout()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api.Games;
|
||||
@@ -188,7 +188,7 @@ namespace Impostor.Server.Net.State
|
||||
|
||||
if (player == null || player.Game != this)
|
||||
{
|
||||
var clientPlayer = new ClientPlayer(_serviceProvider.GetRequiredService<ILogger<ClientPlayer>>(), client, this);
|
||||
var clientPlayer = new ClientPlayer(_serviceProvider.GetRequiredService<ILogger<ClientPlayer>>(), client, this, _timeoutConfig.SpawnTimeout);
|
||||
|
||||
if (!_clientManager.Validate(client))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Impostor.Api;
|
||||
using Impostor.Api.Innersloth;
|
||||
@@ -76,7 +76,7 @@ namespace Impostor.Server.Net.State
|
||||
// Player can refuse to be kicked and keep the connection open, check for this.
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(Constants.ConnectionTimeout);
|
||||
await Task.Delay(_timeoutConfig.ConnectionTimeout);
|
||||
|
||||
if (player.Client.Connection.IsConnected && player.Client.Connection is HazelConnection hazel)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace Impostor.Server.Net.State
|
||||
private readonly HashSet<IPAddress> _bannedIps;
|
||||
private readonly IEventManager _eventManager;
|
||||
private readonly CompatibilityConfig _compatibilityConfig;
|
||||
private readonly TimeoutConfig _timeoutConfig;
|
||||
|
||||
public Game(
|
||||
ILogger<Game> logger,
|
||||
@@ -41,7 +42,8 @@ namespace Impostor.Server.Net.State
|
||||
GameFilterOptions filterOptions,
|
||||
ClientManager clientManager,
|
||||
IEventManager eventManager,
|
||||
IOptions<CompatibilityConfig> compatibilityConfig)
|
||||
IOptions<CompatibilityConfig> compatibilityConfig,
|
||||
IOptions<TimeoutConfig> timeoutConfig)
|
||||
{
|
||||
_logger = logger;
|
||||
_serviceProvider = serviceProvider;
|
||||
@@ -59,6 +61,7 @@ namespace Impostor.Server.Net.State
|
||||
_clientManager = clientManager;
|
||||
_eventManager = eventManager;
|
||||
_compatibilityConfig = compatibilityConfig.Value;
|
||||
_timeoutConfig = timeoutConfig.Value;
|
||||
Items = new ConcurrentDictionary<object, object>();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -99,6 +99,7 @@ namespace Impostor.Server
|
||||
services.Configure<AntiCheatConfig>(host.Configuration.GetSection(AntiCheatConfig.Section));
|
||||
services.Configure<CompatibilityConfig>(host.Configuration.GetSection(CompatibilityConfig.Section));
|
||||
services.Configure<ServerConfig>(host.Configuration.GetSection(ServerConfig.Section));
|
||||
services.Configure<TimeoutConfig>(host.Configuration.GetSection(TimeoutConfig.Section));
|
||||
|
||||
services.AddSingleton<ClientManager>();
|
||||
services.AddSingleton<IClientManager>(p => p.GetRequiredService<ClientManager>());
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
"Enabled": true,
|
||||
"BanIpFromGame": true
|
||||
},
|
||||
"Timeout": {
|
||||
"SpawnTimeout": 2500,
|
||||
"ConnectionTimeout": 2500
|
||||
},
|
||||
"Compatibility": {
|
||||
"AllowFutureGameVersions": false,
|
||||
"AllowVersionMixing": false
|
||||
|
||||
Reference in new issue
Block a user