+ client: handle EDNS Client Subnet setting
This commit is contained in:
@@ -3,16 +3,29 @@ import { handleActions } from 'redux-actions';
|
||||
import * as actions from '../actions/dnsConfig';
|
||||
import { BLOCKING_MODES } from '../helpers/constants';
|
||||
|
||||
const DEFAULT_BLOCKING_IPV4 = '0.0.0.0';
|
||||
const DEFAULT_BLOCKING_IPV6 = '::';
|
||||
|
||||
const dnsConfig = handleActions(
|
||||
{
|
||||
[actions.getDnsConfigRequest]: state => ({ ...state, processingGetConfig: true }),
|
||||
[actions.getDnsConfigFailure]: state =>
|
||||
({ ...state, processingGetConfig: false }),
|
||||
[actions.getDnsConfigSuccess]: (state, { payload }) => ({
|
||||
...state,
|
||||
...payload,
|
||||
processingGetConfig: false,
|
||||
}),
|
||||
[actions.getDnsConfigSuccess]: (state, { payload }) => {
|
||||
const {
|
||||
blocking_ipv4,
|
||||
blocking_ipv6,
|
||||
...values
|
||||
} = payload;
|
||||
|
||||
return {
|
||||
...state,
|
||||
...values,
|
||||
blocking_ipv4: blocking_ipv4 || DEFAULT_BLOCKING_IPV4,
|
||||
blocking_ipv6: blocking_ipv6 || DEFAULT_BLOCKING_IPV6,
|
||||
processingGetConfig: false,
|
||||
};
|
||||
},
|
||||
|
||||
[actions.setDnsConfigRequest]: state => ({ ...state, processingSetConfig: true }),
|
||||
[actions.setDnsConfigFailure]: state =>
|
||||
@@ -28,8 +41,9 @@ const dnsConfig = handleActions(
|
||||
processingSetConfig: false,
|
||||
blocking_mode: BLOCKING_MODES.nxdomain,
|
||||
ratelimit: 20,
|
||||
blocking_ipv4: '',
|
||||
blocking_ipv6: '',
|
||||
blocking_ipv4: DEFAULT_BLOCKING_IPV4,
|
||||
blocking_ipv6: DEFAULT_BLOCKING_IPV6,
|
||||
edns_cs_enabled: false,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user