static void Main(string[] args) { if (!args.Any()) { MainClient(); return; } RiverInit.RegAll(); _timer = new Timer(Tick, null, 1000, 1000); // ObjectTracker.TypesToPrint.Add(typeof(Handler)); var server1 = new SocksServer { Chain = { // "ss://*****:*****@127.0.0.1:8338", }, }; server1.Run("socks://0.0.0.0:1080"); /* * var server2 = new ShadowSocksServer * { * Chain = * { * // "ss://*****:*****@127.0.0.1:8338", * }, * }; * server2.Run("ss://*****:*****@0.0.0.0:8338"); */ string q; do { q = Console.ReadLine(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.WaitForFullGCApproach(); foreach (var item in ObjectTracker.Default.Get <Thread>()) { Console.WriteLine(Stringify.ToString(item, true)); } } while (q != "q"); }
static void Main(string[] args) { Trace.WriteLine(TraceCategory.Misc, "Logger started..."); RiverInit.RegAll(); var servers = new List <(RiverServer, Uri)>(); var forwarders = new List <string>(); for (var i = 0; i < args.Length; i++) { switch (args[i].ToUpperInvariant()) { case "-L": { // Listen var listener = args[++i]; var uri = new Uri(listener); var serverType = Resolver.GetServerType(uri); if (serverType == null) { throw new Exception($"Server type {uri.Scheme} is unknown"); } var server = (RiverServer)Activator.CreateInstance(serverType); servers.Add((server, uri)); break; } case "-F": { // Forward var proxy = args[++i]; forwarders.Add(proxy); break; } case "-VERSION": { Console.WriteLine("Version 0.8.9"); break; } case "-EVENTLOG": { Console.WriteLine("Generting event log..."); if (int.TryParse(args[++i], out var eventId)) { using (var eventLog = new System.Diagnostics.EventLog("Application")) { eventLog.Source = "Application"; eventLog.WriteEntry("EventLogTriggeer", System.Diagnostics.EventLogEntryType.Information, eventId); } } break; } default: break; } } foreach (var(server, uri) in servers) { foreach (var fwd in forwarders) { server.Chain.Add(fwd); } server.Run(uri); } Console.WriteLine("Press any key to stop . . ."); Console.ReadLine(); }
static TestClass() { RiverInit.RegAll(); }