mirror of
https://github.com/netchx/netch.git
synced 2026-03-18 18:13:21 +08:00
done
This commit is contained in:
37
Netch/Controllers/DNSController.cs
Normal file
37
Netch/Controllers/DNSController.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
|
||||
namespace Netch.Controllers
|
||||
{
|
||||
public class DNSController
|
||||
{
|
||||
public static DNS.Server.DnsServer Server = new DNS.Server.DnsServer(new Resolver());
|
||||
|
||||
public bool Start()
|
||||
{
|
||||
try
|
||||
{
|
||||
_ = Server.Listen(new IPEndPoint(IPAddress.IPv6Any, 53));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Logging.Info(e.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
try
|
||||
{
|
||||
Server.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Logging.Info(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user