示例#1
0
        private AuthZone CreateEmptyZone(AuthZoneInfo zoneInfo)
        {
            AuthZone zone;

            switch (zoneInfo.Type)
            {
            case AuthZoneType.Primary:
                zone = new PrimaryZone(_dnsServer, zoneInfo);
                break;

            case AuthZoneType.Secondary:
                zone = new SecondaryZone(_dnsServer, zoneInfo);
                break;

            case AuthZoneType.Stub:
                zone = new StubZone(_dnsServer, zoneInfo);
                break;

            case AuthZoneType.Forwarder:
                zone = new ForwarderZone(zoneInfo);
                break;

            default:
                throw new InvalidDataException("DNS zone type not supported.");
            }

            if (_root.TryAdd(zone))
            {
                return(zone);
            }

            throw new DnsServerException("Zone already exists: " + zoneInfo.Name);
        }
示例#2
0
        internal AuthZoneInfo CreateInternalPrimaryZone(string domain, DnsSOARecord soaRecord, DnsNSRecord ns)
        {
            AuthZone authZone = new PrimaryZone(_dnsServer, domain, soaRecord, ns);

            if (_root.TryAdd(authZone))
            {
                return(new AuthZoneInfo(authZone));
            }

            return(null);
        }
示例#3
0
        public AuthZoneInfo CreatePrimaryZone(string domain, string primaryNameServer, bool @internal)
        {
            AuthZone authZone = new PrimaryZone(_dnsServer, domain, primaryNameServer, @internal);

            if (_root.TryAdd(authZone))
            {
                return(new AuthZoneInfo(authZone));
            }

            return(null);
        }
示例#4
0
        public AuthZoneInfo CreatePrimaryZone(string domain, string primaryNameServer, bool @internal)
        {
            AuthZone authZone = new PrimaryZone(_dnsServer, domain, primaryNameServer, @internal);

            if (_root.TryAdd(authZone))
            {
                return(new AuthZoneInfo(authZone));
            }

            if (_root.TryGet(domain, out AuthZone existingZone) && (existingZone is SubDomainZone))
            {
                _root[domain] = authZone;
                return(new AuthZoneInfo(authZone));
            }

            return(null);
        }