add reverse-dns

master
Kherel 2 years ago
parent 8ccb4f18f6
commit d4f315214b
  1. 16
      lib/logic/api_maps/hetzner.dart
  2. 7
      lib/logic/cubit/app_config/app_config_repository.dart

@ -192,4 +192,20 @@ class HetznerApi extends ApiMap {
return HetznerServerInfo.fromJson(response.data!['server']);
}
Future<void> createReverseDns({
required String ip4,
required String cloudFlareDomain,
}) async {
var hetznerServer = getIt<ApiConfigModel>().hetznerServer;
var client = await getClient();
await client.post(
'/servers/${hetznerServer!.id}/actions/change_dns_ptr',
data: {
"ip": ip4,
"dns_ptr": cloudFlareDomain,
},
);
close(client);
}
}

@ -149,7 +149,7 @@ class AppConfigRepository {
}
Future<void> createDnsRecords(
String? ip4,
String ip4,
CloudFlareDomain cloudFlareDomain,
) async {
var cloudflareApi = CloudflareApi();
@ -163,6 +163,11 @@ class AppConfigRepository {
ip4: ip4,
cloudFlareDomain: cloudFlareDomain,
);
await HetznerApi().createReverseDns(
ip4: ip4,
cloudFlareDomain: cloudFlareDomain.domainName,
);
}
Future<bool> isHttpServerWorking() async {

Loading…
Cancel
Save