ReverseProxyServiceCollectionExtensions.cs 741 B

12345678910111213141516171819202122232425
  1. using FastGithub.ReverseProxy;
  2. using Microsoft.Extensions.DependencyInjection;
  3. namespace FastGithub
  4. {
  5. /// <summary>
  6. /// gitub反向代理的服务注册扩展
  7. /// </summary>
  8. public static class ReverseProxyServiceCollectionExtensions
  9. {
  10. /// <summary>
  11. /// gitub反向代理
  12. /// </summary>
  13. /// <param name="services"></param>
  14. /// <returns></returns>
  15. public static IServiceCollection AddGithubReverseProxy(this IServiceCollection services)
  16. {
  17. return services
  18. .AddMemoryCache()
  19. .AddHttpForwarder()
  20. .AddSingleton<GithubResolver>()
  21. .AddTransient<GithubHttpClientHanlder>();
  22. }
  23. }
  24. }