:ambulance:恢复本地DNS服务

This commit is contained in:
Amazing_DM
2020-03-06 12:37:14 +08:00
parent 26af839d01
commit caa6b8fa94
4 changed files with 106 additions and 1 deletions

View 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());
}
}
}
}