/// <summary> /// Constructs an IP address based host entry. /// </summary> /// <param name="host">The host name.</param> /// <param name="address">The IP address.</param> /// <param name="ttl">The time-to-live interval (or a negative value to use the server default).</param> /// <param name="hostMode">The entry's mode.</param> /// <param name="isNAT"> /// <c>true</c> if the address embedded in the entry should be ignored and the /// source IP address for the received UDP packet should be used instead. /// </param> public DynDnsHostEntry(string host, IPAddress address, TimeSpan ttl, DynDnsHostMode hostMode, bool isNAT) { if (hostMode == DynDnsHostMode.CName || hostMode == DynDnsHostMode.MX) { throw new ArgumentException("[CNAME or MX] cannot be used for IP address entries."); } this.Host = host; this.CName = null; this.Address = address; this.TTL = ttl; this.HostMode = hostMode; this.IsNAT = IsNAT; }
/// <summary> /// Constructs a CNAME based host entry. /// </summary> /// <param name="host">The host name.</param> /// <param name="cname">The referenced host name.</param> /// <param name="ttl">The time-to-live interval (or a negative value to use the server default).</param> /// <param name="hostMode">The entry's mode.</param> /// <param name="isNAT"> /// <c>true</c> if the address embedded in the entry should be ignored and the /// source IP address for the received UDP packet should be used instead. /// </param> public DynDnsHostEntry(string host, string cname, TimeSpan ttl, DynDnsHostMode hostMode, bool isNAT) { if (hostMode == DynDnsHostMode.Address) { throw new ArgumentException("[ADDRESS] cannot be used for CNAME address entries."); } else if (hostMode == DynDnsHostMode.AddressList) { throw new ArgumentException("[ADDRESSLIST] cannot be used for CNAME address entries."); } this.Host = host; this.CName = cname; this.Address = IPAddress.Any; this.TTL = ttl; this.HostMode = hostMode; this.IsNAT = isNAT; }