class->record

This commit is contained in:
xljiulang 2021-08-14 21:43:57 +08:00
parent 19ed7a4537
commit 70bbacde13

View File

@ -6,18 +6,18 @@ namespace FastGithub.Configuration
/// <summary> /// <summary>
/// dns配置 /// dns配置
/// </summary> /// </summary>
public class DnsConfig public record DnsConfig
{ {
/// <summary> /// <summary>
/// IP地址 /// IP地址
/// </summary> /// </summary>
[AllowNull] [AllowNull]
public string IPAddress { get; set; } public string IPAddress { get; init; }
/// <summary> /// <summary>
/// 端口 /// 端口
/// </summary> /// </summary>
public int Port { get; set; } = 53; public int Port { get; init; } = 53;
/// <summary> /// <summary>
/// 转换为IPEndPoint /// 转换为IPEndPoint
@ -38,10 +38,5 @@ namespace FastGithub.Configuration
return new IPEndPoint(address, this.Port); return new IPEndPoint(address, this.Port);
} }
public override string ToString()
{
return $"{this.IPAddress}:{this.Port}";
}
} }
} }