12345678910111213141516171819202122232425262728293031323334353637 |
- using FastGithub.Configuration;
- using Microsoft.Extensions.Hosting;
- using System.Runtime.Versioning;
- using System.Threading;
- using System.Threading.Tasks;
- namespace FastGithub.Dns
- {
- /// <summary>
- /// https拦截后台服务
- /// </summary>
- [SupportedOSPlatform("windows")]
- sealed class HttpsInterceptHostedService : BackgroundService
- {
- private readonly HttpsInterceptor httpsInterceptor;
- /// <summary>
- /// https拦截后台服务
- /// </summary>
- /// <param name="httpsInterceptor"></param>
- public HttpsInterceptHostedService(HttpsInterceptor httpsInterceptor)
- {
- this.httpsInterceptor = httpsInterceptor;
- }
- /// <summary>
- /// https后台
- /// </summary>
- /// <param name="stoppingToken"></param>
- /// <returns></returns>
- protected override async Task ExecuteAsync(CancellationToken stoppingToken)
- {
- await Task.Yield();
- this.httpsInterceptor.Intercept(stoppingToken);
- }
- }
- }
|