using System; using System.Net; namespace FastGithub.Configuration { /// /// 域名配置 /// public record DomainConfig { /// /// 是否发送SNI /// public bool TlsSni { get; init; } /// /// 自定义SNI值的表达式 /// public string? TlsSniPattern { get; init; } /// /// 是否忽略服务器证书域名不匹配 /// 当不发送SNI时服务器可能发回域名不匹配的证书 /// public bool TlsIgnoreNameMismatch { get; init; } /// /// 使用的ip地址 /// public IPAddress? IPAddress { get; init; } /// /// 请求超时时长 /// public TimeSpan? Timeout { get; init; } /// /// 目的地 /// 格式为相对或绝对uri /// public Uri? Destination { get; init; } /// /// 自定义响应 /// public ResponseConfig? Response { get; init; } /// /// 获取TlsSniPattern /// /// public TlsSniPattern GetTlsSniPattern() { if (this.TlsSni == false) { return Configuration.TlsSniPattern.None; } if (string.IsNullOrEmpty(this.TlsSniPattern)) { return Configuration.TlsSniPattern.Domain; } return new TlsSniPattern(this.TlsSniPattern); } } }