diff --git a/src/Nyangate.Cli/Nyangate.Cli.csproj b/src/Nyangate.Cli/Nyangate.Cli.csproj
index d439800..f02677b 100644
--- a/src/Nyangate.Cli/Nyangate.Cli.csproj
+++ b/src/Nyangate.Cli/Nyangate.Cli.csproj
@@ -1,10 +1,10 @@
-
-
-
- Exe
- net7.0
- enable
- enable
-
-
-
+
+
+
+ Exe
+ net7.0
+ enable
+ enable
+
+
+
diff --git a/src/Nyangate.Cli/Program.cs b/src/Nyangate.Cli/Program.cs
index d123c73..1dee9b3 100644
--- a/src/Nyangate.Cli/Program.cs
+++ b/src/Nyangate.Cli/Program.cs
@@ -1 +1 @@
-Console.WriteLine("meow~");
+Console.WriteLine("meow~");
diff --git a/src/Nyangate.Lib/Nyangate.Lib.csproj b/src/Nyangate.Lib/Nyangate.Lib.csproj
index 4658cbf..cfadb03 100644
--- a/src/Nyangate.Lib/Nyangate.Lib.csproj
+++ b/src/Nyangate.Lib/Nyangate.Lib.csproj
@@ -1,9 +1,9 @@
-
-
-
- net7.0
- enable
- enable
-
-
-
+
+
+
+ net7.0
+ enable
+ enable
+
+
+
diff --git a/src/Nyangate/Middleware/Authenticator.cs b/src/Nyangate/Middleware/Authenticator.cs
new file mode 100644
index 0000000..f74aedb
--- /dev/null
+++ b/src/Nyangate/Middleware/Authenticator.cs
@@ -0,0 +1,17 @@
+namespace Nyangate.Middleware;
+
+public class Authenticator
+{
+ private readonly RequestDelegate _next;
+
+ public Authenticator(RequestDelegate next)
+ {
+ _next = next;
+ }
+
+ public async Task Invoke(HttpContext ctx)
+ {
+ //do smth
+ await _next.Invoke(ctx);
+ }
+}
diff --git a/src/Nyangate/Middleware/Filter.cs b/src/Nyangate/Middleware/Filter.cs
new file mode 100644
index 0000000..7dbb085
--- /dev/null
+++ b/src/Nyangate/Middleware/Filter.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Nyangate.Middleware;
+
+public class Filter
+{
+ private readonly RequestDelegate _next;
+ public Filter(RequestDelegate next)
+ {
+ this._next = next;
+ }
+
+ public async Task Invoke(HttpContext ctx)
+ {
+ //do smth
+ await _next.Invoke(ctx);
+ }
+}
diff --git a/src/Nyangate/Middleware/IDSFilter.cs b/src/Nyangate/Middleware/IDSFilter.cs
new file mode 100644
index 0000000..8582bfc
--- /dev/null
+++ b/src/Nyangate/Middleware/IDSFilter.cs
@@ -0,0 +1,17 @@
+namespace Nyangate.Middleware;
+
+public class IDSFilter
+{
+ private readonly RequestDelegate _next;
+
+ public IDSFilter(RequestDelegate next)
+ {
+ _next = next;
+ }
+
+ public async Task Invoke(HttpContext ctx)
+ {
+ //do smth
+ await _next.Invoke(ctx);
+ }
+}
diff --git a/src/Nyangate/Middleware/IPFilter.cs b/src/Nyangate/Middleware/IPFilter.cs
new file mode 100644
index 0000000..7d2ea9b
--- /dev/null
+++ b/src/Nyangate/Middleware/IPFilter.cs
@@ -0,0 +1,17 @@
+namespace Nyangate.Middleware;
+
+public class IPFilter
+{
+ private readonly RequestDelegate _next;
+
+ public IPFilter(RequestDelegate next)
+ {
+ _next = next;
+ }
+
+ public async Task Invoke(HttpContext ctx)
+ {
+ //do smth
+ await _next.Invoke(ctx);
+ }
+}
diff --git a/src/Nyangate/Middleware/Router.cs b/src/Nyangate/Middleware/Router.cs
new file mode 100644
index 0000000..4594ed2
--- /dev/null
+++ b/src/Nyangate/Middleware/Router.cs
@@ -0,0 +1,25 @@
+using Nyangate.Services;
+
+namespace Nyangate.Middleware
+{
+ public class Router
+ {
+ private readonly RequestDelegate _next;
+ private readonly RoutingMap _map;
+
+ public Router(RequestDelegate next, RoutingMap map)
+ {
+ _next = next;
+ _map = map;
+ }
+
+ public async Task Invoke(HttpContext ctx)
+ {
+ string host = ctx.Request.Host.Host;
+ //check ctx.Request.IsHttps if strict https required
+ Console.WriteLine($"meow: {ctx.Connection.RemoteIpAddress}");
+ ctx.Response.StatusCode = 200;
+ await _next.Invoke(ctx);
+ }
+ }
+}
diff --git a/src/Nyangate/Nyangate.csproj b/src/Nyangate/Nyangate.csproj
index 72a1294..4c2bb77 100644
--- a/src/Nyangate/Nyangate.csproj
+++ b/src/Nyangate/Nyangate.csproj
@@ -1,9 +1,9 @@
-
-
-
- net7.0
- enable
- enable
-
-
-
+
+
+
+ net7.0
+ enable
+ enable
+
+
+
diff --git a/src/Nyangate/Program.cs b/src/Nyangate/Program.cs
index 7dd389f..fbbb356 100644
--- a/src/Nyangate/Program.cs
+++ b/src/Nyangate/Program.cs
@@ -1,6 +1,34 @@
-var builder = WebApplication.CreateBuilder(args);
-var app = builder.Build();
-
-app.MapGet("/", () => "meow~");
-
-app.Run();
+using Microsoft.AspNetCore.Components.Routing;
+using Nyangate;
+using Nyangate.Middleware;
+using Nyangate.Services;
+
+var builder = WebApplication.CreateBuilder(args);
+
+builder.Services.AddSingleton();
+builder.Services.AddSingleton();
+
+//TODO: Replace with DI
+var certs = new ServerCertificateRegistry();
+
+builder.WebHost.UseKestrel(o =>
+{
+ o.AddServerHeader = false;
+ o.ConfigureHttpsDefaults(https =>
+ {
+ https.ServerCertificateSelector = (_, name) =>
+ name is not null ? certs.GetOrDefault(name) : certs.Default();
+ });
+ o.ConfigureEndpointDefaults(ep =>
+ {
+ ep.UseConnectionLogging();
+ });
+});
+
+var app = builder.Build();
+
+app.UseMiddleware();
+app.UseMiddleware();
+app.UseMiddleware();
+
+app.Run();
diff --git a/src/Nyangate/Properties/launchSettings.json b/src/Nyangate/Properties/launchSettings.json
index 701a318..9b1a041 100644
--- a/src/Nyangate/Properties/launchSettings.json
+++ b/src/Nyangate/Properties/launchSettings.json
@@ -1,37 +1,37 @@
-{
- "iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:17984",
- "sslPort": 44337
- }
- },
- "profiles": {
- "http": {
- "commandName": "Project",
- "dotnetRunMessages": true,
- "launchBrowser": true,
- "applicationUrl": "http://localhost:5178",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- },
- "https": {
- "commandName": "Project",
- "dotnetRunMessages": true,
- "launchBrowser": true,
- "applicationUrl": "https://localhost:7056;http://localhost:5178",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- },
- "IIS Express": {
- "commandName": "IISExpress",
- "launchBrowser": true,
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- }
- }
-}
+{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:17984",
+ "sslPort": 44337
+ }
+ },
+ "profiles": {
+ "http": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "http://localhost:5178",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "https": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "launchBrowser": true,
+ "applicationUrl": "https://localhost:7056;http://localhost:5178",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/src/Nyangate/Services/BlacklistRegistry.cs b/src/Nyangate/Services/BlacklistRegistry.cs
new file mode 100644
index 0000000..5c74d45
--- /dev/null
+++ b/src/Nyangate/Services/BlacklistRegistry.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Nyangate.Services;
+
+public class BlacklistRegistry
+{
+
+}
diff --git a/src/Nyangate/Services/RoutingMap.cs b/src/Nyangate/Services/RoutingMap.cs
new file mode 100644
index 0000000..94d27de
--- /dev/null
+++ b/src/Nyangate/Services/RoutingMap.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Nyangate.Services;
+
+public class RoutingMap
+{
+
+}
diff --git a/src/Nyangate/Services/ServerCertificateRegistry.cs b/src/Nyangate/Services/ServerCertificateRegistry.cs
new file mode 100644
index 0000000..b989cc7
--- /dev/null
+++ b/src/Nyangate/Services/ServerCertificateRegistry.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography.X509Certificates;
+using System.Threading.Tasks;
+
+namespace Nyangate.Services;
+
+public class ServerCertificateRegistry
+{
+ private readonly Dictionary _registry = new();
+ public X509Certificate2 GetOrDefault(string hostname)
+ {
+ return _registry.GetValueOrDefault(hostname, Default());
+ }
+
+ public X509Certificate2 Default()
+ {
+ throw new NotImplementedException();
+ }
+}
diff --git a/src/Nyangate/appsettings.Development.json b/src/Nyangate/appsettings.Development.json
index ff66ba6..0c208ae 100644
--- a/src/Nyangate/appsettings.Development.json
+++ b/src/Nyangate/appsettings.Development.json
@@ -1,8 +1,8 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.AspNetCore": "Warning"
- }
- }
-}
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/src/Nyangate/appsettings.json b/src/Nyangate/appsettings.json
index 4d56694..10f68b8 100644
--- a/src/Nyangate/appsettings.json
+++ b/src/Nyangate/appsettings.json
@@ -1,9 +1,9 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft.AspNetCore": "Warning"
- }
- },
- "AllowedHosts": "*"
-}
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*"
+}
diff --git a/test/Nyangate.Test/Nyangate.Test.csproj b/test/Nyangate.Test/Nyangate.Test.csproj
index 86a36ef..6f5763e 100644
--- a/test/Nyangate.Test/Nyangate.Test.csproj
+++ b/test/Nyangate.Test/Nyangate.Test.csproj
@@ -1,24 +1,30 @@
-
-
-
- net7.0
- enable
- enable
-
- false
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
-
-
+
+
+
+ net7.0
+ enable
+ enable
+
+ false
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+
+
+