Merge in DNS/adguard-home from AGDNS-2665-upstream-timeout to master
Squashed commit of the following:
commit b4041c97f2ccd371a9cff8312bda72f4c18496b9
Merge: d939b3b3e b92a3cfb8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 7 16:15:19 2025 +0300
Merge branch 'master' into AGDNS-2665-upstream-timeout
commit d939b3b3ef2345d315c05a3730e81e1f1ea9f79f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Feb 7 16:10:06 2025 +0300
client: imp i18n
commit 52089adb6c28d8c47f5a916d9df941c5fddea1fc
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Feb 6 18:39:53 2025 +0300
all: fix typo
commit aca08b1873c9f39b8c1da0439a9057117e1dacce
Author: Ildar Kamalov <ik@adguard.com>
Date: Thu Feb 6 15:19:30 2025 +0300
client: rearrange upstream timeout settings
commit 48e75fabe2f65aeac7156a020cce3d4c2412e5f9
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Tue Feb 4 20:48:53 2025 +0300
github: upd actions cache
commit 64bac193fc834a975e6913bb86a6bf27e54c382a
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Tue Feb 4 20:28:54 2025 +0300
all: imp code
commit 95c73698985dc528a4af6ff0d3b8a301da1f0d4a
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Mon Feb 3 16:25:35 2025 +0300
all: upstream timeout
78 lines
2.7 KiB
TypeScript
78 lines
2.7 KiB
TypeScript
import { handleActions } from 'redux-actions';
|
|
|
|
import * as actions from '../actions/dnsConfig';
|
|
import { ALL_INTERFACES_IP, BLOCKING_MODES, DNS_REQUEST_OPTIONS } from '../helpers/constants';
|
|
|
|
export const DEFAULT_BLOCKING_IPV4 = ALL_INTERFACES_IP;
|
|
export const DEFAULT_BLOCKING_IPV6 = '::';
|
|
|
|
const dnsConfig = handleActions(
|
|
{
|
|
[actions.getDnsConfigRequest.toString()]: (state: any) => ({
|
|
...state,
|
|
processingGetConfig: true,
|
|
}),
|
|
[actions.getDnsConfigFailure.toString()]: (state: any) => ({
|
|
...state,
|
|
processingGetConfig: false,
|
|
}),
|
|
[actions.getDnsConfigSuccess.toString()]: (state: any, { payload }: any) => {
|
|
const {
|
|
blocking_ipv4,
|
|
blocking_ipv6,
|
|
upstream_dns,
|
|
upstream_mode,
|
|
fallback_dns,
|
|
bootstrap_dns,
|
|
local_ptr_upstreams,
|
|
ratelimit_whitelist,
|
|
...values
|
|
} = payload;
|
|
|
|
return {
|
|
...state,
|
|
...values,
|
|
blocking_ipv4: blocking_ipv4 || DEFAULT_BLOCKING_IPV4,
|
|
blocking_ipv6: blocking_ipv6 || DEFAULT_BLOCKING_IPV6,
|
|
upstream_dns: (upstream_dns && upstream_dns.join('\n')) || '',
|
|
fallback_dns: (fallback_dns && fallback_dns.join('\n')) || '',
|
|
bootstrap_dns: (bootstrap_dns && bootstrap_dns.join('\n')) || '',
|
|
local_ptr_upstreams: (local_ptr_upstreams && local_ptr_upstreams.join('\n')) || '',
|
|
ratelimit_whitelist: (ratelimit_whitelist && ratelimit_whitelist.join('\n')) || '',
|
|
processingGetConfig: false,
|
|
upstream_mode: upstream_mode === '' ? DNS_REQUEST_OPTIONS.LOAD_BALANCING : upstream_mode,
|
|
};
|
|
},
|
|
|
|
[actions.setDnsConfigRequest.toString()]: (state: any) => ({
|
|
...state,
|
|
processingSetConfig: true,
|
|
}),
|
|
[actions.setDnsConfigFailure.toString()]: (state: any) => ({
|
|
...state,
|
|
processingSetConfig: false,
|
|
}),
|
|
[actions.setDnsConfigSuccess.toString()]: (state, { payload }: any) => ({
|
|
...state,
|
|
...payload,
|
|
processingSetConfig: false,
|
|
}),
|
|
},
|
|
{
|
|
processingGetConfig: false,
|
|
processingSetConfig: false,
|
|
blocking_mode: BLOCKING_MODES.default,
|
|
ratelimit: 20,
|
|
blocking_ipv4: DEFAULT_BLOCKING_IPV4,
|
|
blocking_ipv6: DEFAULT_BLOCKING_IPV6,
|
|
blocked_response_ttl: 10,
|
|
upstream_timeout: 10,
|
|
edns_cs_enabled: false,
|
|
disable_ipv6: false,
|
|
dnssec_enabled: false,
|
|
upstream_dns_file: '',
|
|
},
|
|
);
|
|
|
|
export default dnsConfig;
|