fork from 1.3
This commit is contained in:
45
FreeSR.Dispatch/Service/HttpDispatchService.cs
Normal file
45
FreeSR.Dispatch/Service/HttpDispatchService.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
namespace FreeSR.Dispatch.Service
|
||||
{
|
||||
using Ceen.Httpd;
|
||||
using Ceen.Httpd.Logging;
|
||||
using FreeSR.Dispatch.Handlers;
|
||||
using FreeSR.Dispatch.Handlers.Sdk;
|
||||
using FreeSR.Shared.Configuration;
|
||||
using System.Net;
|
||||
|
||||
internal static class HttpDispatchService
|
||||
{
|
||||
private static ServerConfig s_httpdConfiguration;
|
||||
|
||||
public static void Initialize(NetworkConfiguration config)
|
||||
{
|
||||
s_httpdConfiguration = CreateConfiguration();
|
||||
_ = BootHttpAsync(config);
|
||||
}
|
||||
|
||||
private static ServerConfig CreateConfiguration()
|
||||
{
|
||||
return new ServerConfig().AddLogger(new CLFStdOut())
|
||||
.AddRoute("/query_dispatch", new QueryDispatchHandler())
|
||||
.AddRoute("/query_gateway", new QueryGatewayHandler())
|
||||
.AddRoute("/hkrpg_global/mdk/shield/api/login", new LoginRequestHandler())
|
||||
.AddRoute("/hkrpg_global/combo/granter/login/v2/login", new ComboTokenRequestHandler())
|
||||
.AddRoute("/hkrpg_global/mdk/shield/api/verify", new TokenLoginRequestHandler())
|
||||
.AddRoute("/sdk/dataUpload", new SdkDataUploadHandler())
|
||||
.AddRoute("/hkrpg/dataUpload", new HkrpgDataUploadHandler())
|
||||
.AddRoute("/account/risky/api/check", new RiskyApiCheckHandler())
|
||||
.AddRoute("/hkrpg_global/mdk/agreement/api/getAgreementInfos", new GetAgreementInfosHandler())
|
||||
.AddRoute("/data_abtest_api/config/experiment/list", new GetExperimentListHandler())
|
||||
.AddRoute("/hkrpg_global/combo/granter/api/getConfig", new ComboGranterApiGetConfigHandler())
|
||||
.AddRoute("/sdk/createaccount", new CreateAccountHandler());
|
||||
}
|
||||
|
||||
private static async Task BootHttpAsync(NetworkConfiguration config)
|
||||
{
|
||||
await HttpServer.ListenAsync(new IPEndPoint(
|
||||
IPAddress.Parse(config.Host),
|
||||
config.Port),
|
||||
false, s_httpdConfiguration);
|
||||
}
|
||||
}
|
||||
}
|
||||
31
FreeSR.Dispatch/Service/Manager/RegionManager.cs
Normal file
31
FreeSR.Dispatch/Service/Manager/RegionManager.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace FreeSR.Dispatch.Service.Manager
|
||||
{
|
||||
using FreeSR.Dispatch.Configuration;
|
||||
using FreeSR.Proto;
|
||||
|
||||
internal static class RegionManager
|
||||
{
|
||||
private static RegionConfiguration s_configuration;
|
||||
|
||||
public static void Initialize(RegionConfiguration configuration)
|
||||
{
|
||||
s_configuration = configuration;
|
||||
}
|
||||
|
||||
public static List<RegionEntry> GetRegionList()
|
||||
{
|
||||
var region = new RegionEntry
|
||||
{
|
||||
EnvType = s_configuration.EnvType,
|
||||
DispatchUrl = s_configuration.DispatchUrl,
|
||||
Name = s_configuration.Name,
|
||||
DisplayName = s_configuration.Name,
|
||||
Title = s_configuration.Name
|
||||
};
|
||||
|
||||
return new List<RegionEntry> { region };
|
||||
}
|
||||
|
||||
public static string GetTopServerRegionName() => s_configuration.Name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user