Added DNS Server local address binding success log entry and added another constuctor.

This commit is contained in:
Shreyas Zare
2019-01-06 16:46:07 +05:30
parent e564241bd8
commit 873fec457d

View File

@@ -1,6 +1,6 @@
/*
Technitium DNS Server
Copyright (C) 2018 Shreyas Zare (shreyas@technitium.com)
Copyright (C) 2019 Shreyas Zare (shreyas@technitium.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -113,6 +113,16 @@ namespace DnsServerCore
: this(new IPEndPoint[] { localEP })
{ }
public DnsServer(IPAddress[] localIPs)
{
_localEPs = new IPEndPoint[localIPs.Length];
for (int i = 0; i < _localEPs.Length; i++)
_localEPs[i] = new IPEndPoint(localIPs[i], 53);
_dnsCache = new DnsCache(_cacheZoneRoot);
}
public DnsServer(IPEndPoint[] localEPs)
{
_localEPs = localEPs;
@@ -809,6 +819,10 @@ namespace DnsServerCore
udpListener.Bind(_localEPs[i]);
_udpListeners.Add(udpListener);
LogManager log = _log;
if (log != null)
log.Write(_localEPs[i], false, "DNS Server was bound successfully.");
}
catch (Exception ex)
{
@@ -827,6 +841,10 @@ namespace DnsServerCore
tcpListener.Listen(100);
_tcpListeners.Add(tcpListener);
LogManager log = _log;
if (log != null)
log.Write(_localEPs[i], true, "DNS Server was bound successfully.");
}
catch (Exception ex)
{