feat: sync httpdns sdk/platform updates without large binaries
This commit is contained in:
54
HttpDNSSDK/sdk/flutter/new_httpdns/example/README.md
Normal file
54
HttpDNSSDK/sdk/flutter/new_httpdns/example/README.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# TrustAPP_httpdns_example
|
||||
|
||||
Demonstrates how to use the TrustAPP_httpdns plugin with various network libraries.
|
||||
|
||||
## Features
|
||||
|
||||
This example demonstrates:
|
||||
- HTTPDNS initialization and configuration
|
||||
- Domain name resolution (IPv4 and IPv6)
|
||||
- Integration with multiple network libraries:
|
||||
- Dio
|
||||
- HttpClient
|
||||
- http package
|
||||
- Custom HTTP client adapter for HTTPDNS
|
||||
- Real HTTP requests using HTTPDNS resolution
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Replace the SDK init parameters in `lib/main.dart` with your own values:
|
||||
```dart
|
||||
await TrustAPPHttpdns.init(
|
||||
appId: 'YOUR_APP_ID',
|
||||
primaryServiceHost: 'httpdns-a.example.com',
|
||||
backupServiceHost: 'httpdns-b.example.com',
|
||||
servicePort: 443,
|
||||
secretKey: 'YOUR_SIGN_SECRET', // optional if sign is enabled
|
||||
);
|
||||
```
|
||||
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
flutter pub get
|
||||
```
|
||||
|
||||
3. Run the app:
|
||||
```bash
|
||||
flutter run
|
||||
```
|
||||
|
||||
4. Try the features:
|
||||
- Enter a URL and select a network library (Dio/HttpClient/http)
|
||||
- Tap "Send Request" to make an HTTP request using HTTPDNS
|
||||
- Tap "HTTPDNS Resolve" to test domain resolution directly
|
||||
|
||||
## Implementation Details
|
||||
|
||||
The example uses a modern approach with `HttpClient.connectionFactory` to integrate HTTPDNS:
|
||||
- See `lib/net/httpdns_http_client_adapter.dart` for the implementation
|
||||
- This approach avoids the complexity of local proxy servers
|
||||
- Works seamlessly with Dio, HttpClient, and http package
|
||||
|
||||
## Note
|
||||
|
||||
The values in this example are placeholders. Use your own platform app configuration.
|
||||
Reference in New Issue
Block a user