ProxyController.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using molilian.core;
  2. using dodohold.core;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Org.BouncyCastle.Ocsp;
  5. using System.Text.Json;
  6. using System.Runtime.InteropServices;
  7. using TencentCloud.Scf.V20180416.Models;
  8. using Quartz.Impl.AdoJobStore.Common;
  9. using TencentCloud.Gaap.V20180529.Models;
  10. using System.Net;
  11. using TencentCloud.Ie.V20200304.Models;
  12. using TencentCloud.Soe.V20180724.Models;
  13. namespace molilian.api.Controllers
  14. {
  15. [ApiController]
  16. [MyAuthorize("admin")]
  17. [Route("api/[controller]/[action]")]
  18. public class ProxyController : ControllerBase
  19. {
  20. readonly IAuthorizationProvider provider = new AdminProvider();
  21. protected IHttpContextAccessor _accessor;
  22. public ProxyController(IHttpContextAccessor accessor)
  23. {
  24. _accessor = accessor;
  25. }
  26. [HttpGet]
  27. public ActionResult get()
  28. {
  29. var list = new DBContext.Table("proxy_nodes")
  30. .Where("status=@status", new { status = 1 })
  31. .Select<ProxyNodesDTO>();
  32. // 参考数据
  33. //61 1 6 品阅245 品阅辅助网卡 bj http http://172.21.127.245:33128 molilian Bhquvmkn8zLO36lGjuqk 2024-04-09 14:25:53 2024-04-09 14:25:56
  34. //59 1 6 品阅243 品阅辅助网卡 bj http http://172.21.127.243:33128 molilian Bhquvmkn8zLO36lGjuqk 2024-04-09 14:25:53 2024-04-09 14:25:56
  35. foreach (var proxy in list)
  36. {
  37. //通过 curl myip.ipip.net检测proxy可访问行
  38. }
  39. var tasks = new List<Task<int>>
  40. {
  41. Task.Run(()=>{ })
  42. };
  43. // 等待所有任务完成
  44. Task.WhenAll(tasks).Wait();
  45. return new APIResult(new { list });
  46. }
  47. }
  48. }