SOCKSProxy.cs 1.1 KB

1234567891011121314151617181920212223242526272829
  1. #if !UNITY_WEBGL || UNITY_EDITOR
  2. using System;
  3. using Best.HTTP.Proxies.Implementations;
  4. using Best.HTTP.Request.Authentication;
  5. using Best.HTTP.Shared.Extensions;
  6. namespace Best.HTTP.Proxies
  7. {
  8. /// <summary>
  9. /// Represents a SOCKS proxy used for making HTTP requests, supporting SOCKS version 5 (v5).
  10. /// </summary>
  11. public sealed class SOCKSProxy : Proxy
  12. {
  13. /// <summary>
  14. /// Initializes a new instance of the SOCKSProxy class with the specified proxy address and credentials.
  15. /// </summary>
  16. /// <param name="address">The address of the SOCKS proxy server.</param>
  17. /// <param name="credentials">The credentials for proxy authentication (if required).</param>
  18. public SOCKSProxy(Uri address, Credentials credentials)
  19. : base(address, credentials)
  20. { }
  21. public override string GetRequestPath(Uri uri) => uri.GetRequestPathAndQueryURL();
  22. internal override bool SetupRequest(HTTPRequest request) => false;
  23. internal override void BeginConnect(ProxyConnectParameters parameters) => new SOCKSV5Negotiator(this, parameters);
  24. }
  25. }
  26. #endif