mirror of
https://github.com/Empostor/Empostor.git
synced 2026-10-20 01:46:07 +00:00
Resort
This commit is contained in:
1 parent
0c89f5e07f
commit
40388f319a
14 files changed
+17
-23
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Empostor.Server.Http;
|
||||
namespace Empostor.Server.Http.Admin;
|
||||
|
||||
internal static class AdminTemplateDefaults
|
||||
{
|
||||
@@ -17,6 +17,8 @@ using Empostor.Api.Net;
|
||||
using Empostor.Api.Net.Manager;
|
||||
using Empostor.Server.Http.Admin;
|
||||
using Empostor.Server.Service.Api;
|
||||
using Empostor.Server.Service.Ip;
|
||||
using Empostor.Server.Service.Reactor;
|
||||
using Empostor.Server.Service.Shared;
|
||||
using Empostor.Server.Utils;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
@@ -4,11 +4,11 @@ using Empostor.Api.Config;
|
||||
using Empostor.Api.Games;
|
||||
using Empostor.Api.Games.Managers;
|
||||
using Empostor.Api.Innersloth;
|
||||
using Empostor.Server.Service.Shared;
|
||||
using Empostor.Server.Service.Api;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Empostor.Server.Service.Reactor;
|
||||
|
||||
namespace Empostor.Server.Http;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Threading.Tasks;
|
||||
using Empostor.Api.Config;
|
||||
using Empostor.Server.Net;
|
||||
using Empostor.Server.Service.Auth;
|
||||
using Empostor.Server.Service.Ip;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
@@ -11,16 +11,16 @@ using Empostor.Api.Net;
|
||||
using Empostor.Api.Net.Manager;
|
||||
using Empostor.Api.Service;
|
||||
using Empostor.Server.Events.Client;
|
||||
using Empostor.Server.Http;
|
||||
using Empostor.Server.Net.Factories;
|
||||
using Empostor.Server.Service;
|
||||
using Empostor.Server.Service.Shared;
|
||||
using Empostor.Server.Service.Auth;
|
||||
using Empostor.Server.Utils;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Next.Hazel;
|
||||
using Empostor.Server.Service.Ip;
|
||||
using Empostor.Server.Service.Reactor;
|
||||
|
||||
namespace Empostor.Server.Net.Manager
|
||||
{
|
||||
|
||||
@@ -8,11 +8,11 @@ using Empostor.Api.Config;
|
||||
using Empostor.Api.Events.Managers;
|
||||
using Empostor.Api.Languages;
|
||||
using Empostor.Server.Events.Client;
|
||||
using Empostor.Server.Http;
|
||||
using Empostor.Server.Net.Hazel;
|
||||
using Empostor.Server.Net.Manager;
|
||||
using Empostor.Server.Service.Auth;
|
||||
using Empostor.Server.Service.Firewall;
|
||||
using Empostor.Server.Service.Ip;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.ObjectPool;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
@@ -7,10 +7,10 @@ using Empostor.Api.Games;
|
||||
using Empostor.Api.Net;
|
||||
using Next.Hazel;
|
||||
using Empostor.Server.Events;
|
||||
using Empostor.Server.Service.Shared;
|
||||
using Empostor.Server.Utils;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Empostor.Server.Service.Reactor;
|
||||
|
||||
namespace Empostor.Server.Net.State
|
||||
{
|
||||
|
||||
@@ -44,6 +44,8 @@ using Serilog;
|
||||
using Serilog.Events;
|
||||
using Serilog.Settings.Configuration;
|
||||
using Empostor.Server.Service;
|
||||
using Empostor.Server.Service.Ip;
|
||||
using Empostor.Server.Service.Reactor;
|
||||
|
||||
namespace Empostor.Server
|
||||
{
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Empostor.Server.Service.Shared
|
||||
namespace Empostor.Server.Service.Ip
|
||||
{
|
||||
public class IpGeolocationService
|
||||
{
|
||||
+1
-3
@@ -7,10 +7,8 @@ using Empostor.Api.Languages;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Empostor.Server.Http;
|
||||
namespace Empostor.Server.Service.Ip;
|
||||
|
||||
// Anticheat "Ip request rate limit": rejects TCP (HTTP) requests of IPs that
|
||||
// exceeded the configured quota and answers with a localized hint.
|
||||
public sealed class IpRateLimitMiddleware
|
||||
{
|
||||
private const string MessageKey = IpRateLimitService.MessageKey;
|
||||
+1
-2
@@ -4,10 +4,9 @@ using System.Net;
|
||||
using Empostor.Api.Config;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Empostor.Server.Http;
|
||||
namespace Empostor.Server.Service.Ip;
|
||||
public sealed class IpRateLimitService
|
||||
{
|
||||
// Language key of the localized hint, see Languages/*.json.
|
||||
public const string MessageKey = "ratelimit.too_frequent";
|
||||
|
||||
public const int MaxRequestsPerWindow = 30;
|
||||
+1
-5
@@ -2,12 +2,8 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Empostor.Server.Http;
|
||||
namespace Empostor.Server.Service.Ip;
|
||||
|
||||
// Resolves the real client IP of an HTTP (TCP) request.
|
||||
// Behind a CDN / reverse proxy Connection.RemoteIpAddress is the proxy's
|
||||
// address, so the forwarding headers are checked first — otherwise rate
|
||||
// limiting or banning would hit the CDN node instead of the actual user.
|
||||
public static class RealIpResolver
|
||||
{
|
||||
public static IPAddress? Resolve(HttpContext context)
|
||||
+1
-5
@@ -4,14 +4,10 @@ using Empostor.Api.Events;
|
||||
using Empostor.Api.Events.Client;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Empostor.Server.Service.Shared
|
||||
namespace Empostor.Server.Service.Reactor
|
||||
{
|
||||
// Based on Reactor.Empostor protocol:
|
||||
// https://github.com/NuclearPowered/Reactor.Empostor
|
||||
//
|
||||
// Reactor appends its data after the normal Among Us handshake:
|
||||
// [normal AU handshake] [uint64 header: 7-byte "reactor" magic + 1-byte protocol version]
|
||||
// If protocol >= V3: [packed int modCount] [for each: string id, string version, ushort flags]
|
||||
internal sealed class ReactorHandshakeListener : IEventListener
|
||||
{
|
||||
// "reactor" in ASCII (7 bytes), packed as upper 56 bits of a uint64 in little-endian
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using Empostor.Api.Net;
|
||||
|
||||
namespace Empostor.Server.Service.Shared
|
||||
namespace Empostor.Server.Service.Reactor
|
||||
{
|
||||
|
||||
public static class ReactorModExtensions
|
||||
Reference in new issue
Block a user