feat: sync httpdns sdk/platform updates without large binaries
This commit is contained in:
74
HttpDNSSDK/sdk/android/README.md
Normal file
74
HttpDNSSDK/sdk/android/README.md
Normal file
@@ -0,0 +1,74 @@
|
||||
# HTTPDNS Android SDK (SNI Hidden v1.0.0)
|
||||
|
||||
## 1. Init
|
||||
|
||||
```java
|
||||
import com.newsdk.sdk.android.httpdns.HttpDns;
|
||||
import com.newsdk.sdk.android.httpdns.HttpDnsService;
|
||||
import com.newsdk.sdk.android.httpdns.InitConfig;
|
||||
|
||||
String appId = "app1f1ndpo9";
|
||||
|
||||
new InitConfig.Builder()
|
||||
.setContext(context)
|
||||
.setServiceUrl("https://httpdns.example.com:8445")
|
||||
.setSecretKey("your-sign-secret") // optional if sign is enabled
|
||||
.buildFor(appId);
|
||||
|
||||
HttpDnsService httpDnsService = HttpDns.getService(appId);
|
||||
```
|
||||
|
||||
## 2. Resolve
|
||||
|
||||
```java
|
||||
HTTPDNSResult result = httpDnsService.getHttpDnsResultForHostSyncNonBlocking(
|
||||
"api.business.com",
|
||||
RequestIpType.auto,
|
||||
null,
|
||||
null
|
||||
);
|
||||
```
|
||||
|
||||
## 3. Official HTTP Adapter (IP + Empty-SNI + Host)
|
||||
|
||||
```java
|
||||
import com.newsdk.sdk.android.httpdns.network.HttpDnsAdapterOptions;
|
||||
import com.newsdk.sdk.android.httpdns.network.HttpDnsAdapterRequest;
|
||||
import com.newsdk.sdk.android.httpdns.network.HttpDnsAdapterResponse;
|
||||
import com.newsdk.sdk.android.httpdns.network.HttpDnsHttpAdapter;
|
||||
|
||||
HttpDnsHttpAdapter adapter = HttpDns.buildHttpClientAdapter(
|
||||
httpDnsService,
|
||||
new HttpDnsAdapterOptions.Builder()
|
||||
.setConnectTimeoutMillis(3000)
|
||||
.setReadTimeoutMillis(5000)
|
||||
.setRequestIpType(RequestIpType.auto)
|
||||
.setAllowInsecureCertificatesForDebugOnly(false)
|
||||
.build()
|
||||
);
|
||||
|
||||
HttpDnsAdapterResponse response = adapter.execute(
|
||||
new HttpDnsAdapterRequest("GET", "https://api.business.com/v1/ping")
|
||||
);
|
||||
```
|
||||
|
||||
Behavior is fixed:
|
||||
- Resolve by `/resolve`.
|
||||
- Connect to resolved IP over HTTPS.
|
||||
- Keep `Host` header as business domain.
|
||||
- No fallback to domain direct request.
|
||||
|
||||
## 4. Public Errors
|
||||
|
||||
- `NO_IP_AVAILABLE`
|
||||
- `TLS_EMPTY_SNI_FAILED`
|
||||
- `HOST_ROUTE_REJECTED`
|
||||
- `RESOLVE_SIGN_INVALID`
|
||||
|
||||
## 5. Removed Public Params
|
||||
|
||||
Do not use legacy public parameters:
|
||||
- `accountId`
|
||||
- `serviceDomain`
|
||||
- `endpoint`
|
||||
- `aesSecretKey`
|
||||
Reference in New Issue
Block a user