-
Notifications
You must be signed in to change notification settings - Fork 2
/
Program.cs
43 lines (40 loc) · 1.46 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Threading;
using atlas.Data;
using atlas.Servers;
using atlas.Servers.Gemini;
using atlas.Servers.Spartan;
namespace atlas
{
internal class Program
{
public static string Version = "0.3";
public static Configuration Cfg;
public static GeminiServer GeminiServer;
public static SpartanServer SpartanServer;
private static void Main()
{
Console.WriteLine("Loading MimeMap...");
MimeMap.LoadMimeMap();
Console.WriteLine("Loading Config...");
Cfg = Configuration.Load();
Console.WriteLine("Starting Gemini...");
GeminiServer = new();
GeminiServer.Start();
Console.WriteLine("Starting Spartan...");
SpartanServer = new();
SpartanServer.Start();
Console.WriteLine($"Atlas/{Version} Ready!");
Statistics.Load();
while (true)
Thread.Sleep(int.MaxValue);
}
public static void Log(Context ctx, string text)
{
if (string.IsNullOrWhiteSpace(ctx.Request))
Console.WriteLine($"[{ctx.Capsule?.FQDN}] [{(ctx.IsGemini ? "Gemini" : "Spartan")}] {ctx.ClientIP} -> {text}");
else
Console.WriteLine($"[{ctx.Capsule?.FQDN}] [{(ctx.IsGemini ? "Gemini" : "Spartan")}] {ctx.ClientIP} -> {ctx.Request.Trim()} -> {text}");
}
}
}