Merge branch 'pr/12' into main
This commit is contained in:
commit
ffa04917d9
4 changed files with 60 additions and 3 deletions
16
LoadBalancerProject-DONT-IMPORT-INTO-UNITY/Dockerfile
Normal file
16
LoadBalancerProject-DONT-IMPORT-INTO-UNITY/Dockerfile
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS builder
|
||||
WORKDIR /lrm
|
||||
COPY . .
|
||||
RUN [\
|
||||
"dotnet", "publish", \
|
||||
"--output", "/build/", \
|
||||
"--configuration", "Release",\
|
||||
"--no-self-contained", \
|
||||
"." ]
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine
|
||||
WORKDIR /lrm-lb
|
||||
COPY --from=builder /build/ .
|
||||
ENV LRM_LB_CONFIG_PATH="/config/config-load-balancer.json"
|
||||
CMD [ "./LRM_LoadBalancer" ]
|
||||
ENTRYPOINT [ "./LRM_LoadBalancer" ]
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
@ -19,7 +19,7 @@ namespace LightReflectiveMirror.LoadBalancing
|
|||
private int _pingDelay = 10000;
|
||||
public static bool showDebugLogs = false;
|
||||
const string API_PATH = "/api/stats";
|
||||
const string CONFIG_PATH = "config.json";
|
||||
readonly string CONFIG_PATH = System.Environment.GetEnvironmentVariable("LRM_LB_CONFIG_PATH") ?? "config.json";
|
||||
|
||||
public static Config conf;
|
||||
public static Program instance;
|
||||
|
|
|
|||
17
ServerProject-DONT-IMPORT-INTO-UNITY/Dockerfile
Normal file
17
ServerProject-DONT-IMPORT-INTO-UNITY/Dockerfile
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS builder
|
||||
WORKDIR /lrm
|
||||
COPY . .
|
||||
RUN [\
|
||||
"dotnet", "publish", \
|
||||
"--output", "/build/", \
|
||||
"--configuration", "Release",\
|
||||
"--no-self-contained", \
|
||||
"." ]
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine
|
||||
WORKDIR /lrm
|
||||
COPY --from=builder /build/ .
|
||||
COPY ./MultiCompiled.dll .
|
||||
ENV LRM_CONFIG_PATH="/config/config.json"
|
||||
CMD [ "./LRM" ]
|
||||
ENTRYPOINT [ "./LRM" ]
|
||||
|
|
@ -15,6 +15,30 @@ namespace LightReflectiveMirror
|
|||
{
|
||||
partial class Program
|
||||
{
|
||||
public static Transport transport;
|
||||
public static Program instance;
|
||||
public static Config conf;
|
||||
|
||||
private RelayHandler _relay;
|
||||
private MethodInfo _awakeMethod;
|
||||
private MethodInfo _startMethod;
|
||||
private MethodInfo _updateMethod;
|
||||
private MethodInfo _lateUpdateMethod;
|
||||
|
||||
private DateTime _startupTime;
|
||||
public static string publicIP;
|
||||
private List<int> _currentConnections = new List<int>();
|
||||
public Dictionary<int, IPEndPoint> NATConnections = new Dictionary<int, IPEndPoint>();
|
||||
private BiDictionary<int, string> _pendingNATPunches = new BiDictionary<int, string>();
|
||||
private int _currentHeartbeatTimer = 0;
|
||||
|
||||
private byte[] _NATRequest = new byte[500];
|
||||
private int _NATRequestPosition = 0;
|
||||
|
||||
private UdpClient _punchServer;
|
||||
|
||||
private readonly string CONFIG_PATH = System.Environment.GetEnvironmentVariable("LRM_CONFIG_PATH") ?? "config.json";
|
||||
|
||||
public static void Main(string[] args) => new Program().MainAsync().GetAwaiter().GetResult();
|
||||
public List<Room> GetRooms() => _relay.rooms;
|
||||
|
||||
|
|
@ -39,7 +63,7 @@ namespace LightReflectiveMirror
|
|||
WriteLogMessage("Loading Assembly... ", ConsoleColor.White, true);
|
||||
try
|
||||
{
|
||||
var asm = Assembly.LoadFile(Directory.GetCurrentDirectory() + @"\" + conf.TransportDLL);
|
||||
var asm = Assembly.LoadFile(Path.GetFullPath(conf.TransportDLL));
|
||||
WriteLogMessage($"OK", ConsoleColor.Green);
|
||||
|
||||
WriteLogMessage("\nLoading Transport Class... ", ConsoleColor.White, true);
|
||||
|
|
|
|||
Loading…
Reference in a new issue