Sync README files from source repository [skip ci]
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# HttpToSocks5Proxy - .NET 8.0
|
||||
# HttpToSocks5Proxy - .NET 10.0
|
||||
|
||||
HTTP(S) to SOCKS5 proxy adapter for .NET 8.0
|
||||
HTTP(S) to SOCKS5 proxy adapter for .NET 10.0
|
||||
|
||||
## Overview
|
||||
|
||||
This library implements `IWebProxy` interface to act as an HTTP(S) proxy while connecting to a SOCKS5 server behind the scenes. It has been upgraded from .NET Standard 2.0 to .NET 8.0 for better performance and modern features.
|
||||
This library implements `IWebProxy` interface to act as an HTTP(S) proxy while connecting to a SOCKS5 server behind the scenes. It has been upgraded from .NET Standard 2.0 to .NET 10.0 for better performance and modern features.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -12,7 +12,7 @@ This library implements `IWebProxy` interface to act as an HTTP(S) proxy while c
|
||||
- ✅ Transparent HTTP to SOCKS5 conversion
|
||||
- ✅ Support for authentication
|
||||
- ✅ Custom DNS resolver support
|
||||
- ✅ .NET 8.0 optimizations
|
||||
- ✅ .NET 10.0 optimizations
|
||||
- ✅ Nullable reference types enabled
|
||||
|
||||
## Usage
|
||||
@@ -73,14 +73,14 @@ var httpClient = new HttpClient(handler);
|
||||
|
||||
### Changes from Previous Version
|
||||
|
||||
- **Target Framework**: Changed from `netstandard2.0;net45` to `net8.0`
|
||||
- **Version**: Bumped to `2.0.0`
|
||||
- **Target Framework**: Changed from `netstandard2.0;net45` to `net10.0`
|
||||
- **Version**: Bumped to `10.0.0`
|
||||
- **Language Features**: Enabled nullable reference types
|
||||
- **Performance**: Benefits from .NET 8.0 runtime improvements
|
||||
- **Performance**: Benefits from .NET 10.0 runtime improvements
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- Minimum requirement is now .NET 8.0
|
||||
- Minimum requirement is now .NET 10.0
|
||||
- No longer supports .NET Framework 4.5 or .NET Standard 2.0
|
||||
|
||||
## Integration with SmartPool
|
||||
@@ -108,7 +108,7 @@ Target Website
|
||||
|
||||
### Dependencies
|
||||
|
||||
- .NET 8.0 Runtime
|
||||
- .NET 10.0 Runtime
|
||||
- No external NuGet packages required
|
||||
|
||||
## License
|
||||
@@ -117,11 +117,15 @@ MIT License
|
||||
|
||||
## Version History
|
||||
|
||||
- **2.0.0** (2026-01-22)
|
||||
- Upgraded to .NET 8.0
|
||||
- **10.0.0** (2026-01-22)
|
||||
- Upgraded to .NET 10.0
|
||||
- Enabled nullable reference types
|
||||
- Added modern C# language features
|
||||
|
||||
- **2.0.0** (Previous)
|
||||
- .NET 8.0
|
||||
- Nullable reference types support
|
||||
|
||||
- **1.4.0** (Previous)
|
||||
- .NET Standard 2.0 / .NET Framework 4.5
|
||||
- Original implementation
|
||||
|
||||
@@ -109,31 +109,110 @@ The API will be available at:
|
||||
|
||||
**POST** `/api/smart-pool/v1/SmartProxy/get-proxy`
|
||||
|
||||
Get a proxy server based on strategy and filters.
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"access_token": "your-token",
|
||||
"strategy": "least_delay",
|
||||
"target_domain": "facebook.com",
|
||||
"ipVersion": "v6",
|
||||
"ip_version": "v6",
|
||||
"protocol": "http",
|
||||
"country": "US"
|
||||
}
|
||||
```
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"error_code": 0,
|
||||
"message": null,
|
||||
"proxy": {
|
||||
"id": 123,
|
||||
"host": "192.168.1.100",
|
||||
"port": 8080,
|
||||
"protocol": "http",
|
||||
"ip_version": "v6",
|
||||
"country": "US",
|
||||
"auth_username": "user",
|
||||
"auth_password": "pass"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Available Strategies:**
|
||||
- `round_robin` (default): Balanced distribution
|
||||
- `random`: Random selection
|
||||
- `least_delay`: Fastest proxy (requires `target_domain`)
|
||||
- `adaptive_ranking`: Highest success rate (requires `target_domain`)
|
||||
- `alternative`: Similar proxy replacement (requires `referer_proxy.id`)
|
||||
|
||||
### Log Usage
|
||||
|
||||
**POST** `/api/smart-pool/v1/SmartProxy/log-usage`
|
||||
|
||||
Log proxy usage for analytics and strategy optimization.
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"access_token": "your-token",
|
||||
"proxy_id": 123,
|
||||
"target_domain": "facebook.com",
|
||||
"status_code": 200,
|
||||
"response_time_ms": 450
|
||||
"response_time_ms": 450,
|
||||
"error_message": null,
|
||||
"request_id": "req-12345-abc"
|
||||
}
|
||||
```
|
||||
|
||||
### Get Available Strategies
|
||||
|
||||
**GET** `/api/smart-pool/v1/SmartProxy/strategies`
|
||||
|
||||
Get list of available proxy selection strategies.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"strategies": [
|
||||
"round_robin",
|
||||
"random",
|
||||
"least_delay",
|
||||
"adaptive_ranking",
|
||||
"alternative"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Health Check
|
||||
|
||||
**GET** `/api/smart-pool/v1/SmartProxy/health`
|
||||
|
||||
Check API health status.
|
||||
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"status": "healthy",
|
||||
"timestamp": "2024-01-15T10:30:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
### Upsert Proxy
|
||||
|
||||
**POST** `/api/smart-pool/v1/SmartProxy/proxy/upsert`
|
||||
|
||||
Add or update proxy metadata.
|
||||
|
||||
### Add Access Mapping
|
||||
|
||||
**POST** `/api/smart-pool/v1/SmartProxy/access-mapping/add`
|
||||
|
||||
Add access token to cluster mapping.
|
||||
|
||||
## gRPC Usage
|
||||
|
||||
```csharp
|
||||
|
||||
@@ -94,11 +94,15 @@ public class MyService
|
||||
public async Task MakeRequestAsync()
|
||||
{
|
||||
// Get proxy as IWebProxy (ready for HttpClient)
|
||||
var proxy = await _smartPoolClient.GetProxyAsync(
|
||||
strategy: "least_delay",
|
||||
targetDomain: "facebook.com",
|
||||
ipVersion: "v6"
|
||||
);
|
||||
var request = new GetProxyRequest
|
||||
{
|
||||
access_token = "your-token",
|
||||
strategy = "least_delay",
|
||||
target_domain = "facebook.com",
|
||||
ip_version = "v6"
|
||||
};
|
||||
|
||||
var proxy = await _smartPoolClient.GetProxyAsync(request);
|
||||
|
||||
if (proxy != null)
|
||||
{
|
||||
@@ -108,13 +112,15 @@ public class MyService
|
||||
var response = await httpClient.GetAsync("https://facebook.com");
|
||||
|
||||
// Log usage
|
||||
await _smartPoolClient.LogProxyUsageAsync(
|
||||
accessToken: "your-token",
|
||||
proxyId: 123,
|
||||
targetDomain: "facebook.com",
|
||||
statusCode: (int)response.StatusCode,
|
||||
responseTimeMs: 450
|
||||
);
|
||||
var logRequest = new ProxyUsageLogRequest
|
||||
{
|
||||
access_token = "your-token",
|
||||
proxy_id = 123, // Get from GetRawProxyAsync if needed
|
||||
target_domain = "facebook.com",
|
||||
status_code = (int)response.StatusCode,
|
||||
response_time_ms = 450
|
||||
};
|
||||
await _smartPoolClient.LogProxyUsageAsync(logRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,10 +166,10 @@ var alternativeProxy = await _smartPoolClient.GetRawProxyAsync(request);
|
||||
## Strategies
|
||||
|
||||
- **random**: Random selection
|
||||
- **round_robin**: Balanced distribution
|
||||
- **least_delay**: Fastest proxy (requires targetDomain)
|
||||
- **adaptive_ranking**: Highest success rate (requires targetDomain)
|
||||
- **alternative**: Similar proxy replacement (requires refererProxy)
|
||||
- **round_robin**: Balanced distribution (default)
|
||||
- **least_delay**: Fastest proxy (requires `target_domain`)
|
||||
- **adaptive_ranking**: Highest success rate (requires `target_domain`)
|
||||
- **alternative**: Similar proxy replacement (requires `referer_proxy.id`)
|
||||
|
||||
## Protocol Selection
|
||||
|
||||
|
||||
Reference in New Issue
Block a user