mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 09:04:45 +08:00
使用 DNS 分流
This commit is contained in:
@ -1,10 +1,19 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:starcitizen_doctor/common/conf/app_conf.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/api/http_api.dart' as rust_http;
|
||||
import 'package:starcitizen_doctor/common/rust/api/http_api.dart';
|
||||
import 'package:starcitizen_doctor/common/rust/http_package.dart';
|
||||
|
||||
class RSHttp {
|
||||
static init() async {
|
||||
await rust_http.setDefaultHeader(headers: {
|
||||
"User-Agent":
|
||||
"SCToolBox/${AppConf.appVersion} (${AppConf.appVersionCode}) ${AppConf.isMSE ? "" : " DEV"} RSHttp"
|
||||
});
|
||||
}
|
||||
|
||||
static Future<String> getText(String url,
|
||||
{Map<String, String>? headers}) async {
|
||||
final r = await rust_http.fetch(
|
||||
@ -26,4 +35,15 @@ class RSHttp {
|
||||
method: MyMethod.post, url: url, headers: headers, inputData: data);
|
||||
return r.statusCode == 200;
|
||||
}
|
||||
|
||||
static Future<RustHttpResponse> head(String url,
|
||||
{Map<String, String>? headers}) async {
|
||||
final r = await rust_http.fetch(
|
||||
method: MyMethod.head, url: url, headers: headers);
|
||||
return r;
|
||||
}
|
||||
|
||||
static Future<List<String>> dnsLookupTxt(String host) async {
|
||||
return await rust_http.dnsLookupTxt(host: host);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user