Archived
1
0
Fork 0
forked from Moux23333/FreeSR
This repository has been archived on 2024-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
FreeSR/FreeSR.Dispatch/Service/HttpDispatchService.cs

44 lines
2.2 KiB
C#
Raw Normal View History

2024-01-27 13:06:07 +00:00
namespace FreeSR.Dispatch.Service
{
using Ceen.Httpd;
using Ceen.Httpd.Logging;
using FreeSR.Dispatch.Handlers;
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());
2024-01-27 13:06:07 +00:00
}
private static async Task BootHttpAsync(NetworkConfiguration config)
{
await HttpServer.ListenAsync(new IPEndPoint(
IPAddress.Parse(config.Host),
config.Port),
false, s_httpdConfiguration);
}
}
}