Browse Source

fix: overture with edns options

dev
Dnomd343 2 years ago
parent
commit
56fbb54eee
  1. 6
      src/applet/overture.c
  2. 6
      src/cleardns.c

6
src/applet/overture.c

@ -97,12 +97,15 @@ char* overture_config(overture *info) { // generate json configure from overture
cJSON *primary = cJSON_CreateObject();
cJSON *primary_dns = cJSON_CreateArray();
cJSON *primary_edns = cJSON_CreateObject();
port_str = uint32_to_string(info->domestic_port);
char *domestic_port = string_join("127.0.0.1:", port_str);
cJSON_AddStringToObject(primary, "name", "Domestic");
cJSON_AddStringToObject(primary, "address", domestic_port);
cJSON_AddStringToObject(primary, "protocol", "udp");
cJSON_AddNumberToObject(primary, "timeout", info->timeout);
cJSON_AddStringToObject(primary_edns, "policy", "disable");
cJSON_AddItemToObject(primary, "ednsClientSubnet", primary_edns);
cJSON_AddItemToArray(primary_dns, primary);
cJSON_AddItemToObject(config, "primaryDNS", primary_dns);
free(domestic_port);
@ -110,12 +113,15 @@ char* overture_config(overture *info) { // generate json configure from overture
cJSON *alternative = cJSON_CreateObject();
cJSON *alternative_dns = cJSON_CreateArray();
cJSON *alternative_edns = cJSON_CreateObject();
port_str = uint32_to_string(info->foreign_port);
char *foreign_addr = string_join("127.0.0.1:", port_str);
cJSON_AddStringToObject(alternative, "name", "Foreign");
cJSON_AddStringToObject(alternative, "address", foreign_addr);
cJSON_AddStringToObject(alternative, "protocol", "udp");
cJSON_AddNumberToObject(alternative, "timeout", info->timeout);
cJSON_AddStringToObject(alternative_edns, "policy", "disable");
cJSON_AddItemToObject(alternative, "ednsClientSubnet", alternative_edns);
cJSON_AddItemToArray(alternative_dns, alternative);
cJSON_AddItemToObject(config, "alternativeDNS", alternative_dns);
free(foreign_addr);

6
src/cleardns.c

@ -79,17 +79,23 @@ int main(int argc, char *argv[]) { // ClearDNS service
// TODO: crontab of assets
// process_list_append(assets_load(loader.assets));
// TODO: free assets_config
process_list_append(dnsproxy_load("Domestic", loader.domestic, "domestic.json"));
process_list_append(dnsproxy_load("Foreign", loader.foreign, "foreign.json"));
process_list_append(overture_load(loader.diverter, "overture.json"));
overture_free(loader.diverter);
dnsproxy_free(loader.domestic);
dnsproxy_free(loader.foreign);
if (loader.filter != NULL) {
process_list_append(adguard_load(loader.filter, ADGUARD_DIR));
adguard_free(loader.filter);
}
for (char **script = loader.script; *script != NULL; ++script) {
log_info("Run custom script -> `%s`", *script);
run_command(*script);
}
string_list_free(loader.script);
process_list_run();

Loading…
Cancel
Save