dns: add port overriding support

This commit is contained in:
r0x5a
2024-12-12 02:28:02 +08:00
parent 6d8ffb46ef
commit d8202e1df4
7 changed files with 117 additions and 7 deletions

View File

@ -123,6 +123,10 @@ void dns_config_load(struct dns_config *cfg, const wchar_t *filename)
filename);
cfg->replaceHost = GetPrivateProfileIntW(L"dns", L"replaceHost", 0, filename);
cfg->startupPort = GetPrivateProfileIntW(L"dns", L"startupPort", 0, filename);
cfg->billingPort = GetPrivateProfileIntW(L"dns", L"billingPort", 0, filename);
cfg->aimedbPort = GetPrivateProfileIntW(L"dns", L"aimedbPort", 0, filename);
}
void hwmon_config_load(struct hwmon_config *cfg, const wchar_t *filename)

View File

@ -20,6 +20,10 @@ HRESULT dns_platform_hook_init(const struct dns_config *cfg)
http_hook_init();
}
if(cfg->startupPort || cfg->billingPort || cfg->aimedbPort){
port_hook_init(cfg->startupPort, cfg->billingPort, cfg->aimedbPort);
}
hr = dns_hook_push(L"tenporouter.loc", cfg->router);
if (FAILED(hr)) {
@ -112,40 +116,40 @@ HRESULT dns_platform_hook_init(const struct dns_config *cfg)
if (FAILED(hr)) {
return hr;
}
// WAHLAP PowerOn
hr = dns_hook_push(L"at.sys-all.cn", cfg->startup);
if (FAILED(hr)) {
return hr;
}
hr = dns_hook_push(L"at.sys-allnet.cn", cfg->startup);
if (FAILED(hr)) {
return hr;
}
// WAHLAP WeChat AimeDB Server
hr = dns_hook_push(L"ai.sys-all.cn", cfg->aimedb);
if (FAILED(hr)) {
return hr;
}
hr = dns_hook_push(L"ai.sys-allnet.cn", cfg->aimedb);
if (FAILED(hr)) {
return hr;
}
// WAHLAP Billing
hr = dns_hook_push(L"bl.sys-all.cn", cfg->billing);
if (FAILED(hr)) {
return hr;
}
hr = dns_hook_push(L"bl.sys-allnet.cn", cfg->billing);
if (FAILED(hr)) {

View File

@ -13,6 +13,9 @@ struct dns_config {
wchar_t aimedb[128];
wchar_t title[128];
bool replaceHost;
unsigned short startupPort;
unsigned short billingPort;
unsigned short aimedbPort;
};
HRESULT dns_platform_hook_init(const struct dns_config *cfg);