docstring_tokens
stringlengths 18
16.9k
| code_tokens
stringlengths 75
1.81M
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|
keep replace keep keep replace keep
|
<mask> <div className="card-value card-value-stats text-yellow">
<mask> {replacedParental}
<mask> </div>
<mask> <div className="card-value card-value-percent text-yellow">
<mask> {getPercent(dnsQueries, replacedParental)}
<mask> </div>
</s> + client: handle the new statistics format </s> remove {getPercent(dnsQueries, replacedSafebrowsing)}
</s> add {getPercent(numDnsQueries, numReplacedSafebrowsing)} </s> remove {getPercent(dnsQueries, blockedFiltering)}
</s> add {getPercent(numDnsQueries, numBlockedFiltering)} </s> remove {blockedFiltering}
</s> add {numBlockedFiltering} </s> remove {replacedSafebrowsing}
</s> add {numReplacedSafebrowsing} </s> remove {dnsQueries}
</s> add {numDnsQueries}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/Statistics.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> <Trans>stats_adult</Trans>
<mask> </div>
<mask> </div>
<mask> <div className="card-chart-bg">
<mask> <Line data={parentalData} color={STATUS_COLORS.yellow}/>
<mask> </div>
<mask> </Card>
<mask> </div>
<mask> </div>
<mask> );
</s> + client: handle the new statistics format </s> remove <Line data={queriesData} color={STATUS_COLORS.blue}/>
</s> add <Line
data={this.getNormalizedHistory(dnsQueries, interval, 'dnsQueries')}
color={STATUS_COLORS.blue}
/> </s> remove <Line data={safebrowsingData} color={STATUS_COLORS.green}/>
</s> add <Line
data={this.getNormalizedHistory(
replacedSafebrowsing,
interval,
'replacedSafebrowsing',
)}
color={STATUS_COLORS.green}
/> </s> remove <Line data={filteringData} color={STATUS_COLORS.red}/>
</s> add <Line
data={this.getNormalizedHistory(
blockedFiltering,
interval,
'blockedFiltering',
)}
color={STATUS_COLORS.red}
/> </s> remove {getPercent(dnsQueries, replacedParental)}
</s> add {getPercent(numDnsQueries, numReplacedParental)} </s> remove {dashboard.topStats &&
<Fragment>
<div className="col-lg-6">
<Clients
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topClients={dashboard.topStats.top_clients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topQueriedDomains={dashboard.topStats.top_queried_domains}
/>
</div>
<div className="col-lg-6">
<BlockedDomains
refreshButton={refreshButton}
topBlockedDomains={dashboard.topStats.top_blocked_domains}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
</Fragment>
}
</s> add </s> remove {getPercent(dnsQueries, replacedSafebrowsing)}
</s> add {getPercent(numDnsQueries, numReplacedSafebrowsing)}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/Statistics.js
|
keep keep keep keep replace replace replace replace replace keep keep keep keep
|
<mask> }
<mask> }
<mask>
<mask> Statistics.propTypes = {
<mask> history: PropTypes.array.isRequired,
<mask> dnsQueries: PropTypes.number.isRequired,
<mask> blockedFiltering: PropTypes.number.isRequired,
<mask> replacedSafebrowsing: PropTypes.number.isRequired,
<mask> replacedParental: PropTypes.number.isRequired,
<mask> refreshButton: PropTypes.node.isRequired,
<mask> };
<mask>
<mask> export default withNamespaces()(Statistics);
</s> + client: handle the new statistics format </s> remove topBlockedDomains: PropTypes.object.isRequired,
</s> add topBlockedDomains: PropTypes.array.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> add subtitle: PropTypes.string.isRequired,
interval: PropTypes.number.isRequired, </s> remove topQueriedDomains: PropTypes.object.isRequired,
</s> add topQueriedDomains: PropTypes.array.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> remove topClients: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/Statistics.js
|
keep keep keep replace replace keep replace
|
<mask>
<mask> getAllStats = () => {
<mask> this.props.getStats();
<mask> this.props.getStatsHistory();
<mask> this.props.getTopStats();
<mask> this.props.getClients();
<mask> }
</s> + client: handle the new statistics format </s> remove this.props.getTopStats();
</s> add this.props.getStats(); </s> remove export const getTopStatsRequest = createAction('GET_TOP_STATS_REQUEST');
export const getTopStatsFailure = createAction('GET_TOP_STATS_FAILURE');
export const getTopStatsSuccess = createAction('GET_TOP_STATS_SUCCESS');
export const getTopStats = () => async (dispatch, getState) => {
dispatch(getTopStatsRequest());
const timer = setInterval(async () => {
const state = getState();
if (state.dashboard.isCoreRunning) {
clearInterval(timer);
try {
const stats = await apiClient.getGlobalStatsTop();
dispatch(getTopStatsSuccess(stats));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getTopStatsFailure(error));
}
}
}, 100);
};
</s> add </s> remove export const getStatsRequest = createAction('GET_STATS_REQUEST');
export const getStatsFailure = createAction('GET_STATS_FAILURE');
export const getStatsSuccess = createAction('GET_STATS_SUCCESS');
export const getStats = () => async (dispatch) => {
dispatch(getStatsRequest());
try {
const stats = await apiClient.getGlobalStats();
const processedStats = {
...stats,
avg_processing_time: round(stats.avg_processing_time, 2),
};
dispatch(getStatsSuccess(processedStats));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getStatsFailure());
}
};
</s> add </s> remove export const getStatsHistoryRequest = createAction('GET_STATS_HISTORY_REQUEST');
export const getStatsHistoryFailure = createAction('GET_STATS_HISTORY_FAILURE');
export const getStatsHistorySuccess = createAction('GET_STATS_HISTORY_SUCCESS');
export const getStatsHistory = () => async (dispatch) => {
dispatch(getStatsHistoryRequest());
try {
const statsHistory = await apiClient.getGlobalStatsHistory();
const normalizedHistory = normalizeHistory(statsHistory);
dispatch(getStatsHistorySuccess(normalizedHistory));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getStatsHistoryFailure());
}
};
</s> add </s> remove columns = [{
Header: 'IP',
accessor: 'ip',
Cell: (row) => {
const { value } = row;
const trackerData = getTrackerData(value);
</s> add columns = [
{
Header: <Trans>domain</Trans>,
accessor: 'domain',
Cell: (row) => {
const { value } = row;
const trackerData = getTrackerData(value);
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/index.js
|
keep keep keep keep replace keep keep replace keep keep keep
|
<mask> >
<mask> <Trans>{buttonText}</Trans>
<mask> </button>
<mask> );
<mask> }
<mask>
<mask> render() {
<mask> const { dashboard, t } = this.props;
<mask> const dashboardProcessing =
<mask> dashboard.processing ||
<mask> dashboard.processingStats ||
</s> + client: handle the new statistics format </s> remove dashboard.processingStats ||
dashboard.processingStatsHistory ||
</s> add </s> remove dashboard.processingTopStats;
</s> add stats.processingStats ||
stats.processingGetConfig;
const subtitle =
stats.interval === 1
? t('for_last_24_hours')
: t('for_last_days', { value: stats.interval }); </s> remove return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
</s> add return <Cell value={value} percent={percent} color={STATUS_COLORS.red} />;
}, </s> remove <Card title={ t('top_blocked_domains') } subtitle={ t('for_last_24_hours') } bodyType="card-table" refresh={this.props.refreshButton}>
</s> add <Card
title={t('top_blocked_domains')}
subtitle={subtitle}
bodyType="card-table"
refresh={refreshButton}
> </s> remove <Card title={ t('stats_query_domain') } subtitle={ t('for_last_24_hours') } bodyType="card-table" refresh={this.props.refreshButton}>
</s> add <Card
title={t('stats_query_domain')}
subtitle={subtitle}
bodyType="card-table"
refresh={refreshButton}
>
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/index.js
|
keep keep keep keep replace replace keep replace keep keep
|
<mask> render() {
<mask> const { dashboard, t } = this.props;
<mask> const dashboardProcessing =
<mask> dashboard.processing ||
<mask> dashboard.processingStats ||
<mask> dashboard.processingStatsHistory ||
<mask> dashboard.processingClients ||
<mask> dashboard.processingTopStats;
<mask>
<mask> const refreshFullButton = (
</s> + client: handle the new statistics format </s> remove const { dashboard, t } = this.props;
</s> add const { dashboard, stats, t } = this.props; </s> remove }
</s> add }; </s> remove columns = [{
Header: 'IP',
accessor: 'ip',
Cell: ({ value }) => {
const clientName = getClientName(this.props.clients, value)
|| getClientName(this.props.autoClients, value);
let client;
</s> add columns = [
{
Header: 'IP',
accessor: 'ip',
Cell: ({ value }) => {
const clientName =
getClientName(this.props.clients, value) ||
getClientName(this.props.autoClients, value);
let client; </s> remove if (clientName) {
client = <span>{clientName} <small>({value})</small></span>;
} else {
client = value;
}
</s> add if (clientName) {
client = (
<span>
{clientName} <small>({value})</small>
</span>
);
} else {
client = value;
} </s> remove export const normalizeHistory = history => Object.keys(history).map((key) => {
let id = STATS_NAMES[key];
if (!id) {
id = key.replace(/_/g, ' ').replace(/^\w/, c => c.toUpperCase());
</s> add export const normalizeHistory = (history, interval) => {
if (interval === 1 || interval === 7) {
const hoursAgo = subHours(Date.now(), 24 * interval);
return history.map((item, index) => ({
x: dateFormat(addHours(hoursAgo, index), 'D MMM HH:00'),
y: round(item, 2),
}));
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/index.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> );
<mask>
<mask> return (
<mask> <Fragment>
<mask> <PageTitle title={ t('dashboard') }>
<mask> <div className="page-title__actions">
<mask> {this.getToggleFilteringButton()}
<mask> {refreshFullButton}
<mask> </div>
<mask> </PageTitle>
</s> + client: handle the new statistics format </s> remove {!dashboardProcessing &&
</s> add {!dashboardProcessing && ( </s> remove {(dashboard.processingTopStats || dashboard.processingClients) && <Loading />}
{!dashboard.processingTopStats && !dashboard.processingClients && (
</s> add {(stats.processingStats || dashboard.processingClients) && <Loading />}
{!stats.processingStats && !dashboard.processingClients && ( </s> remove {dashboard.topStats &&
<Fragment>
<div className="col-lg-6">
<Clients
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topClients={dashboard.topStats.top_clients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topQueriedDomains={dashboard.topStats.top_queried_domains}
/>
</div>
<div className="col-lg-6">
<BlockedDomains
refreshButton={refreshButton}
topBlockedDomains={dashboard.topStats.top_blocked_domains}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
</Fragment>
}
</s> add </s> remove return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</s> add return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</div>
{trackerData && <Popover data={trackerData} />} </s> remove return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</s> add return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</div>
{trackerData && <Popover data={trackerData} />} </s> remove {dashboard.stats &&
<Counters
refreshButton={refreshButton}
dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
replacedSafesearch={dashboard.stats.replaced_safesearch}
avgProcessingTime={dashboard.stats.avg_processing_time}
/>
}
</s> add <BlockedDomains
subtitle={subtitle}
topBlockedDomains={stats.topBlockedDomains}
blockedFiltering={stats.numBlockedFiltering}
replacedSafebrowsing={stats.numReplacedSafebrowsing}
replacedParental={stats.numReplacedParental}
refreshButton={refreshButton}
/>
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/index.js
|
keep keep replace keep replace replace replace replace replace replace replace replace replace replace replace replace
|
<mask> </PageTitle>
<mask> {dashboardProcessing && <Loading />}
<mask> {!dashboardProcessing &&
<mask> <div className="row row-cards">
<mask> {dashboard.statsHistory &&
<mask> <div className="col-lg-12">
<mask> <Statistics
<mask> history={dashboard.statsHistory}
<mask> refreshButton={refreshButton}
<mask> dnsQueries={dashboard.stats.dns_queries}
<mask> blockedFiltering={dashboard.stats.blocked_filtering}
<mask> replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
<mask> replacedParental={dashboard.stats.replaced_parental}
<mask> />
<mask> </div>
<mask> }
</s> + client: handle the new statistics format </s> remove {dashboard.stats &&
<Counters
refreshButton={refreshButton}
dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
replacedSafesearch={dashboard.stats.replaced_safesearch}
avgProcessingTime={dashboard.stats.avg_processing_time}
/>
}
</s> add <BlockedDomains
subtitle={subtitle}
topBlockedDomains={stats.topBlockedDomains}
blockedFiltering={stats.numBlockedFiltering}
replacedSafebrowsing={stats.numReplacedSafebrowsing}
replacedParental={stats.numReplacedParental}
refreshButton={refreshButton}
/> </s> remove {dashboard.topStats &&
<Fragment>
<div className="col-lg-6">
<Clients
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topClients={dashboard.topStats.top_clients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topQueriedDomains={dashboard.topStats.top_queried_domains}
/>
</div>
<div className="col-lg-6">
<BlockedDomains
refreshButton={refreshButton}
topBlockedDomains={dashboard.topStats.top_blocked_domains}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
</Fragment>
}
</s> add </s> remove {(dashboard.processingTopStats || dashboard.processingClients) && <Loading />}
{!dashboard.processingTopStats && !dashboard.processingClients && (
</s> add {(stats.processingStats || dashboard.processingClients) && <Loading />}
{!stats.processingStats && !dashboard.processingClients && ( </s> remove return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</s> add return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</div>
{trackerData && <Popover data={trackerData} />} </s> remove return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</s> add return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</div>
{trackerData && <Popover data={trackerData} />}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/index.js
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep
|
<mask> />
<mask> </div>
<mask> }
<mask> <div className="col-lg-6">
<mask> {dashboard.stats &&
<mask> <Counters
<mask> refreshButton={refreshButton}
<mask> dnsQueries={dashboard.stats.dns_queries}
<mask> blockedFiltering={dashboard.stats.blocked_filtering}
<mask> replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
<mask> replacedParental={dashboard.stats.replaced_parental}
<mask> replacedSafesearch={dashboard.stats.replaced_safesearch}
<mask> avgProcessingTime={dashboard.stats.avg_processing_time}
<mask> />
<mask> }
<mask> </div>
<mask> {dashboard.topStats &&
<mask> <Fragment>
<mask> <div className="col-lg-6">
<mask> <Clients
<mask> dnsQueries={dashboard.stats.dns_queries}
<mask> refreshButton={refreshButton}
<mask> topClients={dashboard.topStats.top_clients}
<mask> clients={dashboard.clients}
<mask> autoClients={dashboard.autoClients}
<mask> />
<mask> </div>
<mask> <div className="col-lg-6">
<mask> <QueriedDomains
<mask> dnsQueries={dashboard.stats.dns_queries}
<mask> refreshButton={refreshButton}
<mask> topQueriedDomains={dashboard.topStats.top_queried_domains}
<mask> />
<mask> </div>
<mask> <div className="col-lg-6">
<mask> <BlockedDomains
<mask> refreshButton={refreshButton}
<mask> topBlockedDomains={dashboard.topStats.top_blocked_domains}
<mask> blockedFiltering={dashboard.stats.blocked_filtering}
<mask> replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
<mask> replacedParental={dashboard.stats.replaced_parental}
<mask> />
<mask> </div>
<mask> </Fragment>
<mask> }
<mask> </div>
<mask> }
</s> + client: handle the new statistics format </s> remove {dashboard.statsHistory &&
<div className="col-lg-12">
<Statistics
history={dashboard.statsHistory}
refreshButton={refreshButton}
dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
}
</s> add <div className="col-lg-12">
<Statistics
interval={stats.interval}
dnsQueries={stats.dnsQueries}
blockedFiltering={stats.blockedFiltering}
replacedSafebrowsing={stats.replacedSafebrowsing}
replacedParental={stats.replacedParental}
numDnsQueries={stats.numDnsQueries}
numBlockedFiltering={stats.numBlockedFiltering}
numReplacedSafebrowsing={stats.numReplacedSafebrowsing}
numReplacedParental={stats.numReplacedParental}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<Counters
subtitle={subtitle}
interval={stats.interval}
dnsQueries={stats.numDnsQueries}
blockedFiltering={stats.numBlockedFiltering}
replacedSafebrowsing={stats.numReplacedSafebrowsing}
replacedParental={stats.numReplacedParental}
replacedSafesearch={stats.numReplacedSafesearch}
avgProcessingTime={stats.avgProcessingTime}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<Clients
subtitle={subtitle}
dnsQueries={stats.numDnsQueries}
topClients={stats.topClients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
subtitle={subtitle}
dnsQueries={stats.numDnsQueries}
topQueriedDomains={stats.topQueriedDomains}
refreshButton={refreshButton}
/>
</div> </s> remove processing={stats.setConfigProcessing}
</s> add processing={stats.processingSetConfig} </s> remove <Line data={queriesData} color={STATUS_COLORS.blue}/>
</s> add <Line
data={this.getNormalizedHistory(dnsQueries, interval, 'dnsQueries')}
color={STATUS_COLORS.blue}
/> </s> remove <Line data={filteringData} color={STATUS_COLORS.red}/>
</s> add <Line
data={this.getNormalizedHistory(
blockedFiltering,
interval,
'blockedFiltering',
)}
color={STATUS_COLORS.red}
/> </s> remove <Line data={safebrowsingData} color={STATUS_COLORS.green}/>
</s> add <Line
data={this.getNormalizedHistory(
replacedSafebrowsing,
interval,
'replacedSafebrowsing',
)}
color={STATUS_COLORS.green}
/>
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/index.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> </div>
<mask> </Fragment>
<mask> }
<mask> </div>
<mask> }
<mask> </Fragment>
<mask> );
<mask> }
<mask> }
<mask>
</s> + client: handle the new statistics format </s> remove {dashboard.topStats &&
<Fragment>
<div className="col-lg-6">
<Clients
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topClients={dashboard.topStats.top_clients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topQueriedDomains={dashboard.topStats.top_queried_domains}
/>
</div>
<div className="col-lg-6">
<BlockedDomains
refreshButton={refreshButton}
topBlockedDomains={dashboard.topStats.top_blocked_domains}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
</Fragment>
}
</s> add </s> remove topStats={dashboard.topStats}
</s> add topClients={stats.topClients} </s> remove {dashboard.stats &&
<Counters
refreshButton={refreshButton}
dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
replacedSafesearch={dashboard.stats.replaced_safesearch}
avgProcessingTime={dashboard.stats.avg_processing_time}
/>
}
</s> add <BlockedDomains
subtitle={subtitle}
topBlockedDomains={stats.topBlockedDomains}
blockedFiltering={stats.numBlockedFiltering}
replacedSafebrowsing={stats.numReplacedSafebrowsing}
replacedParental={stats.numReplacedParental}
refreshButton={refreshButton}
/> </s> remove return (
<div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}>
{client}
</span>
</div>
);
</s> add return (
<div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}>
{client}
</span>
</div>
);
},
sortMethod: (a, b) =>
parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10), </s> remove return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</s> add return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</div>
{trackerData && <Popover data={trackerData} />} </s> remove return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</s> add return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</div>
{trackerData && <Popover data={trackerData} />}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/index.js
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep
|
<mask> }
<mask> }
<mask>
<mask> Dashboard.propTypes = {
<mask> getStats: PropTypes.func,
<mask> getStatsHistory: PropTypes.func,
<mask> getTopStats: PropTypes.func,
<mask> dashboard: PropTypes.object,
<mask> isCoreRunning: PropTypes.bool,
<mask> getFiltering: PropTypes.func,
<mask> toggleProtection: PropTypes.func,
<mask> getClients: PropTypes.func,
<mask> processingProtection: PropTypes.bool,
<mask> t: PropTypes.func,
<mask> };
<mask>
<mask> export default withNamespaces()(Dashboard);
</s> + client: handle the new statistics format </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> remove topQueriedDomains: PropTypes.object.isRequired,
</s> add topQueriedDomains: PropTypes.array.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> remove topBlockedDomains: PropTypes.object.isRequired,
</s> add topBlockedDomains: PropTypes.array.isRequired, </s> remove topClients: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Dashboard/index.js
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> };
<mask> };
<mask>
<mask> getStats = (ip, stats) => {
<mask> if (stats && stats.top_clients) {
<mask> return stats.top_clients[ip];
<mask> }
<mask>
<mask> return '';
<mask> };
<mask>
</s> + client: handle the new statistics format </s> remove if (stats && stats.top_clients) {
return stats.top_clients[ip];
</s> add if (stats) {
const statsForCurrentIP = stats.find(item => item.name === ip);
return statsForCurrentIP && statsForCurrentIP.count; </s> remove }
</s> add }; </s> remove }
</s> add }; </s> remove const dayAgo = subHours(Date.now(), 24);
const data = history[key].map((item, index) => {
const formatHour = dateFormat(addHours(dayAgo, index), 'ddd HH:00');
const roundValue = round(item, 2);
return {
x: formatHour,
y: roundValue,
};
});
</s> add const daysAgo = subDays(Date.now(), interval - 1);
return history.map((item, index) => ({
x: dateFormat(addDays(daysAgo, index), 'D MMM YYYY'),
y: round(item, 2),
}));
}; </s> remove export const getStatsRequest = createAction('GET_STATS_REQUEST');
export const getStatsFailure = createAction('GET_STATS_FAILURE');
export const getStatsSuccess = createAction('GET_STATS_SUCCESS');
export const getStats = () => async (dispatch) => {
dispatch(getStatsRequest());
try {
const stats = await apiClient.getGlobalStats();
const processedStats = {
...stats,
avg_processing_time: round(stats.avg_processing_time, 2),
};
dispatch(getStatsSuccess(processedStats));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getStatsFailure());
}
};
</s> add </s> remove const { dashboard } = state;
const props = { dashboard };
</s> add const { dashboard, stats } = state;
const props = { dashboard, stats };
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/AutoClients.js
|
keep keep replace keep keep keep replace keep
|
<mask> },
<mask> {
<mask> Header: this.props.t('table_statistics'),
<mask> accessor: 'statistics',
<mask> Cell: (row) => {
<mask> const clientIP = row.original.ip;
<mask> const clientStats = clientIP && this.getStats(clientIP, this.props.topStats);
<mask>
</s> + client: handle the new statistics format </s> remove Header: this.props.t('table_statistics'),
</s> add Header: this.props.t('requests_count'), </s> remove const clientStats = clientIP && this.getStats(clientIP, this.props.topStats);
</s> add const clientStats = clientIP && this.getStats(clientIP, this.props.topClients); </s> remove columns = [{
Header: 'IP',
accessor: 'ip',
Cell: (row) => {
const { value } = row;
const trackerData = getTrackerData(value);
</s> add columns = [
{
Header: <Trans>domain</Trans>,
accessor: 'domain',
Cell: (row) => {
const { value } = row;
const trackerData = getTrackerData(value); </s> remove columns = [{
Header: 'IP',
accessor: 'ip',
Cell: (row) => {
const { value } = row;
const trackerData = getTrackerData(value);
</s> add columns = [
{
Header: <Trans>domain</Trans>,
accessor: 'domain',
Cell: (row) => {
const { value } = row;
const trackerData = getTrackerData(value); </s> remove }, {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
maxWidth: 190,
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
</s> add {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
maxWidth: 190,
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/AutoClients.js
|
keep keep keep keep replace keep keep keep
|
<mask>
<mask> AutoClients.propTypes = {
<mask> t: PropTypes.func.isRequired,
<mask> autoClients: PropTypes.array.isRequired,
<mask> topStats: PropTypes.object.isRequired,
<mask> };
<mask>
<mask> export default withNamespaces()(AutoClients);
</s> + client: handle the new statistics format </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> remove topStats: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> remove topClients: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired, </s> remove getStats: PropTypes.func,
getStatsHistory: PropTypes.func,
getTopStats: PropTypes.func,
dashboard: PropTypes.object,
isCoreRunning: PropTypes.bool,
getFiltering: PropTypes.func,
toggleProtection: PropTypes.func,
getClients: PropTypes.func,
processingProtection: PropTypes.bool,
t: PropTypes.func,
</s> add dashboard: PropTypes.object.isRequired,
stats: PropTypes.object.isRequired,
getStats: PropTypes.func.isRequired,
getStatsConfig: PropTypes.func.isRequired,
toggleProtection: PropTypes.func.isRequired,
getClients: PropTypes.func.isRequired,
t: PropTypes.func.isRequired, </s> remove getTopStats: PropTypes.func.isRequired,
topStats: PropTypes.object,
</s> add getStats: PropTypes.func.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/AutoClients.js
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> };
<mask> };
<mask>
<mask> getStats = (ip, stats) => {
<mask> if (stats && stats.top_clients) {
<mask> return stats.top_clients[ip];
<mask> }
<mask>
<mask> return '';
<mask> };
<mask>
</s> + client: handle the new statistics format
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/ClientsTable.js
|
keep keep replace keep keep keep replace
|
<mask> },
<mask> {
<mask> Header: this.props.t('table_statistics'),
<mask> accessor: 'statistics',
<mask> Cell: (row) => {
<mask> const clientIP = row.original.ip;
<mask> const clientStats = clientIP && this.getStats(clientIP, this.props.topStats);
</s> + client: handle the new statistics format
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/ClientsTable.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> ClientsTable.propTypes = {
<mask> t: PropTypes.func.isRequired,
<mask> clients: PropTypes.array.isRequired,
<mask> topStats: PropTypes.object.isRequired,
<mask> toggleClientModal: PropTypes.func.isRequired,
<mask> deleteClient: PropTypes.func.isRequired,
<mask> addClient: PropTypes.func.isRequired,
<mask> updateClient: PropTypes.func.isRequired,
<mask> isModalOpen: PropTypes.bool.isRequired,
</s> + client: handle the new statistics format </s> add stats: PropTypes.object.isRequired, </s> remove getTopStats: PropTypes.func.isRequired,
topStats: PropTypes.object,
</s> add getStats: PropTypes.func.isRequired, </s> remove topStats: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired, </s> remove getStats: PropTypes.func,
getStatsHistory: PropTypes.func,
getTopStats: PropTypes.func,
dashboard: PropTypes.object,
isCoreRunning: PropTypes.bool,
getFiltering: PropTypes.func,
toggleProtection: PropTypes.func,
getClients: PropTypes.func,
processingProtection: PropTypes.bool,
t: PropTypes.func,
</s> add dashboard: PropTypes.object.isRequired,
stats: PropTypes.object.isRequired,
getStats: PropTypes.func.isRequired,
getStatsConfig: PropTypes.func.isRequired,
toggleProtection: PropTypes.func.isRequired,
getClients: PropTypes.func.isRequired,
t: PropTypes.func.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/ClientsTable.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> class Clients extends Component {
<mask> componentDidMount() {
<mask> this.props.getClients();
<mask> this.props.getTopStats();
<mask> }
<mask>
<mask> render() {
<mask> const {
<mask> t,
</s> + client: handle the new statistics format </s> remove import { getPercent } from '../../helpers/helpers';
</s> add import { getPercent, normalizeHistory } from '../../helpers/helpers'; </s> add getNormalizedHistory = (data, interval, id) => [{ data: normalizeHistory(data, interval), id }];
</s> remove this.props.getStatsHistory();
this.props.getTopStats();
</s> add this.props.getStatsConfig(); </s> remove columns = [{
Header: 'IP',
accessor: 'ip',
Cell: (row) => {
const { value } = row;
const trackerData = getTrackerData(value);
</s> add columns = [
{
Header: <Trans>domain</Trans>,
accessor: 'domain',
Cell: (row) => {
const { value } = row;
const trackerData = getTrackerData(value); </s> remove }
</s> add }; </s> add stats,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/index.js
|
keep keep keep add keep keep keep keep keep
|
<mask> render() {
<mask> const {
<mask> t,
<mask> dashboard,
<mask> clients,
<mask> addClient,
<mask> updateClient,
<mask> deleteClient,
<mask> toggleClientModal,
</s> + client: handle the new statistics format </s> remove const { dashboard, clients } = state;
</s> add const { dashboard, clients, stats } = state; </s> remove getTopStats,
</s> add getStats, </s> remove import { getClients, getTopStats } from '../actions';
</s> add import { getClients } from '../actions';
import { getStats } from '../actions/stats'; </s> add stats, </s> remove this.props.getTopStats();
</s> add this.props.getStats(); </s> remove const { dashboard, t } = this.props;
</s> add const { dashboard, stats, t } = this.props;
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/index.js
|
keep keep keep keep replace replace keep keep keep replace keep
|
<mask>
<mask> return (
<mask> <Fragment>
<mask> <PageTitle title={t('client_settings')} />
<mask> {(dashboard.processingTopStats || dashboard.processingClients) && <Loading />}
<mask> {!dashboard.processingTopStats && !dashboard.processingClients && (
<mask> <Fragment>
<mask> <ClientsTable
<mask> clients={dashboard.clients}
<mask> topStats={dashboard.topStats}
<mask> isModalOpen={clients.isModalOpen}
</s> + client: handle the new statistics format </s> remove {!dashboardProcessing &&
</s> add {!dashboardProcessing && ( </s> remove <PageTitle title={ t('dashboard') }>
</s> add <PageTitle title={t('dashboard')}> </s> remove {dashboard.stats &&
<Counters
refreshButton={refreshButton}
dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
replacedSafesearch={dashboard.stats.replaced_safesearch}
avgProcessingTime={dashboard.stats.avg_processing_time}
/>
}
</s> add <BlockedDomains
subtitle={subtitle}
topBlockedDomains={stats.topBlockedDomains}
blockedFiltering={stats.numBlockedFiltering}
replacedSafebrowsing={stats.numReplacedSafebrowsing}
replacedParental={stats.numReplacedParental}
refreshButton={refreshButton}
/> </s> remove {dashboard.topStats &&
<Fragment>
<div className="col-lg-6">
<Clients
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topClients={dashboard.topStats.top_clients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topQueriedDomains={dashboard.topStats.top_queried_domains}
/>
</div>
<div className="col-lg-6">
<BlockedDomains
refreshButton={refreshButton}
topBlockedDomains={dashboard.topStats.top_blocked_domains}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
</Fragment>
}
</s> add </s> remove {dashboard.statsHistory &&
<div className="col-lg-12">
<Statistics
history={dashboard.statsHistory}
refreshButton={refreshButton}
dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
}
</s> add <div className="col-lg-12">
<Statistics
interval={stats.interval}
dnsQueries={stats.dnsQueries}
blockedFiltering={stats.blockedFiltering}
replacedSafebrowsing={stats.replacedSafebrowsing}
replacedParental={stats.replacedParental}
numDnsQueries={stats.numDnsQueries}
numBlockedFiltering={stats.numBlockedFiltering}
numReplacedSafebrowsing={stats.numReplacedSafebrowsing}
numReplacedParental={stats.numReplacedParental}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<Counters
subtitle={subtitle}
interval={stats.interval}
dnsQueries={stats.numDnsQueries}
blockedFiltering={stats.numBlockedFiltering}
replacedSafebrowsing={stats.numReplacedSafebrowsing}
replacedParental={stats.numReplacedParental}
replacedSafesearch={stats.numReplacedSafesearch}
avgProcessingTime={stats.avgProcessingTime}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<Clients
subtitle={subtitle}
dnsQueries={stats.numDnsQueries}
topClients={stats.topClients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
subtitle={subtitle}
dnsQueries={stats.numDnsQueries}
topQueriedDomains={stats.topQueriedDomains}
refreshButton={refreshButton}
/>
</div>
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/index.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> processingUpdating={clients.processingUpdating}
<mask> />
<mask> <AutoClients
<mask> autoClients={dashboard.autoClients}
<mask> topStats={dashboard.topStats}
<mask> />
<mask> </Fragment>
<mask> )}
<mask> </Fragment>
<mask> );
</s> + client: handle the new statistics format </s> remove {dashboard.topStats &&
<Fragment>
<div className="col-lg-6">
<Clients
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topClients={dashboard.topStats.top_clients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topQueriedDomains={dashboard.topStats.top_queried_domains}
/>
</div>
<div className="col-lg-6">
<BlockedDomains
refreshButton={refreshButton}
topBlockedDomains={dashboard.topStats.top_blocked_domains}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
</Fragment>
}
</s> add </s> remove }
</s> add )} </s> remove <Line data={parentalData} color={STATUS_COLORS.yellow}/>
</s> add <Line
data={this.getNormalizedHistory(
replacedParental,
interval,
'replacedParental',
)}
color={STATUS_COLORS.yellow}
/> </s> remove {dashboard.statsHistory &&
<div className="col-lg-12">
<Statistics
history={dashboard.statsHistory}
refreshButton={refreshButton}
dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
}
</s> add <div className="col-lg-12">
<Statistics
interval={stats.interval}
dnsQueries={stats.dnsQueries}
blockedFiltering={stats.blockedFiltering}
replacedSafebrowsing={stats.replacedSafebrowsing}
replacedParental={stats.replacedParental}
numDnsQueries={stats.numDnsQueries}
numBlockedFiltering={stats.numBlockedFiltering}
numReplacedSafebrowsing={stats.numReplacedSafebrowsing}
numReplacedParental={stats.numReplacedParental}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<Counters
subtitle={subtitle}
interval={stats.interval}
dnsQueries={stats.numDnsQueries}
blockedFiltering={stats.numBlockedFiltering}
replacedSafebrowsing={stats.numReplacedSafebrowsing}
replacedParental={stats.numReplacedParental}
replacedSafesearch={stats.numReplacedSafesearch}
avgProcessingTime={stats.avgProcessingTime}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<Clients
subtitle={subtitle}
dnsQueries={stats.numDnsQueries}
topClients={stats.topClients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
subtitle={subtitle}
dnsQueries={stats.numDnsQueries}
topQueriedDomains={stats.topQueriedDomains}
refreshButton={refreshButton}
/>
</div> </s> remove <Line data={safebrowsingData} color={STATUS_COLORS.green}/>
</s> add <Line
data={this.getNormalizedHistory(
replacedSafebrowsing,
interval,
'replacedSafebrowsing',
)}
color={STATUS_COLORS.green}
/> </s> remove <Line data={filteringData} color={STATUS_COLORS.red}/>
</s> add <Line
data={this.getNormalizedHistory(
blockedFiltering,
interval,
'blockedFiltering',
)}
color={STATUS_COLORS.red}
/>
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/index.js
|
keep keep keep add keep keep keep keep keep keep
|
<mask>
<mask> Clients.propTypes = {
<mask> t: PropTypes.func.isRequired,
<mask> dashboard: PropTypes.object.isRequired,
<mask> clients: PropTypes.object.isRequired,
<mask> toggleClientModal: PropTypes.func.isRequired,
<mask> deleteClient: PropTypes.func.isRequired,
<mask> addClient: PropTypes.func.isRequired,
<mask> updateClient: PropTypes.func.isRequired,
<mask> getClients: PropTypes.func.isRequired,
</s> + client: handle the new statistics format </s> remove topStats: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired, </s> remove getTopStats: PropTypes.func.isRequired,
topStats: PropTypes.object,
</s> add getStats: PropTypes.func.isRequired, </s> remove getStats: PropTypes.func,
getStatsHistory: PropTypes.func,
getTopStats: PropTypes.func,
dashboard: PropTypes.object,
isCoreRunning: PropTypes.bool,
getFiltering: PropTypes.func,
toggleProtection: PropTypes.func,
getClients: PropTypes.func,
processingProtection: PropTypes.bool,
t: PropTypes.func,
</s> add dashboard: PropTypes.object.isRequired,
stats: PropTypes.object.isRequired,
getStats: PropTypes.func.isRequired,
getStatsConfig: PropTypes.func.isRequired,
toggleProtection: PropTypes.func.isRequired,
getClients: PropTypes.func.isRequired,
t: PropTypes.func.isRequired, </s> remove topStats: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/index.js
|
keep keep keep keep replace replace keep keep keep
|
<mask> deleteClient: PropTypes.func.isRequired,
<mask> addClient: PropTypes.func.isRequired,
<mask> updateClient: PropTypes.func.isRequired,
<mask> getClients: PropTypes.func.isRequired,
<mask> getTopStats: PropTypes.func.isRequired,
<mask> topStats: PropTypes.object,
<mask> };
<mask>
<mask> export default withNamespaces()(Clients);
</s> + client: handle the new statistics format </s> add stats: PropTypes.object.isRequired, </s> remove topStats: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired, </s> remove getStats: PropTypes.func,
getStatsHistory: PropTypes.func,
getTopStats: PropTypes.func,
dashboard: PropTypes.object,
isCoreRunning: PropTypes.bool,
getFiltering: PropTypes.func,
toggleProtection: PropTypes.func,
getClients: PropTypes.func,
processingProtection: PropTypes.bool,
t: PropTypes.func,
</s> add dashboard: PropTypes.object.isRequired,
stats: PropTypes.object.isRequired,
getStats: PropTypes.func.isRequired,
getStatsConfig: PropTypes.func.isRequired,
toggleProtection: PropTypes.func.isRequired,
getClients: PropTypes.func.isRequired,
t: PropTypes.func.isRequired, </s> remove topStats: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> add subtitle: PropTypes.string.isRequired,
interval: PropTypes.number.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/Clients/index.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> </div>
<mask> <div className="col-md-12">
<mask> <StatsConfig
<mask> interval={stats.interval}
<mask> processing={stats.setConfigProcessing}
<mask> setStatsConfig={setStatsConfig}
<mask> />
<mask> </div>
<mask> <div className="col-md-12">
<mask> <Services
</s> + client: handle the new statistics format </s> remove {dashboard.statsHistory &&
<div className="col-lg-12">
<Statistics
history={dashboard.statsHistory}
refreshButton={refreshButton}
dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
}
</s> add <div className="col-lg-12">
<Statistics
interval={stats.interval}
dnsQueries={stats.dnsQueries}
blockedFiltering={stats.blockedFiltering}
replacedSafebrowsing={stats.replacedSafebrowsing}
replacedParental={stats.replacedParental}
numDnsQueries={stats.numDnsQueries}
numBlockedFiltering={stats.numBlockedFiltering}
numReplacedSafebrowsing={stats.numReplacedSafebrowsing}
numReplacedParental={stats.numReplacedParental}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<Counters
subtitle={subtitle}
interval={stats.interval}
dnsQueries={stats.numDnsQueries}
blockedFiltering={stats.numBlockedFiltering}
replacedSafebrowsing={stats.numReplacedSafebrowsing}
replacedParental={stats.numReplacedParental}
replacedSafesearch={stats.numReplacedSafesearch}
avgProcessingTime={stats.avgProcessingTime}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<Clients
subtitle={subtitle}
dnsQueries={stats.numDnsQueries}
topClients={stats.topClients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
refreshButton={refreshButton}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
subtitle={subtitle}
dnsQueries={stats.numDnsQueries}
topQueriedDomains={stats.topQueriedDomains}
refreshButton={refreshButton}
/>
</div> </s> remove {dashboard.topStats &&
<Fragment>
<div className="col-lg-6">
<Clients
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topClients={dashboard.topStats.top_clients}
clients={dashboard.clients}
autoClients={dashboard.autoClients}
/>
</div>
<div className="col-lg-6">
<QueriedDomains
dnsQueries={dashboard.stats.dns_queries}
refreshButton={refreshButton}
topQueriedDomains={dashboard.topStats.top_queried_domains}
/>
</div>
<div className="col-lg-6">
<BlockedDomains
refreshButton={refreshButton}
topBlockedDomains={dashboard.topStats.top_blocked_domains}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental}
/>
</div>
</Fragment>
}
</s> add </s> remove <Line data={queriesData} color={STATUS_COLORS.blue}/>
</s> add <Line
data={this.getNormalizedHistory(dnsQueries, interval, 'dnsQueries')}
color={STATUS_COLORS.blue}
/> </s> remove <Line data={safebrowsingData} color={STATUS_COLORS.green}/>
</s> add <Line
data={this.getNormalizedHistory(
replacedSafebrowsing,
interval,
'replacedSafebrowsing',
)}
color={STATUS_COLORS.green}
/> </s> remove <Line data={filteringData} color={STATUS_COLORS.red}/>
</s> add <Line
data={this.getNormalizedHistory(
blockedFiltering,
interval,
'blockedFiltering',
)}
color={STATUS_COLORS.red}
/> </s> remove <Line data={parentalData} color={STATUS_COLORS.yellow}/>
</s> add <Line
data={this.getNormalizedHistory(
replacedParental,
interval,
'replacedParental',
)}
color={STATUS_COLORS.yellow}
/>
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/Settings/index.js
|
keep keep keep keep replace replace keep replace keep keep keep keep
|
<mask> import { ResponsiveLine } from '@nivo/line';
<mask>
<mask> import './Line.css';
<mask>
<mask> const Line = props => (
<mask> props.data &&
<mask> <ResponsiveLine
<mask> data={props.data}
<mask> margin={{
<mask> top: 15,
<mask> right: 0,
<mask> bottom: 1,
</s> + client: handle the new statistics format </s> remove left: 0,
</s> add left: 20, </s> remove import * as actionCreators from '../actions';
</s> add import { toggleProtection, getClients } from '../actions';
import { getStats, getStatsConfig, setStatsConfig } from '../actions/stats'; </s> remove import { getPercent } from '../../helpers/helpers';
</s> add import { getPercent, normalizeHistory } from '../../helpers/helpers'; </s> remove const { dashboard } = state;
const props = { dashboard };
</s> add const { dashboard, stats } = state;
const props = { dashboard, stats }; </s> remove const { dashboard, clients } = state;
</s> add const { dashboard, clients, stats } = state;
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/ui/Line.js
|
keep replace keep keep keep keep replace replace replace replace replace replace replace replace
|
<mask> bottom: 1,
<mask> left: 0,
<mask> }}
<mask> minY="auto"
<mask> stacked={false}
<mask> curve='linear'
<mask> axisBottom={{
<mask> tickSize: 0,
<mask> tickPadding: 10,
<mask> }}
<mask> axisLeft={{
<mask> tickSize: 0,
<mask> tickPadding: 10,
<mask> }}
</s> + client: handle the new statistics format </s> remove data={props.data}
</s> add data={data} </s> remove [actions.setStatsConfigRequest]: state => ({ ...state, setConfigProcessing: true }),
[actions.setStatsConfigFailure]: state => ({ ...state, setConfigProcessing: false }),
[actions.setStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
setConfigProcessing: false,
}),
}, {
getConfigProcessing: false,
setConfigProcessing: false,
interval: 1,
});
</s> add [actions.setStatsConfigRequest]: state => ({ ...state, processingSetConfig: true }),
[actions.setStatsConfigFailure]: state => ({ ...state, processingSetConfig: false }),
[actions.setStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
processingSetConfig: false,
}),
[actions.getStatsRequest]: state => ({ ...state, processingStats: true }),
[actions.getStatsFailure]: state => ({ ...state, processingStats: false }),
[actions.getStatsSuccess]: (state, { payload }) => {
const {
dns_queries: dnsQueries,
blocked_filtering: blockedFiltering,
replaced_parental: replacedParental,
replaced_safebrowsing: replacedSafebrowsing,
top_blocked_domains: topBlockedDomains,
top_clients: topClients,
top_queried_domains: topQueriedDomains,
num_blocked_filtering: numBlockedFiltering,
num_dns_queries: numDnsQueries,
num_replaced_parental: numReplacedParental,
num_replaced_safebrowsing: numReplacedSafebrowsing,
num_replaced_safesearch: numReplacedSafesearch,
avg_processing_time: avgProcessingTime,
} = payload;
const newState = {
...state,
processingStats: false,
dnsQueries,
blockedFiltering,
replacedParental,
replacedSafebrowsing,
topBlockedDomains,
topClients,
topQueriedDomains,
numBlockedFiltering,
numDnsQueries,
numReplacedParental,
numReplacedSafebrowsing,
numReplacedSafesearch,
avgProcessingTime,
};
return newState;
},
},
{
processingGetConfig: false,
processingSetConfig: false,
processingStats: true,
interval: 1,
dnsQueries: [],
blockedFiltering: [],
replacedParental: [],
replacedSafebrowsing: [],
topBlockedDomains: [],
topClients: [],
topQueriedDomains: [],
numBlockedFiltering: 0,
numDnsQueries: 0,
numReplacedParental: 0,
numReplacedSafebrowsing: 0,
numReplacedSafesearch: 0,
avgProcessingTime: 0,
},
); </s> remove const Line = props => (
props.data &&
</s> add const Line = ({ data, color }) => (
data && </s> add .card-chart-bg {
left: -20px;
width: calc(100% + 20px);
} </s> remove return (
<div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}>
{client}
</span>
</div>
);
</s> add return (
<div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}>
{client}
</span>
</div>
);
},
sortMethod: (a, b) =>
parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10),
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/ui/Line.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> enableGridY={false}
<mask> enableDots={false}
<mask> enableArea={true}
<mask> animate={false}
<mask> colorBy={() => (props.color)}
<mask> tooltip={slice => (
<mask> <div>
<mask> {slice.data.map(d => (
<mask> <div key={d.serie.id} className="line__tooltip">
<mask> <span className="line__tooltip-text">
</s> + client: handle the new statistics format </s> remove axisBottom={{
tickSize: 0,
tickPadding: 10,
}}
axisLeft={{
tickSize: 0,
tickPadding: 10,
}}
</s> add axisBottom={null}
axisLeft={null} </s> remove return (
<div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}>
{client}
</span>
</div>
);
</s> add return (
<div className="logs__row logs__row--overflow">
<span className="logs__text" title={value}>
{client}
</span>
</div>
);
},
sortMethod: (a, b) =>
parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10), </s> remove const Counters = props => (
<Card title={ props.t('general_statistics') } subtitle={ props.t('for_last_24_hours') } bodyType="card-table" refresh={props.refreshButton}>
<table className="table card-table">
<tbody>
<tr>
<td>
<Trans>dns_query</Trans>
<Tooltip text={ props.t('number_of_dns_query_24_hours') } type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
{props.dnsQueries}
</span>
</td>
</tr>
<tr>
<td>
<a href="#filters">
<Trans>blocked_by</Trans>
</a>
<Tooltip text={ props.t('number_of_dns_query_blocked_24_hours') } type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
{props.blockedFiltering}
</span>
</td>
</tr>
<tr>
<td>
<Trans>stats_malware_phishing</Trans>
<Tooltip text={ props.t('number_of_dns_query_blocked_24_hours_by_sec') } type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
{props.replacedSafebrowsing}
</span>
</td>
</tr>
<tr>
<td>
<Trans>stats_adult</Trans>
<Tooltip text={ props.t('number_of_dns_query_blocked_24_hours_adult') } type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
{props.replacedParental}
</span>
</td>
</tr>
<tr>
<td>
<Trans>enforced_save_search</Trans>
<Tooltip text={ props.t('number_of_dns_query_to_safe_search') } type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
{props.replacedSafesearch}
</span>
</td>
</tr>
<tr>
<td>
<Trans>average_processing_time</Trans>
<Tooltip text={ props.t('average_processing_time_hint') } type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
{props.avgProcessingTime}
</span>
</td>
</tr>
</tbody>
</table>
</Card>
);
</s> add const Counters = (props) => {
const {
t,
interval,
refreshButton,
subtitle,
dnsQueries,
blockedFiltering,
replacedSafebrowsing,
replacedParental,
replacedSafesearch,
avgProcessingTime,
} = props;
const tooltipTitle =
interval === 1
? t('number_of_dns_query_24_hours')
: t('number_of_dns_query_days', { value: interval });
return (
<Card
title={t('general_statistics')}
subtitle={subtitle}
bodyType="card-table"
refresh={refreshButton}
>
<table className="table card-table">
<tbody>
<tr>
<td>
<Trans>dns_query</Trans>
<Tooltip text={tooltipTitle} type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">{dnsQueries}</span>
</td>
</tr>
<tr>
<td>
<a href="#filters">
<Trans>blocked_by</Trans>
</a>
<Tooltip
text={t('number_of_dns_query_blocked_24_hours')}
type={tooltipType}
/>
</td>
<td className="text-right">
<span className="text-muted">{blockedFiltering}</span>
</td>
</tr>
<tr>
<td>
<Trans>stats_malware_phishing</Trans>
<Tooltip
text={t('number_of_dns_query_blocked_24_hours_by_sec')}
type={tooltipType}
/>
</td>
<td className="text-right">
<span className="text-muted">{replacedSafebrowsing}</span>
</td>
</tr>
<tr>
<td>
<Trans>stats_adult</Trans>
<Tooltip
text={t('number_of_dns_query_blocked_24_hours_adult')}
type={tooltipType}
/>
</td>
<td className="text-right">
<span className="text-muted">{replacedParental}</span>
</td>
</tr>
<tr>
<td>
<Trans>enforced_save_search</Trans>
<Tooltip
text={t('number_of_dns_query_to_safe_search')}
type={tooltipType}
/>
</td>
<td className="text-right">
<span className="text-muted">{replacedSafesearch}</span>
</td>
</tr>
<tr>
<td>
<Trans>average_processing_time</Trans>
<Tooltip text={t('average_processing_time_hint')} type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
{avgProcessingTime ? `${round(avgProcessingTime, 2)} ms` : 0}
</span>
</td>
</tr>
</tbody>
</table>
</Card>
);
}; </s> remove if (clientName) {
client = <span>{clientName} <small>({value})</small></span>;
} else {
client = value;
}
</s> add if (clientName) {
client = (
<span>
{clientName} <small>({value})</small>
</span>
);
} else {
client = value;
} </s> remove return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</s> add return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</div>
{trackerData && <Popover data={trackerData} />} </s> remove return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</s> add return (
<div className="logs__row">
<div className="logs__text" title={value}>
{value}
</div>
{trackerData && <Popover data={trackerData} />}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/components/ui/Line.js
|
keep replace keep keep keep keep replace keep
|
<mask> import { connect } from 'react-redux';
<mask> import { getClients, getTopStats } from '../actions';
<mask> import { addClient, updateClient, deleteClient, toggleClientModal } from '../actions/clients';
<mask> import Clients from '../components/Settings/Clients';
<mask>
<mask> const mapStateToProps = (state) => {
<mask> const { dashboard, clients } = state;
<mask> const props = {
</s> + client: handle the new statistics format </s> remove import * as actionCreators from '../actions';
</s> add import { toggleProtection, getClients } from '../actions';
import { getStats, getStatsConfig, setStatsConfig } from '../actions/stats'; </s> remove const { dashboard } = state;
const props = { dashboard };
</s> add const { dashboard, stats } = state;
const props = { dashboard, stats }; </s> remove import { normalizeHistory, normalizeFilteringStatus, normalizeLogs, normalizeTextarea, sortClients } from '../helpers/helpers';
</s> add import { normalizeFilteringStatus, normalizeLogs, normalizeTextarea, sortClients } from '../helpers/helpers'; </s> add import { normalizeTopStats } from '../helpers/helpers'; </s> remove import { getPercent } from '../../helpers/helpers';
</s> add import { getPercent, normalizeHistory } from '../../helpers/helpers';
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/containers/Clients.js
|
keep keep add keep keep keep keep
|
<mask> const props = {
<mask> dashboard,
<mask> clients,
<mask> };
<mask> return props;
<mask> };
<mask>
</s> + client: handle the new statistics format </s> remove const { dashboard, clients } = state;
</s> add const { dashboard, clients, stats } = state; </s> remove const { dashboard } = state;
const props = { dashboard };
</s> add const { dashboard, stats } = state;
const props = { dashboard, stats }; </s> add stats, </s> remove }
</s> add }; </s> remove const { dashboard, t } = this.props;
</s> add const { dashboard, stats, t } = this.props; </s> remove import * as actionCreators from '../actions';
</s> add import { toggleProtection, getClients } from '../actions';
import { getStats, getStatsConfig, setStatsConfig } from '../actions/stats';
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/containers/Clients.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> };
<mask>
<mask> const mapDispatchToProps = {
<mask> getClients,
<mask> getTopStats,
<mask> addClient,
<mask> updateClient,
<mask> deleteClient,
<mask> toggleClientModal,
<mask> };
</s> + client: handle the new statistics format </s> add stats, </s> add const mapDispatchToProps = {
toggleProtection,
getClients,
getStats,
getStatsConfig,
setStatsConfig,
};
</s> remove const { dashboard, clients } = state;
</s> add const { dashboard, clients, stats } = state; </s> remove import { getClients, getTopStats } from '../actions';
</s> add import { getClients } from '../actions';
import { getStats } from '../actions/stats'; </s> remove const { dashboard } = state;
const props = { dashboard };
</s> add const { dashboard, stats } = state;
const props = { dashboard, stats }; </s> remove export const getStatsRequest = createAction('GET_STATS_REQUEST');
export const getStatsFailure = createAction('GET_STATS_FAILURE');
export const getStatsSuccess = createAction('GET_STATS_SUCCESS');
export const getStats = () => async (dispatch) => {
dispatch(getStatsRequest());
try {
const stats = await apiClient.getGlobalStats();
const processedStats = {
...stats,
avg_processing_time: round(stats.avg_processing_time, 2),
};
dispatch(getStatsSuccess(processedStats));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getStatsFailure());
}
};
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/containers/Clients.js
|
keep replace keep keep keep replace replace keep keep keep
|
<mask> import { connect } from 'react-redux';
<mask> import * as actionCreators from '../actions';
<mask> import Dashboard from '../components/Dashboard';
<mask>
<mask> const mapStateToProps = (state) => {
<mask> const { dashboard } = state;
<mask> const props = { dashboard };
<mask> return props;
<mask> };
<mask>
</s> + client: handle the new statistics format </s> remove import { getClients, getTopStats } from '../actions';
</s> add import { getClients } from '../actions';
import { getStats } from '../actions/stats'; </s> remove const { dashboard, clients } = state;
</s> add const { dashboard, clients, stats } = state; </s> add import { normalizeTopStats } from '../helpers/helpers'; </s> remove import { normalizeHistory, normalizeFilteringStatus, normalizeLogs, normalizeTextarea, sortClients } from '../helpers/helpers';
</s> add import { normalizeFilteringStatus, normalizeLogs, normalizeTextarea, sortClients } from '../helpers/helpers'; </s> remove import { getPercent } from '../../helpers/helpers';
</s> add import { getPercent, normalizeHistory } from '../../helpers/helpers';
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/containers/Dashboard.js
|
keep add keep keep keep keep
|
<mask> };
<mask>
<mask> export default connect(
<mask> mapStateToProps,
<mask> mapDispatchToProps,
<mask> )(Dashboard);
</s> + client: handle the new statistics format </s> remove actionCreators,
</s> add mapDispatchToProps, </s> remove const { dashboard } = state;
const props = { dashboard };
</s> add const { dashboard, stats } = state;
const props = { dashboard, stats }; </s> remove topStats: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired, </s> add subtitle: PropTypes.string.isRequired,
interval: PropTypes.number.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> remove getTopStats: PropTypes.func.isRequired,
topStats: PropTypes.object,
</s> add getStats: PropTypes.func.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/containers/Dashboard.js
|
keep keep keep keep replace keep
|
<mask> };
<mask>
<mask> export default connect(
<mask> mapStateToProps,
<mask> actionCreators,
<mask> )(Dashboard);
</s> + client: handle the new statistics format </s> add const mapDispatchToProps = {
toggleProtection,
getClients,
getStats,
getStatsConfig,
setStatsConfig,
};
</s> remove const { dashboard } = state;
const props = { dashboard };
</s> add const { dashboard, stats } = state;
const props = { dashboard, stats }; </s> remove topStats: PropTypes.object.isRequired,
</s> add topClients: PropTypes.array.isRequired, </s> add subtitle: PropTypes.string.isRequired,
interval: PropTypes.number.isRequired, </s> remove t: PropTypes.func,
</s> add subtitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired, </s> remove getTopStats: PropTypes.func.isRequired,
topStats: PropTypes.object,
</s> add getStats: PropTypes.func.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/containers/Dashboard.js
|
keep add keep keep keep keep keep
|
<mask> import subHours from 'date-fns/sub_hours';
<mask> import addHours from 'date-fns/add_hours';
<mask> import round from 'lodash/round';
<mask> import axios from 'axios';
<mask>
<mask> import {
<mask> STANDARD_DNS_PORT,
</s> + client: handle the new statistics format </s> remove STATS_NAMES,
</s> add </s> remove import round from 'lodash/round';
</s> add </s> remove import subHours from 'date-fns/sub_hours';
import dateFormat from 'date-fns/format';
</s> add </s> add import round from 'lodash/round'; </s> remove import { normalizeHistory, normalizeFilteringStatus, normalizeLogs, normalizeTextarea, sortClients } from '../helpers/helpers';
</s> add import { normalizeFilteringStatus, normalizeLogs, normalizeTextarea, sortClients } from '../helpers/helpers'; </s> remove import map from 'lodash/map';
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/helpers/helpers.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> import round from 'lodash/round';
<mask> import axios from 'axios';
<mask>
<mask> import {
<mask> STATS_NAMES,
<mask> STANDARD_DNS_PORT,
<mask> STANDARD_WEB_PORT,
<mask> STANDARD_HTTPS_PORT,
<mask> CHECK_TIMEOUT,
<mask> } from './constants';
</s> + client: handle the new statistics format </s> add import addDays from 'date-fns/add_days';
import subDays from 'date-fns/sub_days'; </s> remove import round from 'lodash/round';
</s> add </s> add import round from 'lodash/round'; </s> remove import { normalizeHistory, normalizeFilteringStatus, normalizeLogs, normalizeTextarea, sortClients } from '../helpers/helpers';
</s> add import { normalizeFilteringStatus, normalizeLogs, normalizeTextarea, sortClients } from '../helpers/helpers'; </s> remove import subHours from 'date-fns/sub_hours';
import dateFormat from 'date-fns/format';
</s> add </s> remove import map from 'lodash/map';
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/helpers/helpers.js
|
keep keep keep keep replace replace replace replace keep keep replace replace replace replace replace replace replace replace replace replace replace keep keep keep
|
<mask> status,
<mask> };
<mask> });
<mask>
<mask> export const normalizeHistory = history => Object.keys(history).map((key) => {
<mask> let id = STATS_NAMES[key];
<mask> if (!id) {
<mask> id = key.replace(/_/g, ' ').replace(/^\w/, c => c.toUpperCase());
<mask> }
<mask>
<mask> const dayAgo = subHours(Date.now(), 24);
<mask>
<mask> const data = history[key].map((item, index) => {
<mask> const formatHour = dateFormat(addHours(dayAgo, index), 'ddd HH:00');
<mask> const roundValue = round(item, 2);
<mask>
<mask> return {
<mask> x: formatHour,
<mask> y: roundValue,
<mask> };
<mask> });
<mask>
<mask> return {
<mask> id,
</s> + client: handle the new statistics format </s> remove return {
id,
data,
};
});
</s> add export const normalizeTopStats = stats => (
stats.map(item => ({
name: Object.keys(item)[0],
count: Object.values(item)[0],
}))
); </s> remove export const getTopStatsRequest = createAction('GET_TOP_STATS_REQUEST');
export const getTopStatsFailure = createAction('GET_TOP_STATS_FAILURE');
export const getTopStatsSuccess = createAction('GET_TOP_STATS_SUCCESS');
export const getTopStats = () => async (dispatch, getState) => {
dispatch(getTopStatsRequest());
const timer = setInterval(async () => {
const state = getState();
if (state.dashboard.isCoreRunning) {
clearInterval(timer);
try {
const stats = await apiClient.getGlobalStatsTop();
dispatch(getTopStatsSuccess(stats));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getTopStatsFailure(error));
}
}
}, 100);
};
</s> add </s> remove export const getStatsRequest = createAction('GET_STATS_REQUEST');
export const getStatsFailure = createAction('GET_STATS_FAILURE');
export const getStatsSuccess = createAction('GET_STATS_SUCCESS');
export const getStats = () => async (dispatch) => {
dispatch(getStatsRequest());
try {
const stats = await apiClient.getGlobalStats();
const processedStats = {
...stats,
avg_processing_time: round(stats.avg_processing_time, 2),
};
dispatch(getStatsSuccess(processedStats));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getStatsFailure());
}
};
</s> add </s> remove export const getStatsHistoryRequest = createAction('GET_STATS_HISTORY_REQUEST');
export const getStatsHistoryFailure = createAction('GET_STATS_HISTORY_FAILURE');
export const getStatsHistorySuccess = createAction('GET_STATS_HISTORY_SUCCESS');
export const getStatsHistory = () => async (dispatch) => {
dispatch(getStatsHistoryRequest());
try {
const statsHistory = await apiClient.getGlobalStatsHistory();
const normalizedHistory = normalizeHistory(statsHistory);
dispatch(getStatsHistorySuccess(normalizedHistory));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getStatsHistoryFailure());
}
};
</s> add </s> remove const { dashboard } = state;
const props = { dashboard };
</s> add const { dashboard, stats } = state;
const props = { dashboard, stats };
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/helpers/helpers.js
|
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
|
<mask> y: roundValue,
<mask> };
<mask> });
<mask>
<mask> return {
<mask> id,
<mask> data,
<mask> };
<mask> });
<mask>
<mask> export const normalizeFilteringStatus = (filteringStatus) => {
<mask> const { enabled, filters, user_rules: userRules } = filteringStatus;
<mask> const newFilters = filters ? filters.map((filter) => {
<mask> const {
</s> + client: handle the new statistics format </s> remove const dayAgo = subHours(Date.now(), 24);
const data = history[key].map((item, index) => {
const formatHour = dateFormat(addHours(dayAgo, index), 'ddd HH:00');
const roundValue = round(item, 2);
return {
x: formatHour,
y: roundValue,
};
});
</s> add const daysAgo = subDays(Date.now(), interval - 1);
return history.map((item, index) => ({
x: dateFormat(addDays(daysAgo, index), 'D MMM YYYY'),
y: round(item, 2),
}));
}; </s> remove export const normalizeHistory = history => Object.keys(history).map((key) => {
let id = STATS_NAMES[key];
if (!id) {
id = key.replace(/_/g, ' ').replace(/^\w/, c => c.toUpperCase());
</s> add export const normalizeHistory = (history, interval) => {
if (interval === 1 || interval === 7) {
const hoursAgo = subHours(Date.now(), 24 * interval);
return history.map((item, index) => ({
x: dateFormat(addHours(hoursAgo, index), 'D MMM HH:00'),
y: round(item, 2),
})); </s> remove export const getStatsRequest = createAction('GET_STATS_REQUEST');
export const getStatsFailure = createAction('GET_STATS_FAILURE');
export const getStatsSuccess = createAction('GET_STATS_SUCCESS');
export const getStats = () => async (dispatch) => {
dispatch(getStatsRequest());
try {
const stats = await apiClient.getGlobalStats();
const processedStats = {
...stats,
avg_processing_time: round(stats.avg_processing_time, 2),
};
dispatch(getStatsSuccess(processedStats));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getStatsFailure());
}
};
</s> add </s> remove export const getTopStatsRequest = createAction('GET_TOP_STATS_REQUEST');
export const getTopStatsFailure = createAction('GET_TOP_STATS_FAILURE');
export const getTopStatsSuccess = createAction('GET_TOP_STATS_SUCCESS');
export const getTopStats = () => async (dispatch, getState) => {
dispatch(getTopStatsRequest());
const timer = setInterval(async () => {
const state = getState();
if (state.dashboard.isCoreRunning) {
clearInterval(timer);
try {
const stats = await apiClient.getGlobalStatsTop();
dispatch(getTopStatsSuccess(stats));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getTopStatsFailure(error));
}
}
}, 100);
};
</s> add </s> remove export const getStatsHistoryRequest = createAction('GET_STATS_HISTORY_REQUEST');
export const getStatsHistoryFailure = createAction('GET_STATS_HISTORY_FAILURE');
export const getStatsHistorySuccess = createAction('GET_STATS_HISTORY_SUCCESS');
export const getStatsHistory = () => async (dispatch) => {
dispatch(getStatsHistoryRequest());
try {
const statsHistory = await apiClient.getGlobalStatsHistory();
const normalizedHistory = normalizeHistory(statsHistory);
dispatch(getStatsHistorySuccess(normalizedHistory));
} catch (error) {
dispatch(addErrorToast({ error }));
dispatch(getStatsHistoryFailure());
}
};
</s> add </s> remove }
</s> add };
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/helpers/helpers.js
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask> const newState = { ...state, isCoreRunning: !state.isCoreRunning, processing: false };
<mask> return newState;
<mask> },
<mask>
<mask> [actions.getStatsRequest]: state => ({ ...state, processingStats: true }),
<mask> [actions.getStatsFailure]: state => ({ ...state, processingStats: false }),
<mask> [actions.getStatsSuccess]: (state, { payload }) => {
<mask> const newState = { ...state, stats: payload, processingStats: false };
<mask> return newState;
<mask> },
<mask>
<mask> [actions.getTopStatsRequest]: state => ({ ...state, processingTopStats: true }),
<mask> [actions.getTopStatsFailure]: state => ({ ...state, processingTopStats: false }),
<mask> [actions.getTopStatsSuccess]: (state, { payload }) => {
<mask> const newState = { ...state, topStats: payload, processingTopStats: false };
<mask> return newState;
<mask> },
<mask>
<mask> [actions.getStatsHistoryRequest]: state => ({ ...state, processingStatsHistory: true }),
<mask> [actions.getStatsHistoryFailure]: state => ({ ...state, processingStatsHistory: false }),
<mask> [actions.getStatsHistorySuccess]: (state, { payload }) => {
<mask> const newState = { ...state, statsHistory: payload, processingStatsHistory: false };
<mask> return newState;
<mask> },
<mask>
<mask> [actions.toggleLogStatusRequest]: state => ({ ...state, logStatusProcessing: true }),
<mask> [actions.toggleLogStatusFailure]: state => ({ ...state, logStatusProcessing: false }),
<mask> [actions.toggleLogStatusSuccess]: (state) => {
<mask> const { queryLogEnabled } = state;
<mask> return ({ ...state, queryLogEnabled: !queryLogEnabled, logStatusProcessing: false });
</s> + client: handle the new statistics format </s> remove const stats = handleActions({
[actions.getStatsConfigRequest]: state => ({ ...state, getConfigProcessing: true }),
[actions.getStatsConfigFailure]: state => ({ ...state, getConfigProcessing: false }),
[actions.getStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
getConfigProcessing: false,
}),
</s> add const stats = handleActions(
{
[actions.getStatsConfigRequest]: state => ({ ...state, processingGetConfig: true }),
[actions.getStatsConfigFailure]: state => ({ ...state, processingGetConfig: false }),
[actions.getStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
processingGetConfig: false,
}), </s> remove [actions.setStatsConfigRequest]: state => ({ ...state, setConfigProcessing: true }),
[actions.setStatsConfigFailure]: state => ({ ...state, setConfigProcessing: false }),
[actions.setStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
setConfigProcessing: false,
}),
}, {
getConfigProcessing: false,
setConfigProcessing: false,
interval: 1,
});
</s> add [actions.setStatsConfigRequest]: state => ({ ...state, processingSetConfig: true }),
[actions.setStatsConfigFailure]: state => ({ ...state, processingSetConfig: false }),
[actions.setStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
processingSetConfig: false,
}),
[actions.getStatsRequest]: state => ({ ...state, processingStats: true }),
[actions.getStatsFailure]: state => ({ ...state, processingStats: false }),
[actions.getStatsSuccess]: (state, { payload }) => {
const {
dns_queries: dnsQueries,
blocked_filtering: blockedFiltering,
replaced_parental: replacedParental,
replaced_safebrowsing: replacedSafebrowsing,
top_blocked_domains: topBlockedDomains,
top_clients: topClients,
top_queried_domains: topQueriedDomains,
num_blocked_filtering: numBlockedFiltering,
num_dns_queries: numDnsQueries,
num_replaced_parental: numReplacedParental,
num_replaced_safebrowsing: numReplacedSafebrowsing,
num_replaced_safesearch: numReplacedSafesearch,
avg_processing_time: avgProcessingTime,
} = payload;
const newState = {
...state,
processingStats: false,
dnsQueries,
blockedFiltering,
replacedParental,
replacedSafebrowsing,
topBlockedDomains,
topClients,
topQueriedDomains,
numBlockedFiltering,
numDnsQueries,
numReplacedParental,
numReplacedSafebrowsing,
numReplacedSafesearch,
avgProcessingTime,
};
return newState;
},
},
{
processingGetConfig: false,
processingSetConfig: false,
processingStats: true,
interval: 1,
dnsQueries: [],
blockedFiltering: [],
replacedParental: [],
replacedSafebrowsing: [],
topBlockedDomains: [],
topClients: [],
topQueriedDomains: [],
numBlockedFiltering: 0,
numDnsQueries: 0,
numReplacedParental: 0,
numReplacedSafebrowsing: 0,
numReplacedSafesearch: 0,
avgProcessingTime: 0,
},
); </s> remove topStats: [],
stats: {
dns_queries: '',
blocked_filtering: '',
replaced_safebrowsing: '',
replaced_parental: '',
replaced_safesearch: '',
avg_processing_time: '',
},
</s> add </s> remove sortMethod: (a, b) => parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10),
}, {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
</s> add {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent); </s> remove }, {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
maxWidth: 190,
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
</s> add {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
maxWidth: 190,
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent); </s> remove return (
<Cell value={value} percent={percent} color={percentColor} />
);
</s> add return <Cell value={value} percent={percent} color={percentColor} />;
},
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/reducers/index.js
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> },
<mask> }, {
<mask> processing: true,
<mask> isCoreRunning: false,
<mask> processingTopStats: true,
<mask> processingStats: true,
<mask> logStatusProcessing: false,
<mask> processingVersion: true,
<mask> processingFiltering: true,
<mask> processingClients: true,
<mask> processingUpdate: false,
</s> + client: handle the new statistics format </s> remove [actions.setStatsConfigRequest]: state => ({ ...state, setConfigProcessing: true }),
[actions.setStatsConfigFailure]: state => ({ ...state, setConfigProcessing: false }),
[actions.setStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
setConfigProcessing: false,
}),
}, {
getConfigProcessing: false,
setConfigProcessing: false,
interval: 1,
});
</s> add [actions.setStatsConfigRequest]: state => ({ ...state, processingSetConfig: true }),
[actions.setStatsConfigFailure]: state => ({ ...state, processingSetConfig: false }),
[actions.setStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
processingSetConfig: false,
}),
[actions.getStatsRequest]: state => ({ ...state, processingStats: true }),
[actions.getStatsFailure]: state => ({ ...state, processingStats: false }),
[actions.getStatsSuccess]: (state, { payload }) => {
const {
dns_queries: dnsQueries,
blocked_filtering: blockedFiltering,
replaced_parental: replacedParental,
replaced_safebrowsing: replacedSafebrowsing,
top_blocked_domains: topBlockedDomains,
top_clients: topClients,
top_queried_domains: topQueriedDomains,
num_blocked_filtering: numBlockedFiltering,
num_dns_queries: numDnsQueries,
num_replaced_parental: numReplacedParental,
num_replaced_safebrowsing: numReplacedSafebrowsing,
num_replaced_safesearch: numReplacedSafesearch,
avg_processing_time: avgProcessingTime,
} = payload;
const newState = {
...state,
processingStats: false,
dnsQueries,
blockedFiltering,
replacedParental,
replacedSafebrowsing,
topBlockedDomains,
topClients,
topQueriedDomains,
numBlockedFiltering,
numDnsQueries,
numReplacedParental,
numReplacedSafebrowsing,
numReplacedSafesearch,
avgProcessingTime,
};
return newState;
},
},
{
processingGetConfig: false,
processingSetConfig: false,
processingStats: true,
interval: 1,
dnsQueries: [],
blockedFiltering: [],
replacedParental: [],
replacedSafebrowsing: [],
topBlockedDomains: [],
topClients: [],
topQueriedDomains: [],
numBlockedFiltering: 0,
numDnsQueries: 0,
numReplacedParental: 0,
numReplacedSafebrowsing: 0,
numReplacedSafesearch: 0,
avgProcessingTime: 0,
},
); </s> remove [actions.getStatsRequest]: state => ({ ...state, processingStats: true }),
[actions.getStatsFailure]: state => ({ ...state, processingStats: false }),
[actions.getStatsSuccess]: (state, { payload }) => {
const newState = { ...state, stats: payload, processingStats: false };
return newState;
},
[actions.getTopStatsRequest]: state => ({ ...state, processingTopStats: true }),
[actions.getTopStatsFailure]: state => ({ ...state, processingTopStats: false }),
[actions.getTopStatsSuccess]: (state, { payload }) => {
const newState = { ...state, topStats: payload, processingTopStats: false };
return newState;
},
[actions.getStatsHistoryRequest]: state => ({ ...state, processingStatsHistory: true }),
[actions.getStatsHistoryFailure]: state => ({ ...state, processingStatsHistory: false }),
[actions.getStatsHistorySuccess]: (state, { payload }) => {
const newState = { ...state, statsHistory: payload, processingStatsHistory: false };
return newState;
},
</s> add </s> remove const stats = handleActions({
[actions.getStatsConfigRequest]: state => ({ ...state, getConfigProcessing: true }),
[actions.getStatsConfigFailure]: state => ({ ...state, getConfigProcessing: false }),
[actions.getStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
getConfigProcessing: false,
}),
</s> add const stats = handleActions(
{
[actions.getStatsConfigRequest]: state => ({ ...state, processingGetConfig: true }),
[actions.getStatsConfigFailure]: state => ({ ...state, processingGetConfig: false }),
[actions.getStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
processingGetConfig: false,
}), </s> remove {trackerData && <Popover data={trackerData} />}
</div>
);
</s> add );
}, </s> remove {trackerData && <Popover data={trackerData} />}
</div>
);
</s> add );
}, </s> remove Header: this.props.t('table_statistics'),
</s> add Header: this.props.t('requests_count'),
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/reducers/index.js
|
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask> dnsAddresses: [],
<mask> dnsVersion: '',
<mask> clients: [],
<mask> autoClients: [],
<mask> topStats: [],
<mask> stats: {
<mask> dns_queries: '',
<mask> blocked_filtering: '',
<mask> replaced_safebrowsing: '',
<mask> replaced_parental: '',
<mask> replaced_safesearch: '',
<mask> avg_processing_time: '',
<mask> },
<mask> });
<mask>
<mask> const queryLogs = handleActions({
<mask> [actions.getLogsRequest]: state => ({ ...state, getLogsProcessing: true }),
<mask> [actions.getLogsFailure]: state => ({ ...state, getLogsProcessing: false }),
</s> + client: handle the new statistics format </s> remove [actions.setStatsConfigRequest]: state => ({ ...state, setConfigProcessing: true }),
[actions.setStatsConfigFailure]: state => ({ ...state, setConfigProcessing: false }),
[actions.setStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
setConfigProcessing: false,
}),
}, {
getConfigProcessing: false,
setConfigProcessing: false,
interval: 1,
});
</s> add [actions.setStatsConfigRequest]: state => ({ ...state, processingSetConfig: true }),
[actions.setStatsConfigFailure]: state => ({ ...state, processingSetConfig: false }),
[actions.setStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
processingSetConfig: false,
}),
[actions.getStatsRequest]: state => ({ ...state, processingStats: true }),
[actions.getStatsFailure]: state => ({ ...state, processingStats: false }),
[actions.getStatsSuccess]: (state, { payload }) => {
const {
dns_queries: dnsQueries,
blocked_filtering: blockedFiltering,
replaced_parental: replacedParental,
replaced_safebrowsing: replacedSafebrowsing,
top_blocked_domains: topBlockedDomains,
top_clients: topClients,
top_queried_domains: topQueriedDomains,
num_blocked_filtering: numBlockedFiltering,
num_dns_queries: numDnsQueries,
num_replaced_parental: numReplacedParental,
num_replaced_safebrowsing: numReplacedSafebrowsing,
num_replaced_safesearch: numReplacedSafesearch,
avg_processing_time: avgProcessingTime,
} = payload;
const newState = {
...state,
processingStats: false,
dnsQueries,
blockedFiltering,
replacedParental,
replacedSafebrowsing,
topBlockedDomains,
topClients,
topQueriedDomains,
numBlockedFiltering,
numDnsQueries,
numReplacedParental,
numReplacedSafebrowsing,
numReplacedSafesearch,
avgProcessingTime,
};
return newState;
},
},
{
processingGetConfig: false,
processingSetConfig: false,
processingStats: true,
interval: 1,
dnsQueries: [],
blockedFiltering: [],
replacedParental: [],
replacedSafebrowsing: [],
topBlockedDomains: [],
topClients: [],
topQueriedDomains: [],
numBlockedFiltering: 0,
numDnsQueries: 0,
numReplacedParental: 0,
numReplacedSafebrowsing: 0,
numReplacedSafesearch: 0,
avgProcessingTime: 0,
},
); </s> remove [actions.getStatsRequest]: state => ({ ...state, processingStats: true }),
[actions.getStatsFailure]: state => ({ ...state, processingStats: false }),
[actions.getStatsSuccess]: (state, { payload }) => {
const newState = { ...state, stats: payload, processingStats: false };
return newState;
},
[actions.getTopStatsRequest]: state => ({ ...state, processingTopStats: true }),
[actions.getTopStatsFailure]: state => ({ ...state, processingTopStats: false }),
[actions.getTopStatsSuccess]: (state, { payload }) => {
const newState = { ...state, topStats: payload, processingTopStats: false };
return newState;
},
[actions.getStatsHistoryRequest]: state => ({ ...state, processingStatsHistory: true }),
[actions.getStatsHistoryFailure]: state => ({ ...state, processingStatsHistory: false }),
[actions.getStatsHistorySuccess]: (state, { payload }) => {
const newState = { ...state, statsHistory: payload, processingStatsHistory: false };
return newState;
},
</s> add </s> remove const stats = handleActions({
[actions.getStatsConfigRequest]: state => ({ ...state, getConfigProcessing: true }),
[actions.getStatsConfigFailure]: state => ({ ...state, getConfigProcessing: false }),
[actions.getStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
getConfigProcessing: false,
}),
</s> add const stats = handleActions(
{
[actions.getStatsConfigRequest]: state => ({ ...state, processingGetConfig: true }),
[actions.getStatsConfigFailure]: state => ({ ...state, processingGetConfig: false }),
[actions.getStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
processingGetConfig: false,
}), </s> remove return {
id,
data,
};
});
</s> add export const normalizeTopStats = stats => (
stats.map(item => ({
name: Object.keys(item)[0],
count: Object.values(item)[0],
}))
); </s> remove sortMethod: (a, b) => parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10),
}, {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
</s> add {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent); </s> remove }, {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
maxWidth: 190,
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
</s> add {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
maxWidth: 190,
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/reducers/index.js
|
keep keep keep replace replace replace replace replace replace replace replace keep replace replace replace replace replace replace replace replace replace replace replace replace keep
|
<mask>
<mask> import * as actions from '../actions/stats';
<mask>
<mask> const stats = handleActions({
<mask> [actions.getStatsConfigRequest]: state => ({ ...state, getConfigProcessing: true }),
<mask> [actions.getStatsConfigFailure]: state => ({ ...state, getConfigProcessing: false }),
<mask> [actions.getStatsConfigSuccess]: (state, { payload }) => ({
<mask> ...state,
<mask> interval: payload.interval,
<mask> getConfigProcessing: false,
<mask> }),
<mask>
<mask> [actions.setStatsConfigRequest]: state => ({ ...state, setConfigProcessing: true }),
<mask> [actions.setStatsConfigFailure]: state => ({ ...state, setConfigProcessing: false }),
<mask> [actions.setStatsConfigSuccess]: (state, { payload }) => ({
<mask> ...state,
<mask> interval: payload.interval,
<mask> setConfigProcessing: false,
<mask> }),
<mask> }, {
<mask> getConfigProcessing: false,
<mask> setConfigProcessing: false,
<mask> interval: 1,
<mask> });
<mask>
</s> + client: handle the new statistics format </s> remove [actions.getStatsRequest]: state => ({ ...state, processingStats: true }),
[actions.getStatsFailure]: state => ({ ...state, processingStats: false }),
[actions.getStatsSuccess]: (state, { payload }) => {
const newState = { ...state, stats: payload, processingStats: false };
return newState;
},
[actions.getTopStatsRequest]: state => ({ ...state, processingTopStats: true }),
[actions.getTopStatsFailure]: state => ({ ...state, processingTopStats: false }),
[actions.getTopStatsSuccess]: (state, { payload }) => {
const newState = { ...state, topStats: payload, processingTopStats: false };
return newState;
},
[actions.getStatsHistoryRequest]: state => ({ ...state, processingStatsHistory: true }),
[actions.getStatsHistoryFailure]: state => ({ ...state, processingStatsHistory: false }),
[actions.getStatsHistorySuccess]: (state, { payload }) => {
const newState = { ...state, statsHistory: payload, processingStatsHistory: false };
return newState;
},
</s> add </s> remove topStats: [],
stats: {
dns_queries: '',
blocked_filtering: '',
replaced_safebrowsing: '',
replaced_parental: '',
replaced_safesearch: '',
avg_processing_time: '',
},
</s> add </s> remove processingTopStats: true,
processingStats: true,
</s> add </s> remove sortMethod: (a, b) => parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10),
}, {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
</s> add {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent); </s> remove }, {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
maxWidth: 190,
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
</s> add {
Header: <Trans>requests_count</Trans>,
accessor: 'count',
maxWidth: 190,
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b2496d0501d531c764437154374ecbafc8a848f
|
client/src/reducers/stats.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> import Tooltip from '../ui/Tooltip';
<mask> import './Logs.css';
<mask>
<mask> const TABLE_FIRST_PAGE = 0;
<mask> const TABLE_DEFAULT_PAGE_SIZE = 50;
<mask> const INITIAL_REQUEST_DATA = ['', DEFAULT_LOGS_FILTER, TABLE_FIRST_PAGE, TABLE_DEFAULT_PAGE_SIZE];
<mask> const FILTERED_REASON = 'Filtered';
<mask> const RESPONSE_FILTER = {
<mask> ALL: 'all',
<mask> FILTERED: 'filtered',
</s> + client: hide page size option and page info </s> remove renderTotalPagesCount={this.showTotalPagesCount}
</s> add pageText={''}
ofText={''}
renderCurrentPage={() => false}
renderTotalPagesCount={() => false} </s> remove pageText={t('page_table_footer_text')}
ofText={t('of_table_footer_text')}
</s> add </s> remove showPagination={true}
</s> add </s> add showPageSizeOptions={false} </s> add showPagination={true}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b64d393bdcf89d5d9aa1a83b062a46b74caccef
|
client/src/components/Logs/index.js
|
keep add keep keep keep keep keep
|
<mask> data={logs || []}
<mask> loading={isLoading}
<mask> showPageJump={false}
<mask> showPageSizeOptions={false}
<mask> onFetchData={this.fetchData}
<mask> onFilteredChange={this.handleFilterChange}
<mask> className="logs__table"
</s> + client: hide page size option and page info </s> add showPageSizeOptions={false} </s> remove renderTotalPagesCount={this.showTotalPagesCount}
</s> add pageText={''}
ofText={''}
renderCurrentPage={() => false}
renderTotalPagesCount={() => false} </s> remove pageText={t('page_table_footer_text')}
ofText={t('of_table_footer_text')}
</s> add </s> remove showPagination={true}
</s> add </s> remove const TABLE_DEFAULT_PAGE_SIZE = 50;
</s> add const TABLE_DEFAULT_PAGE_SIZE = 100;
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b64d393bdcf89d5d9aa1a83b062a46b74caccef
|
client/src/components/Logs/index.js
|
keep keep add keep keep keep keep
|
<mask> loading={isLoading}
<mask> showPagination={true}
<mask> showPageJump={false}
<mask> onFetchData={this.fetchData}
<mask> onFilteredChange={this.handleFilterChange}
<mask> className="logs__table"
<mask> defaultPageSize={TABLE_DEFAULT_PAGE_SIZE}
</s> + client: hide page size option and page info </s> add showPagination={true} </s> remove renderTotalPagesCount={this.showTotalPagesCount}
</s> add pageText={''}
ofText={''}
renderCurrentPage={() => false}
renderTotalPagesCount={() => false} </s> remove pageText={t('page_table_footer_text')}
ofText={t('of_table_footer_text')}
</s> add </s> remove showPagination={true}
</s> add </s> remove const TABLE_DEFAULT_PAGE_SIZE = 50;
</s> add const TABLE_DEFAULT_PAGE_SIZE = 100;
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b64d393bdcf89d5d9aa1a83b062a46b74caccef
|
client/src/components/Logs/index.js
|
keep replace keep keep keep keep replace replace keep keep keep keep
|
<mask> className="logs__table"
<mask> showPagination={true}
<mask> defaultPageSize={TABLE_DEFAULT_PAGE_SIZE}
<mask> previousText={t('previous_btn')}
<mask> nextText={t('next_btn')}
<mask> loadingText={t('loading_table_status')}
<mask> pageText={t('page_table_footer_text')}
<mask> ofText={t('of_table_footer_text')}
<mask> rowsText={t('rows_table_footer_text')}
<mask> noDataText={t('no_logs_found')}
<mask> renderTotalPagesCount={this.showTotalPagesCount}
<mask> defaultFilterMethod={(filter, row) => {
</s> + client: hide page size option and page info </s> remove renderTotalPagesCount={this.showTotalPagesCount}
</s> add pageText={''}
ofText={''}
renderCurrentPage={() => false}
renderTotalPagesCount={() => false} </s> add showPageSizeOptions={false} </s> add showPagination={true} </s> remove const TABLE_DEFAULT_PAGE_SIZE = 50;
</s> add const TABLE_DEFAULT_PAGE_SIZE = 100;
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b64d393bdcf89d5d9aa1a83b062a46b74caccef
|
client/src/components/Logs/index.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> pageText={t('page_table_footer_text')}
<mask> ofText={t('of_table_footer_text')}
<mask> rowsText={t('rows_table_footer_text')}
<mask> noDataText={t('no_logs_found')}
<mask> renderTotalPagesCount={this.showTotalPagesCount}
<mask> defaultFilterMethod={(filter, row) => {
<mask> const id = filter.pivotId || filter.id;
<mask> return row[id] !== undefined
<mask> ? String(row[id]).indexOf(filter.value) !== -1
<mask> : true;
</s> + client: hide page size option and page info </s> remove pageText={t('page_table_footer_text')}
ofText={t('of_table_footer_text')}
</s> add </s> remove showPagination={true}
</s> add </s> add showPageSizeOptions={false} </s> add showPagination={true} </s> remove const TABLE_DEFAULT_PAGE_SIZE = 50;
</s> add const TABLE_DEFAULT_PAGE_SIZE = 100;
|
https://github.com/AdguardTeam/AdGuardHome/commit/6b64d393bdcf89d5d9aa1a83b062a46b74caccef
|
client/src/components/Logs/index.js
|
keep add keep keep keep keep keep
|
<mask> "net/http"
<mask> "os"
<mask> "strings"
<mask> "sync"
<mask> "sync/atomic"
<mask> "time"
<mask>
</s> * dnsfilter: windows: store rules in memory
* dnsfilter: ignore cosmetic rules </s> remove list, err = urlfilter.NewFileRuleList(id, dataOrFilePath, false)
</s> add list, err = urlfilter.NewFileRuleList(id, dataOrFilePath, true) </s> remove IgnoreCosmetic: false,
</s> add IgnoreCosmetic: true,
}
} else if runtime.GOOS == "windows" {
// On Windows we don't pass a file to urlfilter because
// it's difficult to update this file while it's being used.
data, err := ioutil.ReadFile(dataOrFilePath)
if err != nil {
return fmt.Errorf("ioutil.ReadFile(): %s: %s", dataOrFilePath, err)
}
list = &urlfilter.StringRuleList{
ID: id,
RulesText: string(data),
IgnoreCosmetic: true, </s> remove IgnoreCosmetic: false,
</s> add IgnoreCosmetic: true,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ba1d857ac7961ed5a97a85a328398296c520273
|
dnsfilter/dnsfilter.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> if id == 0 {
<mask> list = &urlfilter.StringRuleList{
<mask> ID: 0,
<mask> RulesText: dataOrFilePath,
<mask> IgnoreCosmetic: false,
<mask> }
<mask>
<mask> } else if !fileExists(dataOrFilePath) {
<mask> list = &urlfilter.StringRuleList{
<mask> ID: id,
</s> * dnsfilter: windows: store rules in memory
* dnsfilter: ignore cosmetic rules </s> remove list, err = urlfilter.NewFileRuleList(id, dataOrFilePath, false)
</s> add list, err = urlfilter.NewFileRuleList(id, dataOrFilePath, true) </s> remove IgnoreCosmetic: false,
</s> add IgnoreCosmetic: true,
}
} else if runtime.GOOS == "windows" {
// On Windows we don't pass a file to urlfilter because
// it's difficult to update this file while it's being used.
data, err := ioutil.ReadFile(dataOrFilePath)
if err != nil {
return fmt.Errorf("ioutil.ReadFile(): %s: %s", dataOrFilePath, err)
}
list = &urlfilter.StringRuleList{
ID: id,
RulesText: string(data),
IgnoreCosmetic: true, </s> add "runtime"
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ba1d857ac7961ed5a97a85a328398296c520273
|
dnsfilter/dnsfilter.go
|
keep keep keep keep replace keep keep keep keep replace keep keep keep keep
|
<mask>
<mask> } else if !fileExists(dataOrFilePath) {
<mask> list = &urlfilter.StringRuleList{
<mask> ID: id,
<mask> IgnoreCosmetic: false,
<mask> }
<mask>
<mask> } else {
<mask> var err error
<mask> list, err = urlfilter.NewFileRuleList(id, dataOrFilePath, false)
<mask> if err != nil {
<mask> return fmt.Errorf("urlfilter.NewFileRuleList(): %s: %s", dataOrFilePath, err)
<mask> }
<mask> }
</s> * dnsfilter: windows: store rules in memory
* dnsfilter: ignore cosmetic rules </s> remove IgnoreCosmetic: false,
</s> add IgnoreCosmetic: true, </s> add "runtime"
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ba1d857ac7961ed5a97a85a328398296c520273
|
dnsfilter/dnsfilter.go
|
keep keep keep add keep keep keep keep keep
|
<mask>
<mask> s.leasesLock.RLock()
<mask> defer s.leasesLock.RUnlock()
<mask>
<mask> for _, l := range s.leases {
<mask> if l.IP.Equal(ip4) {
<mask> unix := l.Expiry.Unix()
<mask> if unix > now || unix == leaseExpireStatic {
<mask> return l.HWAddr
</s> -(home): fix searching clients by mac address </s> remove if l.Expiry.Unix() > now && l.IP.Equal(ip) {
return l.HWAddr
</s> add if l.IP.Equal(ip4) {
unix := l.Expiry.Unix()
if unix > now || unix == leaseExpireStatic {
return l.HWAddr
} </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db") </s> add defer func() { _ = os.Remove(dbFilename) }() </s> add "time"
"github.com/AdguardTeam/AdGuardHome/dhcpd" </s> add "net"
"os" </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db")
|
https://github.com/AdguardTeam/AdGuardHome/commit/6bf512f96fbe5693473a580330ef954fc7457cd2
|
dhcpd/dhcpd.go
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> s.leasesLock.RLock()
<mask> defer s.leasesLock.RUnlock()
<mask>
<mask> for _, l := range s.leases {
<mask> if l.Expiry.Unix() > now && l.IP.Equal(ip) {
<mask> return l.HWAddr
<mask> }
<mask> }
<mask> return nil
<mask> }
<mask>
</s> -(home): fix searching clients by mac address </s> add ip4 := ip.To4()
if ip4 == nil {
return nil
}
</s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db") </s> add defer func() { _ = os.Remove(dbFilename) }() </s> add "time"
"github.com/AdguardTeam/AdGuardHome/dhcpd" </s> add "net"
"os" </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db")
|
https://github.com/AdguardTeam/AdGuardHome/commit/6bf512f96fbe5693473a580330ef954fc7457cd2
|
dhcpd/dhcpd.go
|
keep add keep keep keep keep
|
<mask> var s = Server{}
<mask> s.conf.DBFilePath = dbFilename
<mask> var p, p2 dhcp4.Packet
<mask> var hw net.HardwareAddr
<mask> var lease *Lease
<mask> var opt dhcp4.Options
</s> -(home): fix searching clients by mac address </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db") </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db") </s> add "time"
"github.com/AdguardTeam/AdGuardHome/dhcpd" </s> add "net"
"os" </s> remove if l.Expiry.Unix() > now && l.IP.Equal(ip) {
return l.HWAddr
</s> add if l.IP.Equal(ip4) {
unix := l.Expiry.Unix()
if unix > now || unix == leaseExpireStatic {
return l.HWAddr
} </s> add ip4 := ip.To4()
if ip4 == nil {
return nil
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6bf512f96fbe5693473a580330ef954fc7457cd2
|
dhcpd/dhcpd_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> p.SetCHAddr(hw2)
<mask> lease, _ = s.reserveLease(p)
<mask> lease.Expiry = time.Unix(4000000002, 0)
<mask>
<mask> os.Remove("leases.db")
<mask> s.dbStore()
<mask> s.reset()
<mask>
<mask> s.dbLoad()
<mask> check(t, bytes.Equal(s.leases[0].HWAddr, hw1), "leases[0].HWAddr")
</s> -(home): fix searching clients by mac address </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db") </s> add defer func() { _ = os.Remove(dbFilename) }() </s> add "time"
"github.com/AdguardTeam/AdGuardHome/dhcpd" </s> add "net"
"os" </s> remove if l.Expiry.Unix() > now && l.IP.Equal(ip) {
return l.HWAddr
</s> add if l.IP.Equal(ip4) {
unix := l.Expiry.Unix()
if unix > now || unix == leaseExpireStatic {
return l.HWAddr
} </s> add ip4 := ip.To4()
if ip4 == nil {
return nil
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6bf512f96fbe5693473a580330ef954fc7457cd2
|
dhcpd/dhcpd_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> check(t, bytes.Equal(s.leases[1].HWAddr, hw2), "leases[1].HWAddr")
<mask> check(t, bytes.Equal(s.leases[1].IP, []byte{1, 1, 1, 2}), "leases[1].IP")
<mask> check(t, s.leases[1].Expiry.Unix() == 4000000002, "leases[1].Expiry")
<mask>
<mask> os.Remove("leases.db")
<mask> }
<mask>
<mask> func TestIsValidSubnetMask(t *testing.T) {
<mask> if !isValidSubnetMask([]byte{255, 255, 255, 0}) {
<mask> t.Fatalf("isValidSubnetMask([]byte{255,255,255,0})")
</s> -(home): fix searching clients by mac address </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db") </s> remove if l.Expiry.Unix() > now && l.IP.Equal(ip) {
return l.HWAddr
</s> add if l.IP.Equal(ip4) {
unix := l.Expiry.Unix()
if unix > now || unix == leaseExpireStatic {
return l.HWAddr
} </s> add ip4 := ip.To4()
if ip4 == nil {
return nil
}
</s> add defer func() { _ = os.Remove(dbFilename) }() </s> add "time"
"github.com/AdguardTeam/AdGuardHome/dhcpd" </s> add "net"
"os"
|
https://github.com/AdguardTeam/AdGuardHome/commit/6bf512f96fbe5693473a580330ef954fc7457cd2
|
dhcpd/dhcpd_test.go
|
keep keep add keep keep keep keep
|
<mask> package home
<mask>
<mask> import (
<mask> "testing"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/dhcpd"
</s> -(home): fix searching clients by mac address </s> add "time"
"github.com/AdguardTeam/AdGuardHome/dhcpd" </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db") </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db") </s> add defer func() { _ = os.Remove(dbFilename) }() </s> remove if l.Expiry.Unix() > now && l.IP.Equal(ip) {
return l.HWAddr
</s> add if l.IP.Equal(ip4) {
unix := l.Expiry.Unix()
if unix > now || unix == leaseExpireStatic {
return l.HWAddr
} </s> add ip4 := ip.To4()
if ip4 == nil {
return nil
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6bf512f96fbe5693473a580330ef954fc7457cd2
|
home/clients_test.go
|
keep keep add keep keep keep keep
|
<mask> "net"
<mask> "os"
<mask> "testing"
<mask>
<mask> "github.com/stretchr/testify/assert"
<mask> )
<mask>
</s> -(home): fix searching clients by mac address </s> add "net"
"os" </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db") </s> remove os.Remove("leases.db")
</s> add _ = os.Remove("leases.db") </s> add defer func() { _ = os.Remove(dbFilename) }() </s> remove if l.Expiry.Unix() > now && l.IP.Equal(ip) {
return l.HWAddr
</s> add if l.IP.Equal(ip4) {
unix := l.Expiry.Unix()
if unix > now || unix == leaseExpireStatic {
return l.HWAddr
} </s> add ip4 := ip.To4()
if ip4 == nil {
return nil
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6bf512f96fbe5693473a580330ef954fc7457cd2
|
home/clients_test.go
|
replace keep keep keep keep keep
|
<mask> import React from 'react';
<mask> import ReactTable from 'react-table';
<mask> import PropTypes from 'prop-types';
<mask> import map from 'lodash/map';
<mask>
<mask> import Card from '../ui/Card';
</s> Add progress bar to the stats tables </s> remove import React from 'react';
</s> add import React, { Component } from 'react'; </s> remove import React from 'react';
</s> add import React, { Component } from 'react'; </s> add import Cell from '../ui/Cell'; </s> add import Cell from '../ui/Cell'; </s> add import Cell from '../ui/Cell'; </s> remove const Clients = props => (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Domain name',
accessor: 'domain',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/BlockedDomains.js
|
keep keep keep add keep keep keep keep keep
|
<mask> import PropTypes from 'prop-types';
<mask> import map from 'lodash/map';
<mask>
<mask> import Card from '../ui/Card';
<mask>
<mask> import { getPercent } from '../../helpers/helpers';
<mask> import { STATUS_COLORS } from '../../helpers/constants';
<mask>
<mask> class BlockedDomains extends Component {
</s> Add progress bar to the stats tables </s> add import Cell from '../ui/Cell'; </s> add import Cell from '../ui/Cell'; </s> remove import React from 'react';
</s> add import React, { Component } from 'react'; </s> remove import React from 'react';
</s> add import React, { Component } from 'react'; </s> remove import React from 'react';
</s> add import React, { Component } from 'react'; </s> remove const Clients = props => (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Domain name',
accessor: 'domain',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/BlockedDomains.js
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep replace keep
|
<mask> import map from 'lodash/map';
<mask>
<mask> import Card from '../ui/Card';
<mask>
<mask> const Clients = props => (
<mask> <Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<mask> <ReactTable
<mask> data={map(props.topBlockedDomains, (value, prop) => (
<mask> { ip: prop, domain: value }
<mask> ))}
<mask> columns={[{
<mask> Header: 'IP',
<mask> accessor: 'ip',
<mask> }, {
<mask> Header: 'Domain name',
<mask> accessor: 'domain',
<mask> }]}
<mask> showPagination={false}
<mask> noDataText="No domains found"
<mask> minRows={6}
<mask> className="-striped -highlight card-table-overflow"
<mask> />
<mask> </Card>
<mask> );
<mask>
<mask> Clients.propTypes = {
<mask> topBlockedDomains: PropTypes.object.isRequired,
</s> Add progress bar to the stats tables </s> remove const QueriedDomains = props => (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class QueriedDomains extends Component {
getPercentColor = (percent) => {
if (percent > 10) {
return STATUS_COLORS.red;
} else if (percent > 5) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.green;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove const Clients = props => (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class Clients extends Component {
getPercentColor = (percent) => {
if (percent > 50) {
return STATUS_COLORS.green;
} else if (percent > 10) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.red;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> add import Cell from '../ui/Cell'; </s> remove export const getPercent = (amount, number) => round(100 / (amount / number));
</s> add export const getPercent = (amount, number) => {
if (amount > 0 && number > 0) {
return round(100 / (amount / number), 2);
}
return 0;
}; </s> remove refreshButton: PropTypes.node,
</s> add blockedFiltering: PropTypes.number.isRequired,
replacedSafebrowsing: PropTypes.number.isRequired,
replacedParental: PropTypes.number.isRequired,
refreshButton: PropTypes.node.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/BlockedDomains.js
|
keep keep keep keep replace keep keep replace
|
<mask> );
<mask>
<mask> Clients.propTypes = {
<mask> topBlockedDomains: PropTypes.object.isRequired,
<mask> refreshButton: PropTypes.node,
<mask> };
<mask>
<mask> export default Clients;
</s> Add progress bar to the stats tables </s> remove refreshButton: PropTypes.node,
</s> add dnsQueries: PropTypes.number.isRequired,
refreshButton: PropTypes.node.isRequired, </s> remove Clients.propTypes = {
</s> add class BlockedDomains extends Component {
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'domain',
Cell: ({ value }) => {
const {
blockedFiltering,
replacedSafebrowsing,
replacedParental,
} = this.props;
const blocked = blockedFiltering + replacedSafebrowsing + replacedParental;
const percent = getPercent(blocked, value);
return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
},
}];
render() {
return (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
BlockedDomains.propTypes = { </s> remove refreshButton: PropTypes.node,
</s> add dnsQueries: PropTypes.number.isRequired,
refreshButton: PropTypes.node.isRequired, </s> remove const Clients = props => (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Domain name',
accessor: 'domain',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants'; </s> remove refreshButton: PropTypes.node,
</s> add refreshButton: PropTypes.node.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/BlockedDomains.js
|
replace keep keep keep keep keep
|
<mask> import React from 'react';
<mask> import ReactTable from 'react-table';
<mask> import PropTypes from 'prop-types';
<mask> import map from 'lodash/map';
<mask>
<mask> import Card from '../ui/Card';
</s> Add progress bar to the stats tables
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/Clients.js
|
keep keep add keep keep keep keep keep keep
|
<mask> import map from 'lodash/map';
<mask>
<mask> import Card from '../ui/Card';
<mask>
<mask> import { getPercent } from '../../helpers/helpers';
<mask> import { STATUS_COLORS } from '../../helpers/constants';
<mask>
<mask> class Clients extends Component {
<mask> getPercentColor = (percent) => {
</s> Add progress bar to the stats tables </s> add import Cell from '../ui/Cell'; </s> add import Cell from '../ui/Cell'; </s> remove const Clients = props => (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class Clients extends Component {
getPercentColor = (percent) => {
if (percent > 50) {
return STATUS_COLORS.green;
} else if (percent > 10) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.red;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove const Clients = props => (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Domain name',
accessor: 'domain',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants'; </s> remove const QueriedDomains = props => (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class QueriedDomains extends Component {
getPercentColor = (percent) => {
if (percent > 10) {
return STATUS_COLORS.red;
} else if (percent > 5) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.green;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove import React from 'react';
</s> add import React, { Component } from 'react';
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/Clients.js
|
keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep replace keep keep
|
<mask> import Card from '../ui/Card';
<mask>
<mask> const Clients = props => (
<mask> <Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<mask> <ReactTable
<mask> data={map(props.topClients, (value, prop) => (
<mask> { ip: prop, count: value }
<mask> ))}
<mask> columns={[{
<mask> Header: 'IP',
<mask> accessor: 'ip',
<mask> }, {
<mask> Header: 'Requests count',
<mask> accessor: 'count',
<mask> }]}
<mask> showPagination={false}
<mask> noDataText="No clients found"
<mask> minRows={6}
<mask> className="-striped -highlight card-table-overflow"
<mask> />
<mask> </Card>
<mask> );
<mask>
<mask> Clients.propTypes = {
<mask> topClients: PropTypes.object.isRequired,
<mask> refreshButton: PropTypes.node,
<mask> };
<mask>
</s> Add progress bar to the stats tables </s> remove const QueriedDomains = props => (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class QueriedDomains extends Component {
getPercentColor = (percent) => {
if (percent > 10) {
return STATUS_COLORS.red;
} else if (percent > 5) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.green;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove const Clients = props => (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Domain name',
accessor: 'domain',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants'; </s> remove Clients.propTypes = {
</s> add class BlockedDomains extends Component {
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'domain',
Cell: ({ value }) => {
const {
blockedFiltering,
replacedSafebrowsing,
replacedParental,
} = this.props;
const blocked = blockedFiltering + replacedSafebrowsing + replacedParental;
const percent = getPercent(blocked, value);
return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
},
}];
render() {
return (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
BlockedDomains.propTypes = { </s> add import Cell from '../ui/Cell'; </s> remove export const getPercent = (amount, number) => round(100 / (amount / number));
</s> add export const getPercent = (amount, number) => {
if (amount > 0 && number > 0) {
return round(100 / (amount / number), 2);
}
return 0;
};
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/Clients.js
|
keep keep keep keep replace keep keep keep
|
<mask> replacedSafebrowsing: PropTypes.number.isRequired,
<mask> replacedParental: PropTypes.number.isRequired,
<mask> replacedSafesearch: PropTypes.number.isRequired,
<mask> avgProcessingTime: PropTypes.number.isRequired,
<mask> refreshButton: PropTypes.node,
<mask> };
<mask>
<mask> export default Counters;
</s> Add progress bar to the stats tables </s> remove refreshButton: PropTypes.node,
</s> add blockedFiltering: PropTypes.number.isRequired,
replacedSafebrowsing: PropTypes.number.isRequired,
replacedParental: PropTypes.number.isRequired,
refreshButton: PropTypes.node.isRequired, </s> remove refreshButton: PropTypes.node,
</s> add dnsQueries: PropTypes.number.isRequired,
refreshButton: PropTypes.node.isRequired, </s> remove refreshButton: PropTypes.node,
</s> add dnsQueries: PropTypes.number.isRequired,
refreshButton: PropTypes.node.isRequired, </s> remove export default Clients;
</s> add export default BlockedDomains; </s> remove Clients.propTypes = {
</s> add class BlockedDomains extends Component {
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'domain',
Cell: ({ value }) => {
const {
blockedFiltering,
replacedSafebrowsing,
replacedParental,
} = this.props;
const blocked = blockedFiltering + replacedSafebrowsing + replacedParental;
const percent = getPercent(blocked, value);
return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
},
}];
render() {
return (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
BlockedDomains.propTypes = { </s> remove export const getPercent = (amount, number) => round(100 / (amount / number));
</s> add export const getPercent = (amount, number) => {
if (amount > 0 && number > 0) {
return round(100 / (amount / number), 2);
}
return 0;
};
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/Counters.js
|
replace keep keep keep keep keep
|
<mask> import React from 'react';
<mask> import ReactTable from 'react-table';
<mask> import PropTypes from 'prop-types';
<mask> import map from 'lodash/map';
<mask>
<mask> import Card from '../ui/Card';
</s> Add progress bar to the stats tables
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/QueriedDomains.js
|
keep keep keep add keep keep keep keep
|
<mask> import PropTypes from 'prop-types';
<mask> import map from 'lodash/map';
<mask>
<mask> import Card from '../ui/Card';
<mask>
<mask> import { getPercent } from '../../helpers/helpers';
<mask> import { STATUS_COLORS } from '../../helpers/constants';
<mask>
</s> Add progress bar to the stats tables </s> add import Cell from '../ui/Cell'; </s> add import Cell from '../ui/Cell'; </s> remove import React from 'react';
</s> add import React, { Component } from 'react'; </s> remove import React from 'react';
</s> add import React, { Component } from 'react'; </s> remove import React from 'react';
</s> add import React, { Component } from 'react'; </s> remove const Clients = props => (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Domain name',
accessor: 'domain',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/QueriedDomains.js
|
keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep replace keep keep
|
<mask> import Card from '../ui/Card';
<mask>
<mask> const QueriedDomains = props => (
<mask> <Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<mask> <ReactTable
<mask> data={map(props.topQueriedDomains, (value, prop) => (
<mask> { ip: prop, count: value }
<mask> ))}
<mask> columns={[{
<mask> Header: 'IP',
<mask> accessor: 'ip',
<mask> }, {
<mask> Header: 'Requests count',
<mask> accessor: 'count',
<mask> }]}
<mask> showPagination={false}
<mask> noDataText="No domains found"
<mask> minRows={6}
<mask> className="-striped -highlight card-table-overflow"
<mask> />
<mask> </Card>
<mask> );
<mask>
<mask> QueriedDomains.propTypes = {
<mask> topQueriedDomains: PropTypes.object.isRequired,
<mask> refreshButton: PropTypes.node,
<mask> };
<mask>
</s> Add progress bar to the stats tables </s> remove const Clients = props => (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class Clients extends Component {
getPercentColor = (percent) => {
if (percent > 50) {
return STATUS_COLORS.green;
} else if (percent > 10) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.red;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove const Clients = props => (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Domain name',
accessor: 'domain',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants'; </s> remove Clients.propTypes = {
</s> add class BlockedDomains extends Component {
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'domain',
Cell: ({ value }) => {
const {
blockedFiltering,
replacedSafebrowsing,
replacedParental,
} = this.props;
const blocked = blockedFiltering + replacedSafebrowsing + replacedParental;
const percent = getPercent(blocked, value);
return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
},
}];
render() {
return (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
BlockedDomains.propTypes = { </s> add import Cell from '../ui/Cell'; </s> remove export const getPercent = (amount, number) => round(100 / (amount / number));
</s> add export const getPercent = (amount, number) => {
if (amount > 0 && number > 0) {
return round(100 / (amount / number), 2);
}
return 0;
};
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/QueriedDomains.js
|
keep keep add keep keep keep keep
|
<mask> <Statistics
<mask> history={dashboard.statsHistory}
<mask> refreshButton={refreshButton}
<mask> />
<mask> </div>
<mask> }
<mask> <div className="col-lg-6">
</s> Add progress bar to the stats tables </s> add dnsQueries={dashboard.stats.dns_queries} </s> add dnsQueries={dashboard.stats.dns_queries} </s> add blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental} </s> remove Clients.propTypes = {
</s> add class BlockedDomains extends Component {
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'domain',
Cell: ({ value }) => {
const {
blockedFiltering,
replacedSafebrowsing,
replacedParental,
} = this.props;
const blocked = blockedFiltering + replacedSafebrowsing + replacedParental;
const percent = getPercent(blocked, value);
return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
},
}];
render() {
return (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
BlockedDomains.propTypes = { </s> remove const Clients = props => (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class Clients extends Component {
getPercentColor = (percent) => {
if (percent > 50) {
return STATUS_COLORS.green;
} else if (percent > 10) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.red;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove const QueriedDomains = props => (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class QueriedDomains extends Component {
getPercentColor = (percent) => {
if (percent > 10) {
return STATUS_COLORS.red;
} else if (percent > 5) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.green;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/index.js
|
keep keep keep add keep keep keep keep keep keep
|
<mask> {dashboard.topStats &&
<mask> <Fragment>
<mask> <div className="col-lg-6">
<mask> <Clients
<mask> refreshButton={refreshButton}
<mask> topClients={dashboard.topStats.top_clients}
<mask> />
<mask> </div>
<mask> <div className="col-lg-6">
<mask> <QueriedDomains
</s> Add progress bar to the stats tables </s> add dnsQueries={dashboard.stats.dns_queries} </s> add dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental} </s> add blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental} </s> remove export const getPercent = (amount, number) => round(100 / (amount / number));
</s> add export const getPercent = (amount, number) => {
if (amount > 0 && number > 0) {
return round(100 / (amount / number), 2);
}
return 0;
}; </s> remove Clients.propTypes = {
</s> add class BlockedDomains extends Component {
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'domain',
Cell: ({ value }) => {
const {
blockedFiltering,
replacedSafebrowsing,
replacedParental,
} = this.props;
const blocked = blockedFiltering + replacedSafebrowsing + replacedParental;
const percent = getPercent(blocked, value);
return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
},
}];
render() {
return (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
BlockedDomains.propTypes = { </s> remove const Clients = props => (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class Clients extends Component {
getPercentColor = (percent) => {
if (percent > 50) {
return STATUS_COLORS.green;
} else if (percent > 10) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.red;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/index.js
|
keep keep keep add keep keep keep keep keep
|
<mask> />
<mask> </div>
<mask> <div className="col-lg-6">
<mask> <QueriedDomains
<mask> refreshButton={refreshButton}
<mask> topQueriedDomains={dashboard.topStats.top_queried_domains}
<mask> />
<mask> </div>
<mask> <div className="col-lg-6">
</s> Add progress bar to the stats tables </s> add dnsQueries={dashboard.stats.dns_queries} </s> add dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental} </s> add blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental} </s> remove Clients.propTypes = {
</s> add class BlockedDomains extends Component {
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'domain',
Cell: ({ value }) => {
const {
blockedFiltering,
replacedSafebrowsing,
replacedParental,
} = this.props;
const blocked = blockedFiltering + replacedSafebrowsing + replacedParental;
const percent = getPercent(blocked, value);
return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
},
}];
render() {
return (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
BlockedDomains.propTypes = { </s> remove const Clients = props => (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class Clients extends Component {
getPercentColor = (percent) => {
if (percent > 50) {
return STATUS_COLORS.green;
} else if (percent > 10) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.red;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove const QueriedDomains = props => (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class QueriedDomains extends Component {
getPercentColor = (percent) => {
if (percent > 10) {
return STATUS_COLORS.red;
} else if (percent > 5) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.green;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/index.js
|
keep add keep keep keep keep keep keep
|
<mask> refreshButton={refreshButton}
<mask> topBlockedDomains={dashboard.topStats.top_blocked_domains}
<mask> />
<mask> </div>
<mask> </Fragment>
<mask> }
<mask> </div>
<mask> }
</s> Add progress bar to the stats tables </s> add dnsQueries={dashboard.stats.dns_queries}
blockedFiltering={dashboard.stats.blocked_filtering}
replacedSafebrowsing={dashboard.stats.replaced_safebrowsing}
replacedParental={dashboard.stats.replaced_parental} </s> add dnsQueries={dashboard.stats.dns_queries} </s> add dnsQueries={dashboard.stats.dns_queries} </s> remove const Clients = props => (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class Clients extends Component {
getPercentColor = (percent) => {
if (percent > 50) {
return STATUS_COLORS.green;
} else if (percent > 10) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.red;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove const QueriedDomains = props => (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class QueriedDomains extends Component {
getPercentColor = (percent) => {
if (percent > 10) {
return STATUS_COLORS.red;
} else if (percent > 5) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.green;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove Clients.propTypes = {
</s> add class BlockedDomains extends Component {
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'domain',
Cell: ({ value }) => {
const {
blockedFiltering,
replacedSafebrowsing,
replacedParental,
} = this.props;
const blocked = blockedFiltering + replacedSafebrowsing + replacedParental;
const percent = getPercent(blocked, value);
return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
},
}];
render() {
return (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
BlockedDomains.propTypes = {
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/Dashboard/index.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> .card-graph {
<mask> display: flex;
<mask> align-items: center;
<mask> justify-content: center;
<mask> height: 400px;
<mask> }
<mask>
<mask> .card-body--status {
<mask> padding: 2.5rem 1.5rem;
<mask> text-align: center;
</s> Add progress bar to the stats tables </s> add import Cell from '../ui/Cell'; </s> remove const Clients = props => (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class Clients extends Component {
getPercentColor = (percent) => {
if (percent > 50) {
return STATUS_COLORS.green;
} else if (percent > 10) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.red;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove const QueriedDomains = props => (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class QueriedDomains extends Component {
getPercentColor = (percent) => {
if (percent > 10) {
return STATUS_COLORS.red;
} else if (percent > 5) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.green;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> add import Cell from '../ui/Cell'; </s> remove Clients.propTypes = {
</s> add class BlockedDomains extends Component {
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'domain',
Cell: ({ value }) => {
const {
blockedFiltering,
replacedSafebrowsing,
replacedParental,
} = this.props;
const blocked = blockedFiltering + replacedSafebrowsing + replacedParental;
const percent = getPercent(blocked, value);
return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
},
}];
render() {
return (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
BlockedDomains.propTypes = { </s> add import Cell from '../ui/Cell';
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/components/ui/Card.css
|
keep keep keep keep replace
|
<mask> const newUserRules = Array.isArray(userRules) ? userRules.join('\n') : '';
<mask> return { enabled, userRules: newUserRules, filters: newFilters };
<mask> };
<mask>
<mask> export const getPercent = (amount, number) => round(100 / (amount / number));
</s> Add progress bar to the stats tables </s> remove Clients.propTypes = {
</s> add class BlockedDomains extends Component {
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'domain',
Cell: ({ value }) => {
const {
blockedFiltering,
replacedSafebrowsing,
replacedParental,
} = this.props;
const blocked = blockedFiltering + replacedSafebrowsing + replacedParental;
const percent = getPercent(blocked, value);
return (
<Cell value={value} percent={percent} color={STATUS_COLORS.red} />
);
},
}];
render() {
return (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
}
BlockedDomains.propTypes = { </s> remove const Clients = props => (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class Clients extends Component {
getPercentColor = (percent) => {
if (percent > 50) {
return STATUS_COLORS.green;
} else if (percent > 10) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.red;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top clients" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topClients, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No clients found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove const QueriedDomains = props => (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants';
class QueriedDomains extends Component {
getPercentColor = (percent) => {
if (percent > 10) {
return STATUS_COLORS.red;
} else if (percent > 5) {
return STATUS_COLORS.yellow;
}
return STATUS_COLORS.green;
}
columns = [{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Requests count',
accessor: 'count',
Cell: ({ value }) => {
const percent = getPercent(this.props.dnsQueries, value);
const percentColor = this.getPercentColor(percent);
return (
<Cell value={value} percent={percent} color={percentColor} />
);
},
}];
render() {
return (
<Card title="Top queried domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={this.props.refreshButton}>
<ReactTable
data={map(this.props.topQueriedDomains, (value, prop) => (
{ ip: prop, count: value }
))}
columns={this.columns}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
}
} </s> remove const Clients = props => (
<Card title="Top blocked domains" subtitle="for the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<ReactTable
data={map(props.topBlockedDomains, (value, prop) => (
{ ip: prop, domain: value }
))}
columns={[{
Header: 'IP',
accessor: 'ip',
}, {
Header: 'Domain name',
accessor: 'domain',
}]}
showPagination={false}
noDataText="No domains found"
minRows={6}
className="-striped -highlight card-table-overflow"
/>
</Card>
);
</s> add import { getPercent } from '../../helpers/helpers';
import { STATUS_COLORS } from '../../helpers/constants'; </s> add import Cell from '../ui/Cell'; </s> remove refreshButton: PropTypes.node,
</s> add dnsQueries: PropTypes.number.isRequired,
refreshButton: PropTypes.node.isRequired,
|
https://github.com/AdguardTeam/AdGuardHome/commit/6ca881ee86f586486fa35205eec7617d27e41a72
|
client/src/helpers/helpers.js
|
keep keep keep keep replace replace replace replace keep keep keep keep keep
|
<mask> description string
<mask> callbackWithValue func(value string)
<mask> callbackNoValue func()
<mask> }{
<mask> {"config", "c", "path to the config file", func(value string) { o.configFilename = value }, nil},
<mask> {"work-dir", "w", "path to the working directory", func(value string) { o.workDir = value }, nil},
<mask> {"host", "h", "host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
<mask> {"port", "p", "port to serve HTTP pages on", func(value string) {
<mask> v, err := strconv.Atoi(value)
<mask> if err != nil {
<mask> panic("Got port that is not a number")
<mask> }
<mask> o.bindPort = v
</s> * app: --help: more pretty help info </s> remove {"service", "s", "service control action: status, install, uninstall, start, stop, restart", func(value string) {
</s> add {"service", "s", "Service control action: status, install, uninstall, start, stop, restart", func(value string) { </s> remove {"pidfile", "", "File name to save PID to", func(value string) { o.pidFile = value }, nil},
</s> add {"pidfile", "", "Path to a file where PID is stored", func(value string) { o.pidFile = value }, nil}, </s> remove {"logfile", "l", "path to the log file. If empty, writes to stdout, if 'syslog' -- system log", func(value string) {
</s> add {"logfile", "l", "Path to log file. If empty: write to stdout; if 'syslog': write to system log", func(value string) { </s> remove {"verbose", "v", "enable verbose output", nil, func() { o.verbose = true }},
{"help", "", "print this help", nil, func() {
</s> add {"verbose", "v", "Enable verbose output", nil, func() { o.verbose = true }},
{"help", "", "Print this help", nil, func() { </s> add val := ""
if opt.callbackWithValue != nil {
val = " VALUE"
} </s> remove fmt.Printf(" %-34s %s\n", "--"+opt.longName, opt.description)
</s> add fmt.Printf(" %-34s %s\n", "--"+opt.longName+val, opt.description)
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d14ec18acec68d78572b2c6a3ba548698efde0a
|
app.go
|
keep keep replace keep keep keep keep keep keep keep keep replace keep
|
<mask> o.bindPort = v
<mask> }, nil},
<mask> {"service", "s", "service control action: status, install, uninstall, start, stop, restart", func(value string) {
<mask> o.serviceControlAction = value
<mask> }, nil},
<mask> {"logfile", "l", "path to the log file. If empty, writes to stdout, if 'syslog' -- system log", func(value string) {
<mask> o.logFile = value
<mask> }, nil},
<mask> {"service", "s", "service control action: status, install, uninstall, start, stop, restart", func(value string) {
<mask> o.serviceControlAction = value
<mask> }, nil},
<mask> {"logfile", "l", "path to the log file. If empty, writes to stdout, if 'syslog' -- system log", func(value string) {
<mask> o.logFile = value
</s> * app: --help: more pretty help info </s> remove {"pidfile", "", "File name to save PID to", func(value string) { o.pidFile = value }, nil},
</s> add {"pidfile", "", "Path to a file where PID is stored", func(value string) { o.pidFile = value }, nil}, </s> remove {"config", "c", "path to the config file", func(value string) { o.configFilename = value }, nil},
{"work-dir", "w", "path to the working directory", func(value string) { o.workDir = value }, nil},
{"host", "h", "host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
{"port", "p", "port to serve HTTP pages on", func(value string) {
</s> add {"config", "c", "Path to the config file", func(value string) { o.configFilename = value }, nil},
{"work-dir", "w", "Path to the working directory", func(value string) { o.workDir = value }, nil},
{"host", "h", "Host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
{"port", "p", "Port to serve HTTP pages on", func(value string) { </s> remove {"verbose", "v", "enable verbose output", nil, func() { o.verbose = true }},
{"help", "", "print this help", nil, func() {
</s> add {"verbose", "v", "Enable verbose output", nil, func() { o.verbose = true }},
{"help", "", "Print this help", nil, func() { </s> add val := ""
if opt.callbackWithValue != nil {
val = " VALUE"
} </s> remove fmt.Printf(" %-34s %s\n", "--"+opt.longName, opt.description)
</s> add fmt.Printf(" %-34s %s\n", "--"+opt.longName+val, opt.description)
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d14ec18acec68d78572b2c6a3ba548698efde0a
|
app.go
|
keep keep replace keep replace replace keep keep keep keep
|
<mask> o.logFile = value
<mask> }, nil},
<mask> {"pidfile", "", "File name to save PID to", func(value string) { o.pidFile = value }, nil},
<mask> {"check-config", "", "Check configuration and exit", nil, func() { o.checkConfig = true }},
<mask> {"verbose", "v", "enable verbose output", nil, func() { o.verbose = true }},
<mask> {"help", "", "print this help", nil, func() {
<mask> printHelp()
<mask> os.Exit(64)
<mask> }},
<mask> }
</s> * app: --help: more pretty help info </s> remove {"logfile", "l", "path to the log file. If empty, writes to stdout, if 'syslog' -- system log", func(value string) {
</s> add {"logfile", "l", "Path to log file. If empty: write to stdout; if 'syslog': write to system log", func(value string) { </s> remove {"config", "c", "path to the config file", func(value string) { o.configFilename = value }, nil},
{"work-dir", "w", "path to the working directory", func(value string) { o.workDir = value }, nil},
{"host", "h", "host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
{"port", "p", "port to serve HTTP pages on", func(value string) {
</s> add {"config", "c", "Path to the config file", func(value string) { o.configFilename = value }, nil},
{"work-dir", "w", "Path to the working directory", func(value string) { o.workDir = value }, nil},
{"host", "h", "Host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
{"port", "p", "Port to serve HTTP pages on", func(value string) { </s> remove {"service", "s", "service control action: status, install, uninstall, start, stop, restart", func(value string) {
</s> add {"service", "s", "Service control action: status, install, uninstall, start, stop, restart", func(value string) { </s> add val := ""
if opt.callbackWithValue != nil {
val = " VALUE"
} </s> remove fmt.Printf(" %-34s %s\n", "--"+opt.longName, opt.description)
</s> add fmt.Printf(" %-34s %s\n", "--"+opt.longName+val, opt.description)
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d14ec18acec68d78572b2c6a3ba548698efde0a
|
app.go
|
keep keep add keep keep keep keep keep
|
<mask> fmt.Printf("%s [options]\n\n", os.Args[0])
<mask> fmt.Printf("Options:\n")
<mask> for _, opt := range opts {
<mask> if opt.shortName != "" {
<mask> fmt.Printf(" -%s, %-30s %s\n", opt.shortName, "--"+opt.longName+val, opt.description)
<mask> } else {
<mask> fmt.Printf(" %-34s %s\n", "--"+opt.longName+val, opt.description)
<mask> }
</s> * app: --help: more pretty help info </s> remove fmt.Printf(" -%s, %-30s %s\n", opt.shortName, "--"+opt.longName, opt.description)
</s> add fmt.Printf(" -%s, %-30s %s\n", opt.shortName, "--"+opt.longName+val, opt.description) </s> remove fmt.Printf(" %-34s %s\n", "--"+opt.longName, opt.description)
</s> add fmt.Printf(" %-34s %s\n", "--"+opt.longName+val, opt.description) </s> remove {"service", "s", "service control action: status, install, uninstall, start, stop, restart", func(value string) {
</s> add {"service", "s", "Service control action: status, install, uninstall, start, stop, restart", func(value string) { </s> remove {"verbose", "v", "enable verbose output", nil, func() { o.verbose = true }},
{"help", "", "print this help", nil, func() {
</s> add {"verbose", "v", "Enable verbose output", nil, func() { o.verbose = true }},
{"help", "", "Print this help", nil, func() { </s> remove {"config", "c", "path to the config file", func(value string) { o.configFilename = value }, nil},
{"work-dir", "w", "path to the working directory", func(value string) { o.workDir = value }, nil},
{"host", "h", "host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
{"port", "p", "port to serve HTTP pages on", func(value string) {
</s> add {"config", "c", "Path to the config file", func(value string) { o.configFilename = value }, nil},
{"work-dir", "w", "Path to the working directory", func(value string) { o.workDir = value }, nil},
{"host", "h", "Host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
{"port", "p", "Port to serve HTTP pages on", func(value string) { </s> remove {"logfile", "l", "path to the log file. If empty, writes to stdout, if 'syslog' -- system log", func(value string) {
</s> add {"logfile", "l", "Path to log file. If empty: write to stdout; if 'syslog': write to system log", func(value string) {
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d14ec18acec68d78572b2c6a3ba548698efde0a
|
app.go
|
keep keep keep keep replace keep replace keep
|
<mask> fmt.Printf("%s [options]\n\n", os.Args[0])
<mask> fmt.Printf("Options:\n")
<mask> for _, opt := range opts {
<mask> if opt.shortName != "" {
<mask> fmt.Printf(" -%s, %-30s %s\n", opt.shortName, "--"+opt.longName, opt.description)
<mask> } else {
<mask> fmt.Printf(" %-34s %s\n", "--"+opt.longName, opt.description)
<mask> }
</s> * app: --help: more pretty help info </s> add val := ""
if opt.callbackWithValue != nil {
val = " VALUE"
} </s> remove {"service", "s", "service control action: status, install, uninstall, start, stop, restart", func(value string) {
</s> add {"service", "s", "Service control action: status, install, uninstall, start, stop, restart", func(value string) { </s> remove {"verbose", "v", "enable verbose output", nil, func() { o.verbose = true }},
{"help", "", "print this help", nil, func() {
</s> add {"verbose", "v", "Enable verbose output", nil, func() { o.verbose = true }},
{"help", "", "Print this help", nil, func() { </s> remove {"config", "c", "path to the config file", func(value string) { o.configFilename = value }, nil},
{"work-dir", "w", "path to the working directory", func(value string) { o.workDir = value }, nil},
{"host", "h", "host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
{"port", "p", "port to serve HTTP pages on", func(value string) {
</s> add {"config", "c", "Path to the config file", func(value string) { o.configFilename = value }, nil},
{"work-dir", "w", "Path to the working directory", func(value string) { o.workDir = value }, nil},
{"host", "h", "Host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
{"port", "p", "Port to serve HTTP pages on", func(value string) { </s> remove {"logfile", "l", "path to the log file. If empty, writes to stdout, if 'syslog' -- system log", func(value string) {
</s> add {"logfile", "l", "Path to log file. If empty: write to stdout; if 'syslog': write to system log", func(value string) {
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d14ec18acec68d78572b2c6a3ba548698efde0a
|
app.go
|
keep keep add keep keep keep keep
|
<mask> error
<mask> }
<mask>
<mask> // checkDNS checks the upstream server defined by upstreamConfigStr using
<mask> // healthCheck for actually exchange messages. It uses bootstrap to resolve the
<mask> // upstream's address.
<mask> func checkDNS(
</s> Pull request: 5193-long-ups-check
Merge in DNS/adguard-home from 5193-long-ups-check to master
Closes #5193.
Squashed commit of the following:
commit 787e6b9950e85b79fe50e16cda5110fe53ec3e80
Merge: f62330bd 01652e6a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 17:07:40 2022 +0300
Merge branch 'master' into 5193-long-ups-check
commit f62330bd17ec260bc8c7475c8f5ae236059cde35
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 16:28:47 2022 +0300
dnsforward: try to fix linux
commit 64bfacc58d2a4c2929d9c3cf80bc31bfca404d54
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:55:48 2022 +0300
all: log changes finally
commit 4331d1c2497a94a95e4eba0ebcb5a813260c188a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:26:45 2022 +0300
all: imp log of chagnes
commit 62ed3c123eda100813a2de2ed95c1446c7a100f0
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:23:17 2022 +0300
all: log changes
commit 73f4d59796dc5de51cf9c9953a6a22342e1ce31a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:37:18 2022 +0300
dnsforward: add defer
commit a15072f1ea3845ba135ddd61aa8d67d9c0dcd7ea
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:30:16 2022 +0300
dnsforward: imp tests
commit e74219f594094f1e3d0001664ed3f79050747a4d
Author: Eugene Burkov <[email protected]>
Date: Sat Dec 3 16:29:31 2022 +0300
dnsforward: get rid of wg
commit 165da7dc186285d6ff8b949e12d95e0da5e828eb
Author: Eugene Burkov <[email protected]>
Date: Fri Dec 2 15:42:55 2022 +0300
dnsforward: add ups check test
commit 3045273997e45e952ba58e9c7fa5bba2d21ad286
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 1 20:28:56 2022 +0300
dnsforward: imp ups check perf </s> remove for _, host := range req.PrivateUpstreams {
err = checkDNS(host, bootstraps, timeout, checkPrivateUpstreamExc)
if err != nil {
log.Info("%v", err)
// TODO(e.burkov): If passed upstream have already written an error
// above, we rewriting the error for it. These cases should be
// handled properly instead.
result[host] = err.Error()
if _, ok := err.(domainSpecificTestError); ok {
result[host] = fmt.Sprintf("WARNING: %s", result[host])
}
</s> add upsNum := len(req.Upstreams) + len(req.PrivateUpstreams)
resCh := make(chan upsCheckResult, upsNum) </s> add close(resCh) </s> remove result[host] = "OK"
</s> add for i := 0; i < upsNum; i++ {
pair := <-resCh
// TODO(e.burkov): The upstreams used for both common and private
// resolving should be reported separately.
result[pair.host] = pair.res </s> add }
for _, ups := range req.Upstreams {
go checkUps(ups, checkDNSUpstreamExc)
}
for _, ups := range req.PrivateUpstreams {
go checkUps(ups, checkPrivateUpstreamExc)
} </s> add "github.com/miekg/dns" </s> remove continue
</s> add checkUps := func(ups string, healthCheck healthCheckFunc) {
res := upsCheckResult{
host: ups,
}
defer func() { resCh <- res }()
checkErr := checkDNS(ups, bootstraps, timeout, healthCheck)
if checkErr != nil {
res.res = checkErr.Error()
} else {
res.res = "OK"
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d1adf74b1fbb5f0a941d0b7b68c4469d189adf6
|
internal/dnsforward/http.go
|
keep keep replace replace replace replace replace replace replace replace keep replace replace replace replace
|
<mask>
<mask> timeout := s.conf.UpstreamTimeout
<mask> for _, host := range req.Upstreams {
<mask> err = checkDNS(host, bootstraps, timeout, checkDNSUpstreamExc)
<mask> if err != nil {
<mask> log.Info("%v", err)
<mask> result[host] = err.Error()
<mask> if _, ok := err.(domainSpecificTestError); ok {
<mask> result[host] = fmt.Sprintf("WARNING: %s", result[host])
<mask> }
<mask>
<mask> continue
<mask> }
<mask>
<mask> result[host] = "OK"
</s> Pull request: 5193-long-ups-check
Merge in DNS/adguard-home from 5193-long-ups-check to master
Closes #5193.
Squashed commit of the following:
commit 787e6b9950e85b79fe50e16cda5110fe53ec3e80
Merge: f62330bd 01652e6a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 17:07:40 2022 +0300
Merge branch 'master' into 5193-long-ups-check
commit f62330bd17ec260bc8c7475c8f5ae236059cde35
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 16:28:47 2022 +0300
dnsforward: try to fix linux
commit 64bfacc58d2a4c2929d9c3cf80bc31bfca404d54
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:55:48 2022 +0300
all: log changes finally
commit 4331d1c2497a94a95e4eba0ebcb5a813260c188a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:26:45 2022 +0300
all: imp log of chagnes
commit 62ed3c123eda100813a2de2ed95c1446c7a100f0
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:23:17 2022 +0300
all: log changes
commit 73f4d59796dc5de51cf9c9953a6a22342e1ce31a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:37:18 2022 +0300
dnsforward: add defer
commit a15072f1ea3845ba135ddd61aa8d67d9c0dcd7ea
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:30:16 2022 +0300
dnsforward: imp tests
commit e74219f594094f1e3d0001664ed3f79050747a4d
Author: Eugene Burkov <[email protected]>
Date: Sat Dec 3 16:29:31 2022 +0300
dnsforward: get rid of wg
commit 165da7dc186285d6ff8b949e12d95e0da5e828eb
Author: Eugene Burkov <[email protected]>
Date: Fri Dec 2 15:42:55 2022 +0300
dnsforward: add ups check test
commit 3045273997e45e952ba58e9c7fa5bba2d21ad286
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 1 20:28:56 2022 +0300
dnsforward: imp ups check perf </s> remove for _, host := range req.PrivateUpstreams {
err = checkDNS(host, bootstraps, timeout, checkPrivateUpstreamExc)
if err != nil {
log.Info("%v", err)
// TODO(e.burkov): If passed upstream have already written an error
// above, we rewriting the error for it. These cases should be
// handled properly instead.
result[host] = err.Error()
if _, ok := err.(domainSpecificTestError); ok {
result[host] = fmt.Sprintf("WARNING: %s", result[host])
}
</s> add upsNum := len(req.Upstreams) + len(req.PrivateUpstreams)
resCh := make(chan upsCheckResult, upsNum) </s> remove continue
</s> add checkUps := func(ups string, healthCheck healthCheckFunc) {
res := upsCheckResult{
host: ups,
}
defer func() { resCh <- res }()
checkErr := checkDNS(ups, bootstraps, timeout, healthCheck)
if checkErr != nil {
res.res = checkErr.Error()
} else {
res.res = "OK" </s> add }
for _, ups := range req.Upstreams {
go checkUps(ups, checkDNSUpstreamExc)
}
for _, ups := range req.PrivateUpstreams {
go checkUps(ups, checkPrivateUpstreamExc)
} </s> remove result[host] = "OK"
</s> add for i := 0; i < upsNum; i++ {
pair := <-resCh
// TODO(e.burkov): The upstreams used for both common and private
// resolving should be reported separately.
result[pair.host] = pair.res </s> add close(resCh)
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d1adf74b1fbb5f0a941d0b7b68c4469d189adf6
|
internal/dnsforward/http.go
|
keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep replace keep keep keep
|
<mask> result[host] = "OK"
<mask> }
<mask>
<mask> for _, host := range req.PrivateUpstreams {
<mask> err = checkDNS(host, bootstraps, timeout, checkPrivateUpstreamExc)
<mask> if err != nil {
<mask> log.Info("%v", err)
<mask> // TODO(e.burkov): If passed upstream have already written an error
<mask> // above, we rewriting the error for it. These cases should be
<mask> // handled properly instead.
<mask> result[host] = err.Error()
<mask> if _, ok := err.(domainSpecificTestError); ok {
<mask> result[host] = fmt.Sprintf("WARNING: %s", result[host])
<mask> }
<mask>
<mask> continue
<mask> }
<mask>
<mask> result[host] = "OK"
</s> Pull request: 5193-long-ups-check
Merge in DNS/adguard-home from 5193-long-ups-check to master
Closes #5193.
Squashed commit of the following:
commit 787e6b9950e85b79fe50e16cda5110fe53ec3e80
Merge: f62330bd 01652e6a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 17:07:40 2022 +0300
Merge branch 'master' into 5193-long-ups-check
commit f62330bd17ec260bc8c7475c8f5ae236059cde35
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 16:28:47 2022 +0300
dnsforward: try to fix linux
commit 64bfacc58d2a4c2929d9c3cf80bc31bfca404d54
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:55:48 2022 +0300
all: log changes finally
commit 4331d1c2497a94a95e4eba0ebcb5a813260c188a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:26:45 2022 +0300
all: imp log of chagnes
commit 62ed3c123eda100813a2de2ed95c1446c7a100f0
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:23:17 2022 +0300
all: log changes
commit 73f4d59796dc5de51cf9c9953a6a22342e1ce31a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:37:18 2022 +0300
dnsforward: add defer
commit a15072f1ea3845ba135ddd61aa8d67d9c0dcd7ea
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:30:16 2022 +0300
dnsforward: imp tests
commit e74219f594094f1e3d0001664ed3f79050747a4d
Author: Eugene Burkov <[email protected]>
Date: Sat Dec 3 16:29:31 2022 +0300
dnsforward: get rid of wg
commit 165da7dc186285d6ff8b949e12d95e0da5e828eb
Author: Eugene Burkov <[email protected]>
Date: Fri Dec 2 15:42:55 2022 +0300
dnsforward: add ups check test
commit 3045273997e45e952ba58e9c7fa5bba2d21ad286
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 1 20:28:56 2022 +0300
dnsforward: imp ups check perf </s> remove for _, host := range req.Upstreams {
err = checkDNS(host, bootstraps, timeout, checkDNSUpstreamExc)
if err != nil {
log.Info("%v", err)
result[host] = err.Error()
if _, ok := err.(domainSpecificTestError); ok {
result[host] = fmt.Sprintf("WARNING: %s", result[host])
}
</s> add </s> remove continue
}
result[host] = "OK"
</s> add type upsCheckResult = struct {
res string
host string </s> add }
for _, ups := range req.Upstreams {
go checkUps(ups, checkDNSUpstreamExc)
}
for _, ups := range req.PrivateUpstreams {
go checkUps(ups, checkPrivateUpstreamExc)
} </s> remove result[host] = "OK"
</s> add for i := 0; i < upsNum; i++ {
pair := <-resCh
// TODO(e.burkov): The upstreams used for both common and private
// resolving should be reported separately.
result[pair.host] = pair.res </s> add // Error implements the [error] interface for domainSpecificTestError.
func (err domainSpecificTestError) Error() (msg string) {
return fmt.Sprintf("WARNING: %s", err.error)
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d1adf74b1fbb5f0a941d0b7b68c4469d189adf6
|
internal/dnsforward/http.go
|
keep keep keep add keep keep keep keep keep keep
|
<mask> res.res = checkErr.Error()
<mask> } else {
<mask> res.res = "OK"
<mask> }
<mask>
<mask> for i := 0; i < upsNum; i++ {
<mask> pair := <-resCh
<mask> // TODO(e.burkov): The upstreams used for both common and private
<mask> // resolving should be reported separately.
<mask> result[pair.host] = pair.res
</s> Pull request: 5193-long-ups-check
Merge in DNS/adguard-home from 5193-long-ups-check to master
Closes #5193.
Squashed commit of the following:
commit 787e6b9950e85b79fe50e16cda5110fe53ec3e80
Merge: f62330bd 01652e6a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 17:07:40 2022 +0300
Merge branch 'master' into 5193-long-ups-check
commit f62330bd17ec260bc8c7475c8f5ae236059cde35
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 16:28:47 2022 +0300
dnsforward: try to fix linux
commit 64bfacc58d2a4c2929d9c3cf80bc31bfca404d54
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:55:48 2022 +0300
all: log changes finally
commit 4331d1c2497a94a95e4eba0ebcb5a813260c188a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:26:45 2022 +0300
all: imp log of chagnes
commit 62ed3c123eda100813a2de2ed95c1446c7a100f0
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:23:17 2022 +0300
all: log changes
commit 73f4d59796dc5de51cf9c9953a6a22342e1ce31a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:37:18 2022 +0300
dnsforward: add defer
commit a15072f1ea3845ba135ddd61aa8d67d9c0dcd7ea
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:30:16 2022 +0300
dnsforward: imp tests
commit e74219f594094f1e3d0001664ed3f79050747a4d
Author: Eugene Burkov <[email protected]>
Date: Sat Dec 3 16:29:31 2022 +0300
dnsforward: get rid of wg
commit 165da7dc186285d6ff8b949e12d95e0da5e828eb
Author: Eugene Burkov <[email protected]>
Date: Fri Dec 2 15:42:55 2022 +0300
dnsforward: add ups check test
commit 3045273997e45e952ba58e9c7fa5bba2d21ad286
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 1 20:28:56 2022 +0300
dnsforward: imp ups check perf </s> remove result[host] = "OK"
</s> add for i := 0; i < upsNum; i++ {
pair := <-resCh
// TODO(e.burkov): The upstreams used for both common and private
// resolving should be reported separately.
result[pair.host] = pair.res </s> remove continue
</s> add checkUps := func(ups string, healthCheck healthCheckFunc) {
res := upsCheckResult{
host: ups,
}
defer func() { resCh <- res }()
checkErr := checkDNS(ups, bootstraps, timeout, healthCheck)
if checkErr != nil {
res.res = checkErr.Error()
} else {
res.res = "OK" </s> remove for _, host := range req.PrivateUpstreams {
err = checkDNS(host, bootstraps, timeout, checkPrivateUpstreamExc)
if err != nil {
log.Info("%v", err)
// TODO(e.burkov): If passed upstream have already written an error
// above, we rewriting the error for it. These cases should be
// handled properly instead.
result[host] = err.Error()
if _, ok := err.(domainSpecificTestError); ok {
result[host] = fmt.Sprintf("WARNING: %s", result[host])
}
</s> add upsNum := len(req.Upstreams) + len(req.PrivateUpstreams)
resCh := make(chan upsCheckResult, upsNum) </s> add close(resCh) </s> remove continue
}
result[host] = "OK"
</s> add type upsCheckResult = struct {
res string
host string </s> remove for _, host := range req.Upstreams {
err = checkDNS(host, bootstraps, timeout, checkDNSUpstreamExc)
if err != nil {
log.Info("%v", err)
result[host] = err.Error()
if _, ok := err.(domainSpecificTestError); ok {
result[host] = fmt.Sprintf("WARNING: %s", result[host])
}
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d1adf74b1fbb5f0a941d0b7b68c4469d189adf6
|
internal/dnsforward/http.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> continue
<mask> }
<mask>
<mask> result[host] = "OK"
<mask> }
<mask>
<mask> _ = aghhttp.WriteJSONResponse(w, r, result)
<mask> }
<mask>
</s> Pull request: 5193-long-ups-check
Merge in DNS/adguard-home from 5193-long-ups-check to master
Closes #5193.
Squashed commit of the following:
commit 787e6b9950e85b79fe50e16cda5110fe53ec3e80
Merge: f62330bd 01652e6a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 17:07:40 2022 +0300
Merge branch 'master' into 5193-long-ups-check
commit f62330bd17ec260bc8c7475c8f5ae236059cde35
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 16:28:47 2022 +0300
dnsforward: try to fix linux
commit 64bfacc58d2a4c2929d9c3cf80bc31bfca404d54
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:55:48 2022 +0300
all: log changes finally
commit 4331d1c2497a94a95e4eba0ebcb5a813260c188a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:26:45 2022 +0300
all: imp log of chagnes
commit 62ed3c123eda100813a2de2ed95c1446c7a100f0
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:23:17 2022 +0300
all: log changes
commit 73f4d59796dc5de51cf9c9953a6a22342e1ce31a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:37:18 2022 +0300
dnsforward: add defer
commit a15072f1ea3845ba135ddd61aa8d67d9c0dcd7ea
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:30:16 2022 +0300
dnsforward: imp tests
commit e74219f594094f1e3d0001664ed3f79050747a4d
Author: Eugene Burkov <[email protected]>
Date: Sat Dec 3 16:29:31 2022 +0300
dnsforward: get rid of wg
commit 165da7dc186285d6ff8b949e12d95e0da5e828eb
Author: Eugene Burkov <[email protected]>
Date: Fri Dec 2 15:42:55 2022 +0300
dnsforward: add ups check test
commit 3045273997e45e952ba58e9c7fa5bba2d21ad286
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 1 20:28:56 2022 +0300
dnsforward: imp ups check perf </s> add close(resCh) </s> remove continue
</s> add checkUps := func(ups string, healthCheck healthCheckFunc) {
res := upsCheckResult{
host: ups,
}
defer func() { resCh <- res }()
checkErr := checkDNS(ups, bootstraps, timeout, healthCheck)
if checkErr != nil {
res.res = checkErr.Error()
} else {
res.res = "OK" </s> remove continue
}
result[host] = "OK"
</s> add type upsCheckResult = struct {
res string
host string </s> remove for _, host := range req.Upstreams {
err = checkDNS(host, bootstraps, timeout, checkDNSUpstreamExc)
if err != nil {
log.Info("%v", err)
result[host] = err.Error()
if _, ok := err.(domainSpecificTestError); ok {
result[host] = fmt.Sprintf("WARNING: %s", result[host])
}
</s> add </s> remove for _, host := range req.PrivateUpstreams {
err = checkDNS(host, bootstraps, timeout, checkPrivateUpstreamExc)
if err != nil {
log.Info("%v", err)
// TODO(e.burkov): If passed upstream have already written an error
// above, we rewriting the error for it. These cases should be
// handled properly instead.
result[host] = err.Error()
if _, ok := err.(domainSpecificTestError); ok {
result[host] = fmt.Sprintf("WARNING: %s", result[host])
}
</s> add upsNum := len(req.Upstreams) + len(req.PrivateUpstreams)
resCh := make(chan upsCheckResult, upsNum) </s> add }
for _, ups := range req.Upstreams {
go checkUps(ups, checkDNSUpstreamExc)
}
for _, ups := range req.PrivateUpstreams {
go checkUps(ups, checkPrivateUpstreamExc)
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d1adf74b1fbb5f0a941d0b7b68c4469d189adf6
|
internal/dnsforward/http.go
|
keep add keep keep keep keep keep
|
<mask> result[pair.host] = pair.res
<mask> }
<mask>
<mask> _ = aghhttp.WriteJSONResponse(w, r, result)
<mask> }
<mask>
<mask> // handleCacheClear is the handler for the POST /control/cache_clear HTTP API.
</s> Pull request: 5193-long-ups-check
Merge in DNS/adguard-home from 5193-long-ups-check to master
Closes #5193.
Squashed commit of the following:
commit 787e6b9950e85b79fe50e16cda5110fe53ec3e80
Merge: f62330bd 01652e6a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 17:07:40 2022 +0300
Merge branch 'master' into 5193-long-ups-check
commit f62330bd17ec260bc8c7475c8f5ae236059cde35
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 16:28:47 2022 +0300
dnsforward: try to fix linux
commit 64bfacc58d2a4c2929d9c3cf80bc31bfca404d54
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:55:48 2022 +0300
all: log changes finally
commit 4331d1c2497a94a95e4eba0ebcb5a813260c188a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:26:45 2022 +0300
all: imp log of chagnes
commit 62ed3c123eda100813a2de2ed95c1446c7a100f0
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:23:17 2022 +0300
all: log changes
commit 73f4d59796dc5de51cf9c9953a6a22342e1ce31a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:37:18 2022 +0300
dnsforward: add defer
commit a15072f1ea3845ba135ddd61aa8d67d9c0dcd7ea
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:30:16 2022 +0300
dnsforward: imp tests
commit e74219f594094f1e3d0001664ed3f79050747a4d
Author: Eugene Burkov <[email protected]>
Date: Sat Dec 3 16:29:31 2022 +0300
dnsforward: get rid of wg
commit 165da7dc186285d6ff8b949e12d95e0da5e828eb
Author: Eugene Burkov <[email protected]>
Date: Fri Dec 2 15:42:55 2022 +0300
dnsforward: add ups check test
commit 3045273997e45e952ba58e9c7fa5bba2d21ad286
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 1 20:28:56 2022 +0300
dnsforward: imp ups check perf </s> remove result[host] = "OK"
</s> add for i := 0; i < upsNum; i++ {
pair := <-resCh
// TODO(e.burkov): The upstreams used for both common and private
// resolving should be reported separately.
result[pair.host] = pair.res </s> add // Error implements the [error] interface for domainSpecificTestError.
func (err domainSpecificTestError) Error() (msg string) {
return fmt.Sprintf("WARNING: %s", err.error)
}
</s> add }
for _, ups := range req.Upstreams {
go checkUps(ups, checkDNSUpstreamExc)
}
for _, ups := range req.PrivateUpstreams {
go checkUps(ups, checkPrivateUpstreamExc)
} </s> remove for _, host := range req.PrivateUpstreams {
err = checkDNS(host, bootstraps, timeout, checkPrivateUpstreamExc)
if err != nil {
log.Info("%v", err)
// TODO(e.burkov): If passed upstream have already written an error
// above, we rewriting the error for it. These cases should be
// handled properly instead.
result[host] = err.Error()
if _, ok := err.(domainSpecificTestError); ok {
result[host] = fmt.Sprintf("WARNING: %s", result[host])
}
</s> add upsNum := len(req.Upstreams) + len(req.PrivateUpstreams)
resCh := make(chan upsCheckResult, upsNum) </s> add "github.com/miekg/dns" </s> remove continue
}
result[host] = "OK"
</s> add type upsCheckResult = struct {
res string
host string
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d1adf74b1fbb5f0a941d0b7b68c4469d189adf6
|
internal/dnsforward/http.go
|
keep add keep keep keep keep keep keep
|
<mask> "net/http"
<mask> "net/http/httptest"
<mask> "os"
<mask> "path/filepath"
<mask> "strings"
<mask> "testing"
<mask> "time"
<mask>
</s> Pull request: 5193-long-ups-check
Merge in DNS/adguard-home from 5193-long-ups-check to master
Closes #5193.
Squashed commit of the following:
commit 787e6b9950e85b79fe50e16cda5110fe53ec3e80
Merge: f62330bd 01652e6a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 17:07:40 2022 +0300
Merge branch 'master' into 5193-long-ups-check
commit f62330bd17ec260bc8c7475c8f5ae236059cde35
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 16:28:47 2022 +0300
dnsforward: try to fix linux
commit 64bfacc58d2a4c2929d9c3cf80bc31bfca404d54
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:55:48 2022 +0300
all: log changes finally
commit 4331d1c2497a94a95e4eba0ebcb5a813260c188a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:26:45 2022 +0300
all: imp log of chagnes
commit 62ed3c123eda100813a2de2ed95c1446c7a100f0
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:23:17 2022 +0300
all: log changes
commit 73f4d59796dc5de51cf9c9953a6a22342e1ce31a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:37:18 2022 +0300
dnsforward: add defer
commit a15072f1ea3845ba135ddd61aa8d67d9c0dcd7ea
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:30:16 2022 +0300
dnsforward: imp tests
commit e74219f594094f1e3d0001664ed3f79050747a4d
Author: Eugene Burkov <[email protected]>
Date: Sat Dec 3 16:29:31 2022 +0300
dnsforward: get rid of wg
commit 165da7dc186285d6ff8b949e12d95e0da5e828eb
Author: Eugene Burkov <[email protected]>
Date: Fri Dec 2 15:42:55 2022 +0300
dnsforward: add ups check test
commit 3045273997e45e952ba58e9c7fa5bba2d21ad286
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 1 20:28:56 2022 +0300
dnsforward: imp ups check perf </s> add "time" </s> add "github.com/miekg/dns" </s> add close(resCh) </s> remove result[host] = "OK"
</s> add for i := 0; i < upsNum; i++ {
pair := <-resCh
// TODO(e.burkov): The upstreams used for both common and private
// resolving should be reported separately.
result[pair.host] = pair.res </s> add }
for _, ups := range req.Upstreams {
go checkUps(ups, checkDNSUpstreamExc)
}
for _, ups := range req.PrivateUpstreams {
go checkUps(ups, checkPrivateUpstreamExc)
} </s> remove continue
</s> add checkUps := func(ups string, healthCheck healthCheckFunc) {
res := upsCheckResult{
host: ups,
}
defer func() { resCh <- res }()
checkErr := checkDNS(ups, bootstraps, timeout, healthCheck)
if checkErr != nil {
res.res = checkErr.Error()
} else {
res.res = "OK"
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d1adf74b1fbb5f0a941d0b7b68c4469d189adf6
|
internal/dnsforward/http_test.go
|
keep keep keep add keep keep keep keep
|
<mask> "os"
<mask> "path/filepath"
<mask> "strings"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering"
</s> Pull request: 5193-long-ups-check
Merge in DNS/adguard-home from 5193-long-ups-check to master
Closes #5193.
Squashed commit of the following:
commit 787e6b9950e85b79fe50e16cda5110fe53ec3e80
Merge: f62330bd 01652e6a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 17:07:40 2022 +0300
Merge branch 'master' into 5193-long-ups-check
commit f62330bd17ec260bc8c7475c8f5ae236059cde35
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 16:28:47 2022 +0300
dnsforward: try to fix linux
commit 64bfacc58d2a4c2929d9c3cf80bc31bfca404d54
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:55:48 2022 +0300
all: log changes finally
commit 4331d1c2497a94a95e4eba0ebcb5a813260c188a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:26:45 2022 +0300
all: imp log of chagnes
commit 62ed3c123eda100813a2de2ed95c1446c7a100f0
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:23:17 2022 +0300
all: log changes
commit 73f4d59796dc5de51cf9c9953a6a22342e1ce31a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:37:18 2022 +0300
dnsforward: add defer
commit a15072f1ea3845ba135ddd61aa8d67d9c0dcd7ea
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:30:16 2022 +0300
dnsforward: imp tests
commit e74219f594094f1e3d0001664ed3f79050747a4d
Author: Eugene Burkov <[email protected]>
Date: Sat Dec 3 16:29:31 2022 +0300
dnsforward: get rid of wg
commit 165da7dc186285d6ff8b949e12d95e0da5e828eb
Author: Eugene Burkov <[email protected]>
Date: Fri Dec 2 15:42:55 2022 +0300
dnsforward: add ups check test
commit 3045273997e45e952ba58e9c7fa5bba2d21ad286
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 1 20:28:56 2022 +0300
dnsforward: imp ups check perf </s> add "net/netip"
"net/url" </s> add "github.com/miekg/dns" </s> add close(resCh) </s> remove result[host] = "OK"
</s> add for i := 0; i < upsNum; i++ {
pair := <-resCh
// TODO(e.burkov): The upstreams used for both common and private
// resolving should be reported separately.
result[pair.host] = pair.res </s> add }
for _, ups := range req.Upstreams {
go checkUps(ups, checkDNSUpstreamExc)
}
for _, ups := range req.PrivateUpstreams {
go checkUps(ups, checkPrivateUpstreamExc)
} </s> remove continue
</s> add checkUps := func(ups string, healthCheck healthCheckFunc) {
res := upsCheckResult{
host: ups,
}
defer func() { resCh <- res }()
checkErr := checkDNS(ups, bootstraps, timeout, healthCheck)
if checkErr != nil {
res.res = checkErr.Error()
} else {
res.res = "OK"
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d1adf74b1fbb5f0a941d0b7b68c4469d189adf6
|
internal/dnsforward/http_test.go
|
keep keep keep add keep keep keep keep keep keep
|
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> "github.com/AdguardTeam/golibs/testutil"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> // fakeSystemResolvers is a mock aghnet.SystemResolvers implementation for
<mask> // tests.
</s> Pull request: 5193-long-ups-check
Merge in DNS/adguard-home from 5193-long-ups-check to master
Closes #5193.
Squashed commit of the following:
commit 787e6b9950e85b79fe50e16cda5110fe53ec3e80
Merge: f62330bd 01652e6a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 17:07:40 2022 +0300
Merge branch 'master' into 5193-long-ups-check
commit f62330bd17ec260bc8c7475c8f5ae236059cde35
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 16:28:47 2022 +0300
dnsforward: try to fix linux
commit 64bfacc58d2a4c2929d9c3cf80bc31bfca404d54
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:55:48 2022 +0300
all: log changes finally
commit 4331d1c2497a94a95e4eba0ebcb5a813260c188a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:26:45 2022 +0300
all: imp log of chagnes
commit 62ed3c123eda100813a2de2ed95c1446c7a100f0
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 15:23:17 2022 +0300
all: log changes
commit 73f4d59796dc5de51cf9c9953a6a22342e1ce31a
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:37:18 2022 +0300
dnsforward: add defer
commit a15072f1ea3845ba135ddd61aa8d67d9c0dcd7ea
Author: Eugene Burkov <[email protected]>
Date: Mon Dec 5 14:30:16 2022 +0300
dnsforward: imp tests
commit e74219f594094f1e3d0001664ed3f79050747a4d
Author: Eugene Burkov <[email protected]>
Date: Sat Dec 3 16:29:31 2022 +0300
dnsforward: get rid of wg
commit 165da7dc186285d6ff8b949e12d95e0da5e828eb
Author: Eugene Burkov <[email protected]>
Date: Fri Dec 2 15:42:55 2022 +0300
dnsforward: add ups check test
commit 3045273997e45e952ba58e9c7fa5bba2d21ad286
Author: Eugene Burkov <[email protected]>
Date: Thu Dec 1 20:28:56 2022 +0300
dnsforward: imp ups check perf </s> add "time" </s> add close(resCh) </s> add // Error implements the [error] interface for domainSpecificTestError.
func (err domainSpecificTestError) Error() (msg string) {
return fmt.Sprintf("WARNING: %s", err.error)
}
</s> remove result[host] = "OK"
</s> add for i := 0; i < upsNum; i++ {
pair := <-resCh
// TODO(e.burkov): The upstreams used for both common and private
// resolving should be reported separately.
result[pair.host] = pair.res </s> add }
for _, ups := range req.Upstreams {
go checkUps(ups, checkDNSUpstreamExc)
}
for _, ups := range req.PrivateUpstreams {
go checkUps(ups, checkPrivateUpstreamExc)
} </s> remove for _, host := range req.PrivateUpstreams {
err = checkDNS(host, bootstraps, timeout, checkPrivateUpstreamExc)
if err != nil {
log.Info("%v", err)
// TODO(e.burkov): If passed upstream have already written an error
// above, we rewriting the error for it. These cases should be
// handled properly instead.
result[host] = err.Error()
if _, ok := err.(domainSpecificTestError); ok {
result[host] = fmt.Sprintf("WARNING: %s", result[host])
}
</s> add upsNum := len(req.Upstreams) + len(req.PrivateUpstreams)
resCh := make(chan upsCheckResult, upsNum)
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d1adf74b1fbb5f0a941d0b7b68c4469d189adf6
|
internal/dnsforward/http_test.go
|
keep keep add keep keep keep keep keep
|
<mask> github.com/mdlayher/ethernet v0.0.0-20220221185849-529eae5b6118
<mask> github.com/mdlayher/netlink v1.7.1
<mask> github.com/mdlayher/packet v1.1.1
<mask> github.com/miekg/dns v1.1.53
<mask> github.com/quic-go/quic-go v0.33.0
<mask> github.com/stretchr/testify v1.8.2
<mask> github.com/ti-mo/netfilter v0.5.0
<mask> go.etcd.io/bbolt v1.3.7
</s> Pull request 1830: 5712-rollback-dhcp
Merge in DNS/adguard-home from 5712-rollback-dhcp to master
Updates #5712.
Squashed commit of the following:
commit 3d53a6385ad08dfad0b7ac28bb057cf25608554d
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:30:18 2023 +0300
dhcpd: imp import
commit 86bd55b0225b5d9067bd0bf9e6def1e52dd27124
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:26:41 2023 +0300
all: return todo
commit 629c548989a464a9cf461fffc0815b99a00c4851
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:24:10 2023 +0300
all: log changes
commit e4c369e55cbcc7c73d73d8df333996862e1e146a
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:03:03 2023 +0300
dhcpd: revert raw for darwin </s> remove github.com/mdlayher/raw v0.1.0 // indirect
</s> add </s> remove func TestV4Server_Send(t *testing.T) {
s := &v4Server{}
var (
defaultIP = net.IP{99, 99, 99, 99}
knownIP = net.IP{4, 2, 4, 2}
knownMAC = net.HardwareAddr{6, 5, 4, 3, 2, 1}
)
defaultPeer := &net.UDPAddr{
IP: defaultIP,
// Use neither client nor server port to check it actually
// changed.
Port: dhcpv4.ClientPort + dhcpv4.ServerPort,
}
defaultResp := &dhcpv4.DHCPv4{}
testCases := []struct {
want net.Addr
req *dhcpv4.DHCPv4
resp *dhcpv4.DHCPv4
name string
}{{
name: "giaddr",
req: &dhcpv4.DHCPv4{GatewayIPAddr: knownIP},
resp: defaultResp,
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ServerPort,
},
}, {
name: "nak",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
},
want: defaultPeer,
}, {
name: "ciaddr",
req: &dhcpv4.DHCPv4{ClientIPAddr: knownIP},
resp: &dhcpv4.DHCPv4{},
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ClientPort,
},
}, {
name: "chaddr",
req: &dhcpv4.DHCPv4{ClientHWAddr: knownMAC},
resp: &dhcpv4.DHCPv4{YourIPAddr: knownIP},
want: &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: knownMAC},
yiaddr: knownIP,
},
}, {
name: "who_are_you",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{},
want: defaultPeer,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (_ int, _ error) {
assert.Equal(t, tc.want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, tc.req, tc.resp)
})
}
t.Run("giaddr_nak", func(t *testing.T) {
req := &dhcpv4.DHCPv4{
GatewayIPAddr: knownIP,
}
// Ensure the request is for unicast.
req.SetUnicast()
resp := &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
}
want := &net.UDPAddr{
IP: req.GatewayIPAddr,
Port: dhcpv4.ServerPort,
}
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (n int, err error) {
assert.Equal(t, want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, req, resp)
assert.True(t, resp.IsBroadcast())
})
}
</s> add </s> remove "github.com/mdlayher/packet"
</s> add </s> remove // send writes resp for peer to conn considering the req's parameters according
// to RFC-2131.
//
// See https://datatracker.ietf.org/doc/html/rfc2131#section-4.1.
func (s *v4Server) send(peer net.Addr, conn net.PacketConn, req, resp *dhcpv4.DHCPv4) {
switch giaddr, ciaddr, mtype := req.GatewayIPAddr, req.ClientIPAddr, resp.MessageType(); {
case giaddr != nil && !giaddr.IsUnspecified():
// Send any return messages to the server port on the BOOTP
// relay agent whose address appears in giaddr.
peer = &net.UDPAddr{
IP: giaddr,
Port: dhcpv4.ServerPort,
}
if mtype == dhcpv4.MessageTypeNak {
// Set the broadcast bit in the DHCPNAK, so that the relay agent
// broadcasts it to the client, because the client may not have
// a correct network address or subnet mask, and the client may not
// be answering ARP requests.
resp.SetBroadcast()
}
case mtype == dhcpv4.MessageTypeNak:
// Broadcast any DHCPNAK messages to 0xffffffff.
case ciaddr != nil && !ciaddr.IsUnspecified():
// Unicast DHCPOFFER and DHCPACK messages to the address in
// ciaddr.
peer = &net.UDPAddr{
IP: ciaddr,
Port: dhcpv4.ClientPort,
}
case !req.IsBroadcast() && req.ClientHWAddr != nil:
// Unicast DHCPOFFER and DHCPACK messages to the client's
// hardware address and yiaddr.
peer = &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: req.ClientHWAddr},
yiaddr: resp.YourIPAddr,
}
default:
// Go on since peer is already set to broadcast.
}
pktData := resp.ToBytes()
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil {
log.Error("dhcpv4: conn.Write to %s failed: %s", peer, err)
}
}
</s> add </s> remove "github.com/mdlayher/packet"
</s> add </s> add "github.com/AdguardTeam/golibs/log"
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d402dc86c9b77c106993206cdb91721a0177c7e
|
go.mod
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> github.com/davecgh/go-spew v1.1.1 // indirect
<mask> github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
<mask> github.com/golang/mock v1.6.0 // indirect
<mask> github.com/google/pprof v0.0.0-20230406165453-00490a63f317 // indirect
<mask> github.com/mdlayher/raw v0.1.0 // indirect
<mask> github.com/mdlayher/socket v0.4.0 // indirect
<mask> github.com/onsi/ginkgo/v2 v2.9.2 // indirect
<mask> github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
<mask> github.com/pierrec/lz4/v4 v4.1.17 // indirect
<mask> github.com/pkg/errors v0.9.1 // indirect
</s> Pull request 1830: 5712-rollback-dhcp
Merge in DNS/adguard-home from 5712-rollback-dhcp to master
Updates #5712.
Squashed commit of the following:
commit 3d53a6385ad08dfad0b7ac28bb057cf25608554d
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:30:18 2023 +0300
dhcpd: imp import
commit 86bd55b0225b5d9067bd0bf9e6def1e52dd27124
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:26:41 2023 +0300
all: return todo
commit 629c548989a464a9cf461fffc0815b99a00c4851
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:24:10 2023 +0300
all: log changes
commit e4c369e55cbcc7c73d73d8df333996862e1e146a
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:03:03 2023 +0300
dhcpd: revert raw for darwin </s> add // TODO(a.garipov): This package is deprecated; find a new one or use our
// own code for that. Perhaps, use gopacket.
github.com/mdlayher/raw v0.1.0 </s> remove // send writes resp for peer to conn considering the req's parameters according
// to RFC-2131.
//
// See https://datatracker.ietf.org/doc/html/rfc2131#section-4.1.
func (s *v4Server) send(peer net.Addr, conn net.PacketConn, req, resp *dhcpv4.DHCPv4) {
switch giaddr, ciaddr, mtype := req.GatewayIPAddr, req.ClientIPAddr, resp.MessageType(); {
case giaddr != nil && !giaddr.IsUnspecified():
// Send any return messages to the server port on the BOOTP
// relay agent whose address appears in giaddr.
peer = &net.UDPAddr{
IP: giaddr,
Port: dhcpv4.ServerPort,
}
if mtype == dhcpv4.MessageTypeNak {
// Set the broadcast bit in the DHCPNAK, so that the relay agent
// broadcasts it to the client, because the client may not have
// a correct network address or subnet mask, and the client may not
// be answering ARP requests.
resp.SetBroadcast()
}
case mtype == dhcpv4.MessageTypeNak:
// Broadcast any DHCPNAK messages to 0xffffffff.
case ciaddr != nil && !ciaddr.IsUnspecified():
// Unicast DHCPOFFER and DHCPACK messages to the address in
// ciaddr.
peer = &net.UDPAddr{
IP: ciaddr,
Port: dhcpv4.ClientPort,
}
case !req.IsBroadcast() && req.ClientHWAddr != nil:
// Unicast DHCPOFFER and DHCPACK messages to the client's
// hardware address and yiaddr.
peer = &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: req.ClientHWAddr},
yiaddr: resp.YourIPAddr,
}
default:
// Go on since peer is already set to broadcast.
}
pktData := resp.ToBytes()
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil {
log.Error("dhcpv4: conn.Write to %s failed: %s", peer, err)
}
}
</s> add </s> remove "github.com/mdlayher/packet"
</s> add </s> remove func TestV4Server_Send(t *testing.T) {
s := &v4Server{}
var (
defaultIP = net.IP{99, 99, 99, 99}
knownIP = net.IP{4, 2, 4, 2}
knownMAC = net.HardwareAddr{6, 5, 4, 3, 2, 1}
)
defaultPeer := &net.UDPAddr{
IP: defaultIP,
// Use neither client nor server port to check it actually
// changed.
Port: dhcpv4.ClientPort + dhcpv4.ServerPort,
}
defaultResp := &dhcpv4.DHCPv4{}
testCases := []struct {
want net.Addr
req *dhcpv4.DHCPv4
resp *dhcpv4.DHCPv4
name string
}{{
name: "giaddr",
req: &dhcpv4.DHCPv4{GatewayIPAddr: knownIP},
resp: defaultResp,
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ServerPort,
},
}, {
name: "nak",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
},
want: defaultPeer,
}, {
name: "ciaddr",
req: &dhcpv4.DHCPv4{ClientIPAddr: knownIP},
resp: &dhcpv4.DHCPv4{},
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ClientPort,
},
}, {
name: "chaddr",
req: &dhcpv4.DHCPv4{ClientHWAddr: knownMAC},
resp: &dhcpv4.DHCPv4{YourIPAddr: knownIP},
want: &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: knownMAC},
yiaddr: knownIP,
},
}, {
name: "who_are_you",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{},
want: defaultPeer,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (_ int, _ error) {
assert.Equal(t, tc.want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, tc.req, tc.resp)
})
}
t.Run("giaddr_nak", func(t *testing.T) {
req := &dhcpv4.DHCPv4{
GatewayIPAddr: knownIP,
}
// Ensure the request is for unicast.
req.SetUnicast()
resp := &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
}
want := &net.UDPAddr{
IP: req.GatewayIPAddr,
Port: dhcpv4.ServerPort,
}
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (n int, err error) {
assert.Equal(t, want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, req, resp)
assert.True(t, resp.IsBroadcast())
})
}
</s> add </s> remove "github.com/mdlayher/packet"
</s> add </s> add "github.com/AdguardTeam/golibs/log"
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d402dc86c9b77c106993206cdb91721a0177c7e
|
go.mod
|
replace keep keep keep keep keep
|
<mask> //go:build darwin || freebsd || linux || openbsd
<mask>
<mask> package dhcpd
<mask>
<mask> import (
<mask> "fmt"
</s> Pull request 1830: 5712-rollback-dhcp
Merge in DNS/adguard-home from 5712-rollback-dhcp to master
Updates #5712.
Squashed commit of the following:
commit 3d53a6385ad08dfad0b7ac28bb057cf25608554d
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:30:18 2023 +0300
dhcpd: imp import
commit 86bd55b0225b5d9067bd0bf9e6def1e52dd27124
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:26:41 2023 +0300
all: return todo
commit 629c548989a464a9cf461fffc0815b99a00c4851
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:24:10 2023 +0300
all: log changes
commit e4c369e55cbcc7c73d73d8df333996862e1e146a
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:03:03 2023 +0300
dhcpd: revert raw for darwin </s> add // TODO(a.garipov): This package is deprecated; find a new one or use our
// own code for that. Perhaps, use gopacket.
github.com/mdlayher/raw v0.1.0 </s> remove "github.com/mdlayher/packet"
</s> add </s> remove func TestV4Server_Send(t *testing.T) {
s := &v4Server{}
var (
defaultIP = net.IP{99, 99, 99, 99}
knownIP = net.IP{4, 2, 4, 2}
knownMAC = net.HardwareAddr{6, 5, 4, 3, 2, 1}
)
defaultPeer := &net.UDPAddr{
IP: defaultIP,
// Use neither client nor server port to check it actually
// changed.
Port: dhcpv4.ClientPort + dhcpv4.ServerPort,
}
defaultResp := &dhcpv4.DHCPv4{}
testCases := []struct {
want net.Addr
req *dhcpv4.DHCPv4
resp *dhcpv4.DHCPv4
name string
}{{
name: "giaddr",
req: &dhcpv4.DHCPv4{GatewayIPAddr: knownIP},
resp: defaultResp,
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ServerPort,
},
}, {
name: "nak",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
},
want: defaultPeer,
}, {
name: "ciaddr",
req: &dhcpv4.DHCPv4{ClientIPAddr: knownIP},
resp: &dhcpv4.DHCPv4{},
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ClientPort,
},
}, {
name: "chaddr",
req: &dhcpv4.DHCPv4{ClientHWAddr: knownMAC},
resp: &dhcpv4.DHCPv4{YourIPAddr: knownIP},
want: &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: knownMAC},
yiaddr: knownIP,
},
}, {
name: "who_are_you",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{},
want: defaultPeer,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (_ int, _ error) {
assert.Equal(t, tc.want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, tc.req, tc.resp)
})
}
t.Run("giaddr_nak", func(t *testing.T) {
req := &dhcpv4.DHCPv4{
GatewayIPAddr: knownIP,
}
// Ensure the request is for unicast.
req.SetUnicast()
resp := &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
}
want := &net.UDPAddr{
IP: req.GatewayIPAddr,
Port: dhcpv4.ServerPort,
}
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (n int, err error) {
assert.Equal(t, want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, req, resp)
assert.True(t, resp.IsBroadcast())
})
}
</s> add </s> remove // send writes resp for peer to conn considering the req's parameters according
// to RFC-2131.
//
// See https://datatracker.ietf.org/doc/html/rfc2131#section-4.1.
func (s *v4Server) send(peer net.Addr, conn net.PacketConn, req, resp *dhcpv4.DHCPv4) {
switch giaddr, ciaddr, mtype := req.GatewayIPAddr, req.ClientIPAddr, resp.MessageType(); {
case giaddr != nil && !giaddr.IsUnspecified():
// Send any return messages to the server port on the BOOTP
// relay agent whose address appears in giaddr.
peer = &net.UDPAddr{
IP: giaddr,
Port: dhcpv4.ServerPort,
}
if mtype == dhcpv4.MessageTypeNak {
// Set the broadcast bit in the DHCPNAK, so that the relay agent
// broadcasts it to the client, because the client may not have
// a correct network address or subnet mask, and the client may not
// be answering ARP requests.
resp.SetBroadcast()
}
case mtype == dhcpv4.MessageTypeNak:
// Broadcast any DHCPNAK messages to 0xffffffff.
case ciaddr != nil && !ciaddr.IsUnspecified():
// Unicast DHCPOFFER and DHCPACK messages to the address in
// ciaddr.
peer = &net.UDPAddr{
IP: ciaddr,
Port: dhcpv4.ClientPort,
}
case !req.IsBroadcast() && req.ClientHWAddr != nil:
// Unicast DHCPOFFER and DHCPACK messages to the client's
// hardware address and yiaddr.
peer = &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: req.ClientHWAddr},
yiaddr: resp.YourIPAddr,
}
default:
// Go on since peer is already set to broadcast.
}
pktData := resp.ToBytes()
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil {
log.Error("dhcpv4: conn.Write to %s failed: %s", peer, err)
}
}
</s> add </s> remove "github.com/mdlayher/packet"
</s> add </s> add "github.com/AdguardTeam/golibs/log"
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d402dc86c9b77c106993206cdb91721a0177c7e
|
internal/dhcpd/conn_unix.go
|
keep keep add keep keep keep keep keep
|
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> "github.com/google/gopacket"
<mask> "github.com/google/gopacket/layers"
<mask> "github.com/insomniacslk/dhcp/dhcpv4"
<mask> "github.com/insomniacslk/dhcp/dhcpv4/server4"
</s> Pull request 1830: 5712-rollback-dhcp
Merge in DNS/adguard-home from 5712-rollback-dhcp to master
Updates #5712.
Squashed commit of the following:
commit 3d53a6385ad08dfad0b7ac28bb057cf25608554d
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:30:18 2023 +0300
dhcpd: imp import
commit 86bd55b0225b5d9067bd0bf9e6def1e52dd27124
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:26:41 2023 +0300
all: return todo
commit 629c548989a464a9cf461fffc0815b99a00c4851
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:24:10 2023 +0300
all: log changes
commit e4c369e55cbcc7c73d73d8df333996862e1e146a
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:03:03 2023 +0300
dhcpd: revert raw for darwin </s> remove "github.com/mdlayher/packet"
</s> add </s> remove "github.com/mdlayher/packet"
</s> add </s> remove func TestV4Server_Send(t *testing.T) {
s := &v4Server{}
var (
defaultIP = net.IP{99, 99, 99, 99}
knownIP = net.IP{4, 2, 4, 2}
knownMAC = net.HardwareAddr{6, 5, 4, 3, 2, 1}
)
defaultPeer := &net.UDPAddr{
IP: defaultIP,
// Use neither client nor server port to check it actually
// changed.
Port: dhcpv4.ClientPort + dhcpv4.ServerPort,
}
defaultResp := &dhcpv4.DHCPv4{}
testCases := []struct {
want net.Addr
req *dhcpv4.DHCPv4
resp *dhcpv4.DHCPv4
name string
}{{
name: "giaddr",
req: &dhcpv4.DHCPv4{GatewayIPAddr: knownIP},
resp: defaultResp,
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ServerPort,
},
}, {
name: "nak",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
},
want: defaultPeer,
}, {
name: "ciaddr",
req: &dhcpv4.DHCPv4{ClientIPAddr: knownIP},
resp: &dhcpv4.DHCPv4{},
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ClientPort,
},
}, {
name: "chaddr",
req: &dhcpv4.DHCPv4{ClientHWAddr: knownMAC},
resp: &dhcpv4.DHCPv4{YourIPAddr: knownIP},
want: &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: knownMAC},
yiaddr: knownIP,
},
}, {
name: "who_are_you",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{},
want: defaultPeer,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (_ int, _ error) {
assert.Equal(t, tc.want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, tc.req, tc.resp)
})
}
t.Run("giaddr_nak", func(t *testing.T) {
req := &dhcpv4.DHCPv4{
GatewayIPAddr: knownIP,
}
// Ensure the request is for unicast.
req.SetUnicast()
resp := &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
}
want := &net.UDPAddr{
IP: req.GatewayIPAddr,
Port: dhcpv4.ServerPort,
}
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (n int, err error) {
assert.Equal(t, want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, req, resp)
assert.True(t, resp.IsBroadcast())
})
}
</s> add </s> remove // send writes resp for peer to conn considering the req's parameters according
// to RFC-2131.
//
// See https://datatracker.ietf.org/doc/html/rfc2131#section-4.1.
func (s *v4Server) send(peer net.Addr, conn net.PacketConn, req, resp *dhcpv4.DHCPv4) {
switch giaddr, ciaddr, mtype := req.GatewayIPAddr, req.ClientIPAddr, resp.MessageType(); {
case giaddr != nil && !giaddr.IsUnspecified():
// Send any return messages to the server port on the BOOTP
// relay agent whose address appears in giaddr.
peer = &net.UDPAddr{
IP: giaddr,
Port: dhcpv4.ServerPort,
}
if mtype == dhcpv4.MessageTypeNak {
// Set the broadcast bit in the DHCPNAK, so that the relay agent
// broadcasts it to the client, because the client may not have
// a correct network address or subnet mask, and the client may not
// be answering ARP requests.
resp.SetBroadcast()
}
case mtype == dhcpv4.MessageTypeNak:
// Broadcast any DHCPNAK messages to 0xffffffff.
case ciaddr != nil && !ciaddr.IsUnspecified():
// Unicast DHCPOFFER and DHCPACK messages to the address in
// ciaddr.
peer = &net.UDPAddr{
IP: ciaddr,
Port: dhcpv4.ClientPort,
}
case !req.IsBroadcast() && req.ClientHWAddr != nil:
// Unicast DHCPOFFER and DHCPACK messages to the client's
// hardware address and yiaddr.
peer = &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: req.ClientHWAddr},
yiaddr: resp.YourIPAddr,
}
default:
// Go on since peer is already set to broadcast.
}
pktData := resp.ToBytes()
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil {
log.Error("dhcpv4: conn.Write to %s failed: %s", peer, err)
}
}
</s> add </s> remove //go:build darwin || freebsd || linux || openbsd
</s> add //go:build freebsd || linux || openbsd </s> remove github.com/mdlayher/raw v0.1.0 // indirect
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d402dc86c9b77c106993206cdb91721a0177c7e
|
internal/dhcpd/conn_unix.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "github.com/AdguardTeam/golibs/timeutil"
<mask> "github.com/go-ping/ping"
<mask> "github.com/insomniacslk/dhcp/dhcpv4"
<mask> "github.com/insomniacslk/dhcp/dhcpv4/server4"
<mask> "github.com/mdlayher/packet"
<mask> "golang.org/x/exp/slices"
<mask> )
<mask>
<mask> // v4Server is a DHCPv4 server.
<mask> //
</s> Pull request 1830: 5712-rollback-dhcp
Merge in DNS/adguard-home from 5712-rollback-dhcp to master
Updates #5712.
Squashed commit of the following:
commit 3d53a6385ad08dfad0b7ac28bb057cf25608554d
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:30:18 2023 +0300
dhcpd: imp import
commit 86bd55b0225b5d9067bd0bf9e6def1e52dd27124
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:26:41 2023 +0300
all: return todo
commit 629c548989a464a9cf461fffc0815b99a00c4851
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:24:10 2023 +0300
all: log changes
commit e4c369e55cbcc7c73d73d8df333996862e1e146a
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:03:03 2023 +0300
dhcpd: revert raw for darwin </s> remove "github.com/mdlayher/packet"
</s> add </s> add "github.com/AdguardTeam/golibs/log" </s> remove // send writes resp for peer to conn considering the req's parameters according
// to RFC-2131.
//
// See https://datatracker.ietf.org/doc/html/rfc2131#section-4.1.
func (s *v4Server) send(peer net.Addr, conn net.PacketConn, req, resp *dhcpv4.DHCPv4) {
switch giaddr, ciaddr, mtype := req.GatewayIPAddr, req.ClientIPAddr, resp.MessageType(); {
case giaddr != nil && !giaddr.IsUnspecified():
// Send any return messages to the server port on the BOOTP
// relay agent whose address appears in giaddr.
peer = &net.UDPAddr{
IP: giaddr,
Port: dhcpv4.ServerPort,
}
if mtype == dhcpv4.MessageTypeNak {
// Set the broadcast bit in the DHCPNAK, so that the relay agent
// broadcasts it to the client, because the client may not have
// a correct network address or subnet mask, and the client may not
// be answering ARP requests.
resp.SetBroadcast()
}
case mtype == dhcpv4.MessageTypeNak:
// Broadcast any DHCPNAK messages to 0xffffffff.
case ciaddr != nil && !ciaddr.IsUnspecified():
// Unicast DHCPOFFER and DHCPACK messages to the address in
// ciaddr.
peer = &net.UDPAddr{
IP: ciaddr,
Port: dhcpv4.ClientPort,
}
case !req.IsBroadcast() && req.ClientHWAddr != nil:
// Unicast DHCPOFFER and DHCPACK messages to the client's
// hardware address and yiaddr.
peer = &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: req.ClientHWAddr},
yiaddr: resp.YourIPAddr,
}
default:
// Go on since peer is already set to broadcast.
}
pktData := resp.ToBytes()
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil {
log.Error("dhcpv4: conn.Write to %s failed: %s", peer, err)
}
}
</s> add </s> add // TODO(a.garipov): This package is deprecated; find a new one or use our
// own code for that. Perhaps, use gopacket.
github.com/mdlayher/raw v0.1.0 </s> remove github.com/mdlayher/raw v0.1.0 // indirect
</s> add </s> remove func TestV4Server_Send(t *testing.T) {
s := &v4Server{}
var (
defaultIP = net.IP{99, 99, 99, 99}
knownIP = net.IP{4, 2, 4, 2}
knownMAC = net.HardwareAddr{6, 5, 4, 3, 2, 1}
)
defaultPeer := &net.UDPAddr{
IP: defaultIP,
// Use neither client nor server port to check it actually
// changed.
Port: dhcpv4.ClientPort + dhcpv4.ServerPort,
}
defaultResp := &dhcpv4.DHCPv4{}
testCases := []struct {
want net.Addr
req *dhcpv4.DHCPv4
resp *dhcpv4.DHCPv4
name string
}{{
name: "giaddr",
req: &dhcpv4.DHCPv4{GatewayIPAddr: knownIP},
resp: defaultResp,
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ServerPort,
},
}, {
name: "nak",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
},
want: defaultPeer,
}, {
name: "ciaddr",
req: &dhcpv4.DHCPv4{ClientIPAddr: knownIP},
resp: &dhcpv4.DHCPv4{},
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ClientPort,
},
}, {
name: "chaddr",
req: &dhcpv4.DHCPv4{ClientHWAddr: knownMAC},
resp: &dhcpv4.DHCPv4{YourIPAddr: knownIP},
want: &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: knownMAC},
yiaddr: knownIP,
},
}, {
name: "who_are_you",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{},
want: defaultPeer,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (_ int, _ error) {
assert.Equal(t, tc.want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, tc.req, tc.resp)
})
}
t.Run("giaddr_nak", func(t *testing.T) {
req := &dhcpv4.DHCPv4{
GatewayIPAddr: knownIP,
}
// Ensure the request is for unicast.
req.SetUnicast()
resp := &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
}
want := &net.UDPAddr{
IP: req.GatewayIPAddr,
Port: dhcpv4.ServerPort,
}
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (n int, err error) {
assert.Equal(t, want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, req, resp)
assert.True(t, resp.IsBroadcast())
})
}
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d402dc86c9b77c106993206cdb91721a0177c7e
|
internal/dhcpd/v4_unix.go
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask>
<mask> s.send(peer, conn, req, resp)
<mask> }
<mask>
<mask> // send writes resp for peer to conn considering the req's parameters according
<mask> // to RFC-2131.
<mask> //
<mask> // See https://datatracker.ietf.org/doc/html/rfc2131#section-4.1.
<mask> func (s *v4Server) send(peer net.Addr, conn net.PacketConn, req, resp *dhcpv4.DHCPv4) {
<mask> switch giaddr, ciaddr, mtype := req.GatewayIPAddr, req.ClientIPAddr, resp.MessageType(); {
<mask> case giaddr != nil && !giaddr.IsUnspecified():
<mask> // Send any return messages to the server port on the BOOTP
<mask> // relay agent whose address appears in giaddr.
<mask> peer = &net.UDPAddr{
<mask> IP: giaddr,
<mask> Port: dhcpv4.ServerPort,
<mask> }
<mask> if mtype == dhcpv4.MessageTypeNak {
<mask> // Set the broadcast bit in the DHCPNAK, so that the relay agent
<mask> // broadcasts it to the client, because the client may not have
<mask> // a correct network address or subnet mask, and the client may not
<mask> // be answering ARP requests.
<mask> resp.SetBroadcast()
<mask> }
<mask> case mtype == dhcpv4.MessageTypeNak:
<mask> // Broadcast any DHCPNAK messages to 0xffffffff.
<mask> case ciaddr != nil && !ciaddr.IsUnspecified():
<mask> // Unicast DHCPOFFER and DHCPACK messages to the address in
<mask> // ciaddr.
<mask> peer = &net.UDPAddr{
<mask> IP: ciaddr,
<mask> Port: dhcpv4.ClientPort,
<mask> }
<mask> case !req.IsBroadcast() && req.ClientHWAddr != nil:
<mask> // Unicast DHCPOFFER and DHCPACK messages to the client's
<mask> // hardware address and yiaddr.
<mask> peer = &dhcpUnicastAddr{
<mask> Addr: packet.Addr{HardwareAddr: req.ClientHWAddr},
<mask> yiaddr: resp.YourIPAddr,
<mask> }
<mask> default:
<mask> // Go on since peer is already set to broadcast.
<mask> }
<mask>
<mask> pktData := resp.ToBytes()
<mask>
<mask> log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
<mask>
<mask> _, err := conn.WriteTo(pktData, peer)
<mask> if err != nil {
<mask> log.Error("dhcpv4: conn.Write to %s failed: %s", peer, err)
<mask> }
<mask> }
<mask>
<mask> // Start starts the IPv4 DHCP server.
<mask> func (s *v4Server) Start() (err error) {
<mask> defer func() { err = errors.Annotate(err, "dhcpv4: %w") }()
<mask>
<mask> if !s.enabled() {
</s> Pull request 1830: 5712-rollback-dhcp
Merge in DNS/adguard-home from 5712-rollback-dhcp to master
Updates #5712.
Squashed commit of the following:
commit 3d53a6385ad08dfad0b7ac28bb057cf25608554d
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:30:18 2023 +0300
dhcpd: imp import
commit 86bd55b0225b5d9067bd0bf9e6def1e52dd27124
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:26:41 2023 +0300
all: return todo
commit 629c548989a464a9cf461fffc0815b99a00c4851
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:24:10 2023 +0300
all: log changes
commit e4c369e55cbcc7c73d73d8df333996862e1e146a
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:03:03 2023 +0300
dhcpd: revert raw for darwin </s> remove func TestV4Server_Send(t *testing.T) {
s := &v4Server{}
var (
defaultIP = net.IP{99, 99, 99, 99}
knownIP = net.IP{4, 2, 4, 2}
knownMAC = net.HardwareAddr{6, 5, 4, 3, 2, 1}
)
defaultPeer := &net.UDPAddr{
IP: defaultIP,
// Use neither client nor server port to check it actually
// changed.
Port: dhcpv4.ClientPort + dhcpv4.ServerPort,
}
defaultResp := &dhcpv4.DHCPv4{}
testCases := []struct {
want net.Addr
req *dhcpv4.DHCPv4
resp *dhcpv4.DHCPv4
name string
}{{
name: "giaddr",
req: &dhcpv4.DHCPv4{GatewayIPAddr: knownIP},
resp: defaultResp,
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ServerPort,
},
}, {
name: "nak",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
},
want: defaultPeer,
}, {
name: "ciaddr",
req: &dhcpv4.DHCPv4{ClientIPAddr: knownIP},
resp: &dhcpv4.DHCPv4{},
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ClientPort,
},
}, {
name: "chaddr",
req: &dhcpv4.DHCPv4{ClientHWAddr: knownMAC},
resp: &dhcpv4.DHCPv4{YourIPAddr: knownIP},
want: &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: knownMAC},
yiaddr: knownIP,
},
}, {
name: "who_are_you",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{},
want: defaultPeer,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (_ int, _ error) {
assert.Equal(t, tc.want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, tc.req, tc.resp)
})
}
t.Run("giaddr_nak", func(t *testing.T) {
req := &dhcpv4.DHCPv4{
GatewayIPAddr: knownIP,
}
// Ensure the request is for unicast.
req.SetUnicast()
resp := &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
}
want := &net.UDPAddr{
IP: req.GatewayIPAddr,
Port: dhcpv4.ServerPort,
}
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (n int, err error) {
assert.Equal(t, want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, req, resp)
assert.True(t, resp.IsBroadcast())
})
}
</s> add </s> remove "github.com/mdlayher/packet"
</s> add </s> remove github.com/mdlayher/raw v0.1.0 // indirect
</s> add </s> add // TODO(a.garipov): This package is deprecated; find a new one or use our
// own code for that. Perhaps, use gopacket.
github.com/mdlayher/raw v0.1.0 </s> remove "github.com/mdlayher/packet"
</s> add </s> add "github.com/AdguardTeam/golibs/log"
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d402dc86c9b77c106993206cdb91721a0177c7e
|
internal/dhcpd/v4_unix.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> "github.com/AdguardTeam/golibs/stringutil"
<mask> "github.com/AdguardTeam/golibs/testutil"
<mask> "github.com/insomniacslk/dhcp/dhcpv4"
<mask> "github.com/mdlayher/packet"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> var (
</s> Pull request 1830: 5712-rollback-dhcp
Merge in DNS/adguard-home from 5712-rollback-dhcp to master
Updates #5712.
Squashed commit of the following:
commit 3d53a6385ad08dfad0b7ac28bb057cf25608554d
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:30:18 2023 +0300
dhcpd: imp import
commit 86bd55b0225b5d9067bd0bf9e6def1e52dd27124
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:26:41 2023 +0300
all: return todo
commit 629c548989a464a9cf461fffc0815b99a00c4851
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:24:10 2023 +0300
all: log changes
commit e4c369e55cbcc7c73d73d8df333996862e1e146a
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:03:03 2023 +0300
dhcpd: revert raw for darwin </s> remove "github.com/mdlayher/packet"
</s> add </s> add "github.com/AdguardTeam/golibs/log" </s> remove func TestV4Server_Send(t *testing.T) {
s := &v4Server{}
var (
defaultIP = net.IP{99, 99, 99, 99}
knownIP = net.IP{4, 2, 4, 2}
knownMAC = net.HardwareAddr{6, 5, 4, 3, 2, 1}
)
defaultPeer := &net.UDPAddr{
IP: defaultIP,
// Use neither client nor server port to check it actually
// changed.
Port: dhcpv4.ClientPort + dhcpv4.ServerPort,
}
defaultResp := &dhcpv4.DHCPv4{}
testCases := []struct {
want net.Addr
req *dhcpv4.DHCPv4
resp *dhcpv4.DHCPv4
name string
}{{
name: "giaddr",
req: &dhcpv4.DHCPv4{GatewayIPAddr: knownIP},
resp: defaultResp,
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ServerPort,
},
}, {
name: "nak",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
},
want: defaultPeer,
}, {
name: "ciaddr",
req: &dhcpv4.DHCPv4{ClientIPAddr: knownIP},
resp: &dhcpv4.DHCPv4{},
want: &net.UDPAddr{
IP: knownIP,
Port: dhcpv4.ClientPort,
},
}, {
name: "chaddr",
req: &dhcpv4.DHCPv4{ClientHWAddr: knownMAC},
resp: &dhcpv4.DHCPv4{YourIPAddr: knownIP},
want: &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: knownMAC},
yiaddr: knownIP,
},
}, {
name: "who_are_you",
req: &dhcpv4.DHCPv4{},
resp: &dhcpv4.DHCPv4{},
want: defaultPeer,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (_ int, _ error) {
assert.Equal(t, tc.want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, tc.req, tc.resp)
})
}
t.Run("giaddr_nak", func(t *testing.T) {
req := &dhcpv4.DHCPv4{
GatewayIPAddr: knownIP,
}
// Ensure the request is for unicast.
req.SetUnicast()
resp := &dhcpv4.DHCPv4{
Options: dhcpv4.OptionsFromList(
dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
),
}
want := &net.UDPAddr{
IP: req.GatewayIPAddr,
Port: dhcpv4.ServerPort,
}
conn := &fakePacketConn{
writeTo: func(_ []byte, addr net.Addr) (n int, err error) {
assert.Equal(t, want, addr)
return 0, nil
},
}
s.send(cloneUDPAddr(defaultPeer), conn, req, resp)
assert.True(t, resp.IsBroadcast())
})
}
</s> add </s> remove //go:build darwin || freebsd || linux || openbsd
</s> add //go:build freebsd || linux || openbsd </s> remove // send writes resp for peer to conn considering the req's parameters according
// to RFC-2131.
//
// See https://datatracker.ietf.org/doc/html/rfc2131#section-4.1.
func (s *v4Server) send(peer net.Addr, conn net.PacketConn, req, resp *dhcpv4.DHCPv4) {
switch giaddr, ciaddr, mtype := req.GatewayIPAddr, req.ClientIPAddr, resp.MessageType(); {
case giaddr != nil && !giaddr.IsUnspecified():
// Send any return messages to the server port on the BOOTP
// relay agent whose address appears in giaddr.
peer = &net.UDPAddr{
IP: giaddr,
Port: dhcpv4.ServerPort,
}
if mtype == dhcpv4.MessageTypeNak {
// Set the broadcast bit in the DHCPNAK, so that the relay agent
// broadcasts it to the client, because the client may not have
// a correct network address or subnet mask, and the client may not
// be answering ARP requests.
resp.SetBroadcast()
}
case mtype == dhcpv4.MessageTypeNak:
// Broadcast any DHCPNAK messages to 0xffffffff.
case ciaddr != nil && !ciaddr.IsUnspecified():
// Unicast DHCPOFFER and DHCPACK messages to the address in
// ciaddr.
peer = &net.UDPAddr{
IP: ciaddr,
Port: dhcpv4.ClientPort,
}
case !req.IsBroadcast() && req.ClientHWAddr != nil:
// Unicast DHCPOFFER and DHCPACK messages to the client's
// hardware address and yiaddr.
peer = &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: req.ClientHWAddr},
yiaddr: resp.YourIPAddr,
}
default:
// Go on since peer is already set to broadcast.
}
pktData := resp.ToBytes()
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil {
log.Error("dhcpv4: conn.Write to %s failed: %s", peer, err)
}
}
</s> add </s> remove github.com/mdlayher/raw v0.1.0 // indirect
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d402dc86c9b77c106993206cdb91721a0177c7e
|
internal/dhcpd/v4_unix_test.go
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask> func (fc *fakePacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
<mask> return fc.writeTo(p, addr)
<mask> }
<mask>
<mask> func TestV4Server_Send(t *testing.T) {
<mask> s := &v4Server{}
<mask>
<mask> var (
<mask> defaultIP = net.IP{99, 99, 99, 99}
<mask> knownIP = net.IP{4, 2, 4, 2}
<mask> knownMAC = net.HardwareAddr{6, 5, 4, 3, 2, 1}
<mask> )
<mask>
<mask> defaultPeer := &net.UDPAddr{
<mask> IP: defaultIP,
<mask> // Use neither client nor server port to check it actually
<mask> // changed.
<mask> Port: dhcpv4.ClientPort + dhcpv4.ServerPort,
<mask> }
<mask> defaultResp := &dhcpv4.DHCPv4{}
<mask>
<mask> testCases := []struct {
<mask> want net.Addr
<mask> req *dhcpv4.DHCPv4
<mask> resp *dhcpv4.DHCPv4
<mask> name string
<mask> }{{
<mask> name: "giaddr",
<mask> req: &dhcpv4.DHCPv4{GatewayIPAddr: knownIP},
<mask> resp: defaultResp,
<mask> want: &net.UDPAddr{
<mask> IP: knownIP,
<mask> Port: dhcpv4.ServerPort,
<mask> },
<mask> }, {
<mask> name: "nak",
<mask> req: &dhcpv4.DHCPv4{},
<mask> resp: &dhcpv4.DHCPv4{
<mask> Options: dhcpv4.OptionsFromList(
<mask> dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
<mask> ),
<mask> },
<mask> want: defaultPeer,
<mask> }, {
<mask> name: "ciaddr",
<mask> req: &dhcpv4.DHCPv4{ClientIPAddr: knownIP},
<mask> resp: &dhcpv4.DHCPv4{},
<mask> want: &net.UDPAddr{
<mask> IP: knownIP,
<mask> Port: dhcpv4.ClientPort,
<mask> },
<mask> }, {
<mask> name: "chaddr",
<mask> req: &dhcpv4.DHCPv4{ClientHWAddr: knownMAC},
<mask> resp: &dhcpv4.DHCPv4{YourIPAddr: knownIP},
<mask> want: &dhcpUnicastAddr{
<mask> Addr: packet.Addr{HardwareAddr: knownMAC},
<mask> yiaddr: knownIP,
<mask> },
<mask> }, {
<mask> name: "who_are_you",
<mask> req: &dhcpv4.DHCPv4{},
<mask> resp: &dhcpv4.DHCPv4{},
<mask> want: defaultPeer,
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> conn := &fakePacketConn{
<mask> writeTo: func(_ []byte, addr net.Addr) (_ int, _ error) {
<mask> assert.Equal(t, tc.want, addr)
<mask>
<mask> return 0, nil
<mask> },
<mask> }
<mask>
<mask> s.send(cloneUDPAddr(defaultPeer), conn, tc.req, tc.resp)
<mask> })
<mask> }
<mask>
<mask> t.Run("giaddr_nak", func(t *testing.T) {
<mask> req := &dhcpv4.DHCPv4{
<mask> GatewayIPAddr: knownIP,
<mask> }
<mask> // Ensure the request is for unicast.
<mask> req.SetUnicast()
<mask> resp := &dhcpv4.DHCPv4{
<mask> Options: dhcpv4.OptionsFromList(
<mask> dhcpv4.OptMessageType(dhcpv4.MessageTypeNak),
<mask> ),
<mask> }
<mask> want := &net.UDPAddr{
<mask> IP: req.GatewayIPAddr,
<mask> Port: dhcpv4.ServerPort,
<mask> }
<mask>
<mask> conn := &fakePacketConn{
<mask> writeTo: func(_ []byte, addr net.Addr) (n int, err error) {
<mask> assert.Equal(t, want, addr)
<mask>
<mask> return 0, nil
<mask> },
<mask> }
<mask>
<mask> s.send(cloneUDPAddr(defaultPeer), conn, req, resp)
<mask> assert.True(t, resp.IsBroadcast())
<mask> })
<mask> }
<mask>
<mask> func TestV4Server_FindMACbyIP(t *testing.T) {
<mask> const (
<mask> staticName = "static-client"
<mask> anotherName = "another-client"
<mask> )
</s> Pull request 1830: 5712-rollback-dhcp
Merge in DNS/adguard-home from 5712-rollback-dhcp to master
Updates #5712.
Squashed commit of the following:
commit 3d53a6385ad08dfad0b7ac28bb057cf25608554d
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:30:18 2023 +0300
dhcpd: imp import
commit 86bd55b0225b5d9067bd0bf9e6def1e52dd27124
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:26:41 2023 +0300
all: return todo
commit 629c548989a464a9cf461fffc0815b99a00c4851
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:24:10 2023 +0300
all: log changes
commit e4c369e55cbcc7c73d73d8df333996862e1e146a
Author: Eugene Burkov <[email protected]>
Date: Fri Apr 14 16:03:03 2023 +0300
dhcpd: revert raw for darwin </s> remove // send writes resp for peer to conn considering the req's parameters according
// to RFC-2131.
//
// See https://datatracker.ietf.org/doc/html/rfc2131#section-4.1.
func (s *v4Server) send(peer net.Addr, conn net.PacketConn, req, resp *dhcpv4.DHCPv4) {
switch giaddr, ciaddr, mtype := req.GatewayIPAddr, req.ClientIPAddr, resp.MessageType(); {
case giaddr != nil && !giaddr.IsUnspecified():
// Send any return messages to the server port on the BOOTP
// relay agent whose address appears in giaddr.
peer = &net.UDPAddr{
IP: giaddr,
Port: dhcpv4.ServerPort,
}
if mtype == dhcpv4.MessageTypeNak {
// Set the broadcast bit in the DHCPNAK, so that the relay agent
// broadcasts it to the client, because the client may not have
// a correct network address or subnet mask, and the client may not
// be answering ARP requests.
resp.SetBroadcast()
}
case mtype == dhcpv4.MessageTypeNak:
// Broadcast any DHCPNAK messages to 0xffffffff.
case ciaddr != nil && !ciaddr.IsUnspecified():
// Unicast DHCPOFFER and DHCPACK messages to the address in
// ciaddr.
peer = &net.UDPAddr{
IP: ciaddr,
Port: dhcpv4.ClientPort,
}
case !req.IsBroadcast() && req.ClientHWAddr != nil:
// Unicast DHCPOFFER and DHCPACK messages to the client's
// hardware address and yiaddr.
peer = &dhcpUnicastAddr{
Addr: packet.Addr{HardwareAddr: req.ClientHWAddr},
yiaddr: resp.YourIPAddr,
}
default:
// Go on since peer is already set to broadcast.
}
pktData := resp.ToBytes()
log.Debug("dhcpv4: sending %d bytes to %s: %s", len(pktData), peer, resp.Summary())
_, err := conn.WriteTo(pktData, peer)
if err != nil {
log.Error("dhcpv4: conn.Write to %s failed: %s", peer, err)
}
}
</s> add </s> remove "github.com/mdlayher/packet"
</s> add </s> remove "github.com/mdlayher/packet"
</s> add </s> add // TODO(a.garipov): This package is deprecated; find a new one or use our
// own code for that. Perhaps, use gopacket.
github.com/mdlayher/raw v0.1.0 </s> remove github.com/mdlayher/raw v0.1.0 // indirect
</s> add </s> remove //go:build darwin || freebsd || linux || openbsd
</s> add //go:build freebsd || linux || openbsd
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d402dc86c9b77c106993206cdb91721a0177c7e
|
internal/dhcpd/v4_unix_test.go
|
keep keep keep keep replace keep replace keep keep keep keep
|
<mask> LABEL maintainer="AdGuard Team <[email protected]>"
<mask>
<mask> # Update CA certs
<mask> RUN apk --no-cache --update add ca-certificates && \
<mask> rm -rf /var/cache/apk/*
<mask>
<mask> COPY --from=build /src/AdGuardHome/AdGuardHome /AdGuardHome
<mask>
<mask> EXPOSE 53 3000
<mask>
<mask> VOLUME /data
</s> Fix to go along with new concept </s> remove ENTRYPOINT ["/AdGuardHome"]
CMD ["-h", "0.0.0.0"] </s> add </s> remove VOLUME /data
</s> add VOLUME ["/opt/adguardhome/conf", "/opt/adguardhome/work"]
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d7d10ec3870ea0d412f6b5e7c26cfdcce414dc7
|
Dockerfile
|
keep keep keep keep replace keep replace replace
|
<mask> COPY --from=build /src/AdGuardHome/AdGuardHome /AdGuardHome
<mask>
<mask> EXPOSE 53 3000
<mask>
<mask> VOLUME /data
<mask>
<mask> ENTRYPOINT ["/AdGuardHome"]
<mask> CMD ["-h", "0.0.0.0"] </s> Fix to go along with new concept </s> remove rm -rf /var/cache/apk/*
</s> add rm -rf /var/cache/apk/* && mkdir -p /opt/adguardhome </s> remove COPY --from=build /src/AdGuardHome/AdGuardHome /AdGuardHome
</s> add COPY --from=build /src/AdGuardHome/AdGuardHome /opt/adguardhome/AdGuardHome
|
https://github.com/AdguardTeam/AdGuardHome/commit/6d7d10ec3870ea0d412f6b5e7c26cfdcce414dc7
|
Dockerfile
|
keep keep keep replace keep replace keep keep keep
|
<mask>
<mask> // How to test on a real Linux machine:
<mask> //
<mask> // 1. Run:
<mask> //
<mask> // sudo ipset create example_set hash:ip family ipv4
<mask> //
<mask> // 2. Run:
<mask> //
</s> Pull request: imp-scripts
Merge in DNS/adguard-home from imp-scripts to master
Squashed commit of the following:
commit ab63a8a2dd1b64287e00a2a6f747fd48b530709e
Author: Ainar Garipov <[email protected]>
Date: Wed Sep 21 19:15:06 2022 +0300
all: imp scripts; upd tools; doc </s> remove // 2. Run:
</s> add // 3. Add the line "example.com/example_set" to your AdGuardHome.yaml. </s> remove // sudo ipset list example_set
</s> add // 4. Start AdGuardHome. </s> remove // 3. Add the line "example.com/example_set" to your AdGuardHome.yaml.
//
// 4. Start AdGuardHome.
//
// 5. Make requests to example.com and its subdomains.
//
// 6. Run:
//
// sudo ipset list example_set
//
// The Members field should contain the resolved IP addresses.
</s> add // 6. Run "sudo ipset list example_set". The Members field should contain the
// resolved IP addresses. </s> remove // The Members field should be empty.
</s> add // 5. Make requests to example.com and its subdomains. </s> remove golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 // indirect
</s> add golang.org/x/exp v0.0.0-20220921023135-46d9e7742f1e // indirect
|
https://github.com/AdguardTeam/AdGuardHome/commit/6e7964c9e7e8e1d999a2b402c0f60496d0cf7801
|
internal/aghnet/ipset_linux.go
|
keep keep keep keep replace keep replace
|
<mask> // 1. Run:
<mask> //
<mask> // sudo ipset create example_set hash:ip family ipv4
<mask> //
<mask> // 2. Run:
<mask> //
<mask> // sudo ipset list example_set
</s> Pull request: imp-scripts
Merge in DNS/adguard-home from imp-scripts to master
Squashed commit of the following:
commit ab63a8a2dd1b64287e00a2a6f747fd48b530709e
Author: Ainar Garipov <[email protected]>
Date: Wed Sep 21 19:15:06 2022 +0300
all: imp scripts; upd tools; doc </s> remove // 1. Run:
</s> add // 1. Run "sudo ipset create example_set hash:ip family ipv4". </s> remove // sudo ipset create example_set hash:ip family ipv4
</s> add // 2. Run "sudo ipset list example_set". The Members field should be empty. </s> remove // The Members field should be empty.
</s> add // 5. Make requests to example.com and its subdomains. </s> remove // 3. Add the line "example.com/example_set" to your AdGuardHome.yaml.
//
// 4. Start AdGuardHome.
//
// 5. Make requests to example.com and its subdomains.
//
// 6. Run:
//
// sudo ipset list example_set
//
// The Members field should contain the resolved IP addresses.
</s> add // 6. Run "sudo ipset list example_set". The Members field should contain the
// resolved IP addresses. </s> remove golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 // indirect
</s> add golang.org/x/exp v0.0.0-20220921023135-46d9e7742f1e // indirect
|
https://github.com/AdguardTeam/AdGuardHome/commit/6e7964c9e7e8e1d999a2b402c0f60496d0cf7801
|
internal/aghnet/ipset_linux.go
|
keep replace keep replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep
|
<mask> //
<mask> // The Members field should be empty.
<mask> //
<mask> // 3. Add the line "example.com/example_set" to your AdGuardHome.yaml.
<mask> //
<mask> // 4. Start AdGuardHome.
<mask> //
<mask> // 5. Make requests to example.com and its subdomains.
<mask> //
<mask> // 6. Run:
<mask> //
<mask> // sudo ipset list example_set
<mask> //
<mask> // The Members field should contain the resolved IP addresses.
<mask>
<mask> // newIpsetMgr returns a new Linux ipset manager.
<mask> func newIpsetMgr(ipsetConf []string) (set IpsetManager, err error) {
<mask> return newIpsetMgrWithDialer(ipsetConf, defaultDial)
</s> Pull request: imp-scripts
Merge in DNS/adguard-home from imp-scripts to master
Squashed commit of the following:
commit ab63a8a2dd1b64287e00a2a6f747fd48b530709e
Author: Ainar Garipov <[email protected]>
Date: Wed Sep 21 19:15:06 2022 +0300
all: imp scripts; upd tools; doc </s> remove // sudo ipset list example_set
</s> add // 4. Start AdGuardHome. </s> remove // 2. Run:
</s> add // 3. Add the line "example.com/example_set" to your AdGuardHome.yaml. </s> remove // sudo ipset create example_set hash:ip family ipv4
</s> add // 2. Run "sudo ipset list example_set". The Members field should be empty. </s> remove // 1. Run:
</s> add // 1. Run "sudo ipset create example_set hash:ip family ipv4". </s> remove golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 // indirect
</s> add golang.org/x/exp v0.0.0-20220921023135-46d9e7742f1e // indirect
|
https://github.com/AdguardTeam/AdGuardHome/commit/6e7964c9e7e8e1d999a2b402c0f60496d0cf7801
|
internal/aghnet/ipset_linux.go
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.