public void Start() { GetProcessors(); server_ = new DnsServer(IPAddress.Any, state_.Config.Dns.UdpListeners, state_.Config.Dns.TcpListeners, ProcessDnsQuery); server_.Start(); }
static void Main(string[] args) { using (DnsServer server = new DnsServer(IPAddress.Any, 10, 10, ProcessQuery)) { server.Start(); Console.WriteLine("Press any key to stop server"); Console.ReadLine(); } }
public void StartServer(int?listnerPort = null) { var ipEndPoint = new IPEndPoint(IPAddress.Any, listnerPort ?? DefaultDnsPort); _server = new ARSoft.Tools.Net.Dns.DnsServer(ipEndPoint, 10000, 10000); _server.ClientConnected += OnClientConnected; _server.QueryReceived += OnQueryReceived; _server.Start(); _logger.LogInformation("Server is started"); }
public static void Main(string[] args) { new Core.DataAccess.SQL.ModelMappings().Create(); var kernel = NinjectCommon.CreateKernel(); var dnsQueryHandler = kernel.Get<IDnsQueryHandler>(); using (var server = new DnsServer(IPAddress.Any, 10, 10, dnsQueryHandler.HandleQuery )) { server.Start(); Console.WriteLine("Press enter to stop server"); Console.ReadLine(); } }
protected void StartDnsServer() { try { DnsServer server = new DnsServer(System.Net.IPAddress.Any, 10, 10, OnDnsQuery); this.AddListItem("Started DNS proxy..."); server.ExceptionThrown += DnsServer_ExceptionThrown; server.Start(); } catch (Exception e) { this.AddListItem(String.Format("ERROR STARTING DNS SERVER: {0}", e.Message)); } }
static void Main(string[] args) { using (DnsServer server = new DnsServer(IPAddress.Any, 4, 1)) { server.ClientConnected += OnClientConnected; server.QueryReceived += OnQueryReceived; server.Start(); Application.Run(); //Console.WriteLine("Press any key to stop server"); //Console.ReadLine(); } }
public static void Main(string[] args) { Console.WriteLine("-------------------------------------------------"); Console.WriteLine("DnsServerTest"); Console.WriteLine("-------------------------------------------------"); domain = System.Configuration.ConfigurationManager.AppSettings["Domain"]; if (domain == null) { Console.WriteLine(string.Format("AppSetting \"Domain\" invalid", domain)); Console.WriteLine("End"); Console.ReadKey(); return; } int.TryParse(System.Configuration.ConfigurationManager.AppSettings["TtlSeconds"], out ttlSeconds); if (ttlSeconds <= 0) { Console.WriteLine(string.Format("AppSetting \"TtlSeconds\" invalid", domain)); Console.WriteLine("End"); Console.ReadKey(); return; } Console.WriteLine(string.Format("Domain: {0}", domain)); Console.WriteLine(string.Format("TTL: {0} seconds", ttlSeconds.ToString("#,##0"))); Console.WriteLine(); using (DnsServer server = new DnsServer(10, 10)) { server.QueryReceived += OnQueryReceived; server.Start(); Console.WriteLine("Service started"); Console.WriteLine(); Console.WriteLine("\r\nPress any key to stop server"); Console.ReadLine(); return; } }
public Task <string> OpenAsync(CancellationToken cancellationToken) { _server.Start(); return(Task.FromResult <string>("DNS Server started!")); }
private static void BindListener(string ipAddressForBinding) { IPAddress ip; if (!IPAddress.TryParse(ipAddressForBinding, out ip)) return; if (Servers.ContainsKey(ipAddressForBinding)) return; var dnsServer = new DnsServer(ip, 10, 10); dnsServer.QueryReceived += OnQueryReceived; Servers.Add(ipAddressForBinding, dnsServer); dnsServer.Start(); var appLog = new System.Diagnostics.EventLog {Source = "Hyper-V Dns Proxy"}; appLog.WriteEntry($"Started DNS Service on {ipAddressForBinding}"); }
public void Start() { server.Start(); }
/// <summary> /// Attempt to start the server. /// </summary> /// <remarks>Will only start when 'start-enabled' is true.</remarks> /// <returns>True on success, false if the server is not enabled.</returns> public bool Start() { if (_dnsServer != null) { throw new Exception("The server is already running."); } if (!Configuration.ServerEnabled) { // Server not enabled return false; } _dnsServer = new DnsServer(Configuration.ServerBindIP, 32, 32, OnQuery); Logger.Log(LogSeverity.Info, "Starting the TorDNS server. Bind IP: {0}", Configuration.ServerBindIP.ToString()); RefreshConfiguration(true); _dnsServer.Start(); IsRunning = true; return true; }
public void Start() => dnsServer.Start();