-
Notifications
You must be signed in to change notification settings - Fork 16
/
Program.cs
63 lines (55 loc) · 1.65 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Collections;
using System.Threading;
using System.IO;
using CommandLine;
using CommandLine.Text;
using System.Diagnostics;
using CnCNet.Net.Tunnel;
using CnCNet.Net.PeerToPeer;
namespace CnCNetServer
{
class Program
{
static void Main(string[] args)
{
var result = Parser.Default.ParseArguments<Options>(args);
Console.WriteLine(HelpText.AutoBuild(result, null, null));
Options o = ((Parsed<Options>)result).Value;
if (!o.NoPeerToPeer)
{
PeerToPeerUtil.StartNew(8054);
PeerToPeerUtil.StartNew(3478);
}
var tunnelV3Task =
new TunnelV3(
o.TunnelPort,
o.MaxClients,
o.Name,
o.NoMasterAnnounce,
o.MasterPassword,
o.MaintenancePassword,
o.MasterServerURL,
o.IpLimit)
.Start();
var tunnelV2Task =
new TunnelV2(
o.TunnelV2Port,
o.MaxClients,
o.Name,
o.NoMasterAnnounce,
o.MasterPassword,
o.MaintenancePassword,
o.MasterServerURL,
o.IpLimitV2)
.Start();
Console.WriteLine("[{0} UTC] CnCNet server running...", DateTime.UtcNow);
tunnelV3Task.Wait();
}
}
}