docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
listlengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
CUSTOM_FILTERING_RULES_ID, FILTERED_STATUS,
<mask> LONG_TIME_FORMAT, <mask> FILTERED_STATUS_TO_META_MAP, <mask> TABLE_DEFAULT_PAGE_SIZE, <mask> SCHEME_TO_PROTOCOL_MAP, <mask> CUSTOM_FILTERING_RULES_ID, <mask> } from '../../helpers/constants'; <mask> import getDateCell from './Cells/getDateCell'; <mask> import getDomainCell from './Cells/getDomainCell'; <mask> import getClientCell from './Cells/getClientCell'; <mask> import getResponseCell from './Cells/getResponseCell'; </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove reason, filterId, rule, status, upstream, elapsedMs, domain, response, </s> add reason, filterId, rule, status, upstream, elapsedMs, domain, response, originalResponse, </s> remove <div className="logs__text" title={value}> </s> add <div className="logs__text mw-100" title={value}> </s> remove const response = answer ? answer.map((response) => { </s> add const processResponse = (data) => (data ? data.map((response) => {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/components/Logs/Table.js
rule, originalResponse,
<mask> upstream, <mask> type, <mask> client_proto, <mask> filterId, <mask> } = rowInfo.original; <mask> <mask> const hasTracker = !!tracker; <mask> </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove response, </s> add response: processResponse(answer), </s> remove reason, filterId, rule, status, upstream, elapsedMs, domain, response, </s> add reason, filterId, rule, status, upstream, elapsedMs, domain, response, originalResponse, </s> remove }) : []; const tracker = getTrackerData(domain); </s> add }) : []); </s> remove const response = answer ? answer.map((response) => { </s> add const processResponse = (data) => (data ? data.map((response) => { </s> remove if (responseArr.length === 0) { </s> add if (responseArr?.length === 0) {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/components/Logs/Table.js
const isBlocked = reason === FILTERED_STATUS.FILTERED_BLACK_LIST || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE;
<mask> const formattedElapsedMs = formatElapsedMs(elapsedMs, t); <mask> const isFiltered = checkFiltered(reason); <mask> <mask> const buttonType = isFiltered ? BLOCK_ACTIONS.UNBLOCK : BLOCK_ACTIONS.BLOCK; <mask> const onToggleBlock = () => { <mask> toggleBlocking(buttonType, domain); <mask> }; </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove const status = t(FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> add const isBlockedByResponse = originalResponse.length > 0 && isBlocked; const status = t(isBlockedByResponse ? 'blocked_by_cname_or_ip' : FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> remove const statusLabel = t(FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> add const isBlocked = reason === FILTERED_STATUS.FILTERED_BLACK_LIST || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE; const isBlockedByResponse = originalResponse.length > 0 && isBlocked; const statusLabel = t(isBlockedByResponse ? 'blocked_by_cname_or_ip' : FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> remove const detailedDataCurrent = isFiltered ? detailedDataBlocked : detailedData; </s> add const detailedDataCurrent = isBlocked ? detailedDataBlocked : detailedData; </s> remove reason, filterId, rule, status, upstream, elapsedMs, domain, response, </s> add reason, filterId, rule, status, upstream, elapsedMs, domain, response, originalResponse, </s> remove if (responseArr.length === 0) { </s> add if (responseArr?.length === 0) {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/components/Logs/Table.js
const isBlockedByResponse = originalResponse.length > 0 && isBlocked; const status = t(isBlockedByResponse ? 'blocked_by_cname_or_ip' : FILTERED_STATUS_TO_META_MAP[reason]?.label || reason);
<mask> const onToggleBlock = () => { <mask> toggleBlocking(buttonType, domain); <mask> }; <mask> <mask> const status = t(FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); <mask> const statusBlocked = <div className="bg--danger">{status}</div>; <mask> <mask> const protocol = t(SCHEME_TO_PROTOCOL_MAP[client_proto]) || ''; <mask> <mask> const sourceData = getSourceData(tracker); </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove const statusLabel = t(FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> add const isBlocked = reason === FILTERED_STATUS.FILTERED_BLACK_LIST || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE; const isBlockedByResponse = originalResponse.length > 0 && isBlocked; const statusLabel = t(isBlockedByResponse ? 'blocked_by_cname_or_ip' : FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> remove const dnssecHint = getHintElement({ className: lockIconClass, tooltipClass: 'py-4 px-5 pb-45', canShowTooltip: answer_dnssec, xlinkHref: 'lock', columnClass: 'w-100', content: 'validated_with_dnssec', placement: 'bottom', }); </s> add </s> remove if (responseArr.length === 0) { </s> add if (responseArr?.length === 0) { </s> remove const response = answer ? answer.map((response) => { </s> add const processResponse = (data) => (data ? data.map((response) => {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/components/Logs/Table.js
rule_label: rule,
<mask> elapsed: formattedElapsedMs, <mask> filter, <mask> response_table_header: response?.join('\n'), <mask> original_response: originalResponse?.join('\n'), <mask> [buttonType]: <div onClick={onToggleBlock} <mask> className="title--border text-center">{t(buttonType)}</div>, <mask> }; <mask> </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove const detailedDataCurrent = isFiltered ? detailedDataBlocked : detailedData; </s> add const detailedDataCurrent = isBlocked ? detailedDataBlocked : detailedData;
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/components/Logs/Table.js
original_response: originalResponse?.join('\n'),
<mask> rule_label: rule, <mask> response_table_header: response?.join('\n'), <mask> [buttonType]: <div onClick={onToggleBlock} <mask> className="title--border text-center">{t(buttonType)}</div>, <mask> }; <mask> <mask> const detailedDataCurrent = isBlocked ? detailedDataBlocked : detailedData; </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove const detailedDataCurrent = isFiltered ? detailedDataBlocked : detailedData; </s> add const detailedDataCurrent = isBlocked ? detailedDataBlocked : detailedData; </s> remove const detailedInfo = reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE || reason === FILTERED_STATUS.FILTERED_BLACK_LIST ? filter : formattedElapsedMs; </s> add const detailedInfo = isBlocked ? filter : formattedElapsedMs; </s> remove const status = t(FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> add const isBlockedByResponse = originalResponse.length > 0 && isBlocked; const status = t(isBlockedByResponse ? 'blocked_by_cname_or_ip' : FILTERED_STATUS_TO_META_MAP[reason]?.label || reason);
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/components/Logs/Table.js
const detailedDataCurrent = isBlocked ? detailedDataBlocked : detailedData;
<mask> [buttonType]: <div onClick={onToggleBlock} <mask> className="title--border text-center">{t(buttonType)}</div>, <mask> }; <mask> <mask> const detailedDataCurrent = isFiltered ? detailedDataBlocked : detailedData; <mask> <mask> setDetailedDataCurrent(detailedDataCurrent); <mask> setButtonType(buttonType); <mask> setModalOpened(true); <mask> } </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove const status = t(FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> add const isBlockedByResponse = originalResponse.length > 0 && isBlocked; const status = t(isBlockedByResponse ? 'blocked_by_cname_or_ip' : FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> remove const detailedInfo = reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE || reason === FILTERED_STATUS.FILTERED_BLACK_LIST ? filter : formattedElapsedMs; </s> add const detailedInfo = isBlocked ? filter : formattedElapsedMs;
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/components/Logs/Table.js
if (!value) { return null; }
<mask> <mask> export const processContent = (data, buttonType) => Object.entries(data) <mask> .map(([key, value]) => { <mask> const isTitle = value === 'title'; <mask> const isButton = key === buttonType; <mask> const isBoolean = typeof value === 'boolean'; <mask> const isHidden = isBoolean && value === false; </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove if (responseArr.length === 0) { </s> add if (responseArr?.length === 0) { </s> remove const statusLabel = t(FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> add const isBlocked = reason === FILTERED_STATUS.FILTERED_BLACK_LIST || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE; const isBlockedByResponse = originalResponse.length > 0 && isBlocked; const statusLabel = t(isBlockedByResponse ? 'blocked_by_cname_or_ip' : FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> remove const detailedInfo = reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE || reason === FILTERED_STATUS.FILTERED_BLACK_LIST ? filter : formattedElapsedMs; </s> add const detailedInfo = isBlocked ? filter : formattedElapsedMs; </s> remove const response = answer ? answer.map((response) => { </s> add const processResponse = (data) => (data ? data.map((response) => {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/components/Logs/index.js
<div className="logs__text mw-100" title={value}>
<mask> } <mask> } <mask> <mask> return ( <mask> <div className="logs__text" title={value}> <mask> <> <mask> {nameContainer} <mask> {whoisContainer} <mask> </> <mask> </div> </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove className="detailed-info d-none d-sm-block pt-1 text-truncate" title={detailedInfo}>{detailedInfo}</div>} </s> add className="detailed-info d-none d-sm-block pt-1 text-truncate" title={detailedInfo}>{detailedInfo}</div>} </s> remove {processedData && getHintElement({ </s> add {getHintElement({ </s> remove {dnssec_enabled && dnssecHint} </s> add {dnssec_enabled && getHintElement({ className: lockIconClass, tooltipClass: 'py-4 px-5 pb-45', canShowTooltip: answer_dnssec, xlinkHref: 'lock', columnClass: 'w-100', content: 'validated_with_dnssec', placement: 'bottom', })} </s> remove {fields && getHintElement({ </s> add {getHintElement({ </s> remove const detailedInfo = reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE || reason === FILTERED_STATUS.FILTERED_BLACK_LIST ? filter : formattedElapsedMs; </s> add const detailedInfo = isBlocked ? filter : formattedElapsedMs;
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/helpers/formatClientCell.js
const processResponse = (data) => (data ? data.map((response) => {
<mask> } = log; <mask> <mask> const { host: domain, type } = question; <mask> <mask> const response = answer ? answer.map((response) => { <mask> const { value, type, ttl } = response; <mask> return `${type}: ${value} (ttl=${ttl})`; <mask> }) : []; <mask> <mask> const tracker = getTrackerData(domain); </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove }) : []; const tracker = getTrackerData(domain); </s> add }) : []); </s> remove if (responseArr.length === 0) { </s> add if (responseArr?.length === 0) { </s> remove reason, filterId, rule, status, upstream, elapsedMs, domain, response, </s> add reason, filterId, rule, status, upstream, elapsedMs, domain, response, originalResponse, </s> remove const statusLabel = t(FILTERED_STATUS_TO_META_MAP[reason]?.label || reason); </s> add const isBlocked = reason === FILTERED_STATUS.FILTERED_BLACK_LIST || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE; const isBlockedByResponse = originalResponse.length > 0 && isBlocked; const statusLabel = t(isBlockedByResponse ? 'blocked_by_cname_or_ip' : FILTERED_STATUS_TO_META_MAP[reason]?.label || reason);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/helpers/helpers.js
}) : []);
<mask> <mask> const response = answer ? answer.map((response) => { <mask> const { value, type, ttl } = response; <mask> return `${type}: ${value} (ttl=${ttl})`; <mask> }) : []; <mask> <mask> const tracker = getTrackerData(domain); <mask> <mask> return { <mask> time, <mask> domain, <mask> type, </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove const response = answer ? answer.map((response) => { </s> add const processResponse = (data) => (data ? data.map((response) => { </s> remove response, </s> add response: processResponse(answer), </s> remove if (responseArr.length === 0) { </s> add if (responseArr?.length === 0) { </s> remove reason, filterId, rule, status, upstream, elapsedMs, domain, response, </s> add reason, filterId, rule, status, upstream, elapsedMs, domain, response, originalResponse,
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/helpers/helpers.js
response: processResponse(answer),
<mask> return { <mask> time, <mask> domain, <mask> type, <mask> response, <mask> reason, <mask> client, <mask> client_proto, <mask> filterId, <mask> rule, </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove reason, filterId, rule, status, upstream, elapsedMs, domain, response, </s> add reason, filterId, rule, status, upstream, elapsedMs, domain, response, originalResponse, </s> remove }) : []; const tracker = getTrackerData(domain); </s> add }) : []); </s> remove const response = answer ? answer.map((response) => { </s> add const processResponse = (data) => (data ? data.map((response) => {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/helpers/helpers.js
originalResponse: processResponse(original_answer), tracker: getTrackerData(domain),
<mask> rule, <mask> status, <mask> serviceName: service_name, <mask> originalAnswer: original_answer, <mask> tracker, <mask> answer_dnssec, <mask> elapsedMs, <mask> upstream, <mask> }; <mask> }); </s> - client: Fix query logs UI issues Close #1828 Squashed commit of the following: commit a3955c989a939866c6772b147547344b3f8769c4 Merge: c91c41cb 2759d81a Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 15:14:47 2020 +0300 Merge branch 'master' into fix/1828 commit c91c41cbc5f616e0af1092424e42b909d2f43f7c Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 13:48:54 2020 +0300 Fix cell overflow commit 19e1d31a40f2e1bb1189a85b72507bcc364d4e0c Merge: af31f48c a33164bf Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 12:36:44 2020 +0300 Merge branch 'master' into fix/1828 commit af31f48c4d2699ebfbd2034711c51499b42e40f5 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jul 13 10:45:57 2020 +0300 minor commit d9507c5f3f5758e587766ae0fa45f1b9ad703ccf Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 10 18:34:22 2020 +0300 - client: Fix query logs UI issues </s> remove reason, filterId, rule, status, upstream, elapsedMs, domain, response, </s> add reason, filterId, rule, status, upstream, elapsedMs, domain, response, originalResponse, </s> remove const dnssecHint = getHintElement({ className: lockIconClass, tooltipClass: 'py-4 px-5 pb-45', canShowTooltip: answer_dnssec, xlinkHref: 'lock', columnClass: 'w-100', content: 'validated_with_dnssec', placement: 'bottom', }); </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a417604a94d90ada57141d5601490531fc2e009
client/src/helpers/helpers.js
"table_statistics": "Requests count (last 24 hours)",
<mask> "client_global_settings": "Use global settings", <mask> "client_deleted": "Client \"{{key}}\" successfully deleted", <mask> "client_added": "Client \"{{key}}\" successfully added", <mask> "client_updated": "Client \"{{key}}\" successfully updated", <mask> "table_statistics": "Statistics (last 24 hours)", <mask> "clients_not_found": "No clients found", <mask> "client_confirm_delete": "Are you sure you want to delete client \"{{key}}\"?" <mask> } </s> + client: add runtime clients table </s> remove "client_confirm_delete": "Are you sure you want to delete client \"{{key}}\"?" </s> add "client_confirm_delete": "Are you sure you want to delete client \"{{key}}\"?", "auto_clients_title": "Clients (runtime)", "auto_clients_desc": "Data on the clients that use AdGuard Home, but not stored in the configuration" </s> remove const clients = await apiClient.getClients(); const sortedClients = sortClients(clients); dispatch(getClientsSuccess(sortedClients)); </s> add const data = await apiClient.getClients(); const sortedClients = data.clients && sortClients(data.clients); const sortedAutoClients = data.auto_clients && sortClients(data.auto_clients); dispatch(getClientsSuccess({ clients: sortedClients || [], autoClients: sortedAutoClients || [], })); </s> remove const clientName = getClientName(dashboard.clients, row.value); </s> add const clientName = getClientName(dashboard.clients, row.value) || getClientName(dashboard.autoClients, row.value); </s> remove const clientName = getClientName(this.props.clients, value); </s> add const clientName = getClientName(this.props.clients, value) || getClientName(this.props.autoClients, value);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/__locales/en.json
"client_confirm_delete": "Are you sure you want to delete client \"{{key}}\"?", "auto_clients_title": "Clients (runtime)", "auto_clients_desc": "Data on the clients that use AdGuard Home, but not stored in the configuration"
<mask> "client_added": "Client \"{{key}}\" successfully added", <mask> "client_updated": "Client \"{{key}}\" successfully updated", <mask> "table_statistics": "Statistics (last 24 hours)", <mask> "clients_not_found": "No clients found", <mask> "client_confirm_delete": "Are you sure you want to delete client \"{{key}}\"?" <mask> } </s> + client: add runtime clients table </s> remove "table_statistics": "Statistics (last 24 hours)", </s> add "table_statistics": "Requests count (last 24 hours)", </s> remove const clients = await apiClient.getClients(); const sortedClients = sortClients(clients); dispatch(getClientsSuccess(sortedClients)); </s> add const data = await apiClient.getClients(); const sortedClients = data.clients && sortClients(data.clients); const sortedAutoClients = data.auto_clients && sortClients(data.auto_clients); dispatch(getClientsSuccess({ clients: sortedClients || [], autoClients: sortedAutoClients || [], })); </s> remove const clientName = getClientName(dashboard.clients, row.value); </s> add const clientName = getClientName(dashboard.clients, row.value) || getClientName(dashboard.autoClients, row.value); </s> remove const clientName = getClientName(this.props.clients, value); </s> add const clientName = getClientName(this.props.clients, value) || getClientName(this.props.autoClients, value);
[ "keep", "keep", "keep", "keep", "replace", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/__locales/en.json
const data = await apiClient.getClients(); const sortedClients = data.clients && sortClients(data.clients); const sortedAutoClients = data.auto_clients && sortClients(data.auto_clients); dispatch(getClientsSuccess({ clients: sortedClients || [], autoClients: sortedAutoClients || [], }));
<mask> <mask> export const getClients = () => async (dispatch) => { <mask> dispatch(getClientsRequest()); <mask> try { <mask> const clients = await apiClient.getClients(); <mask> const sortedClients = sortClients(clients); <mask> dispatch(getClientsSuccess(sortedClients)); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error })); <mask> dispatch(getClientsFailure()); <mask> } <mask> }; </s> + client: add runtime clients table </s> remove clients: payload, </s> add clients: payload.clients, autoClients: payload.autoClients, </s> remove const clientName = getClientName(dashboard.clients, row.value); </s> add const clientName = getClientName(dashboard.clients, row.value) || getClientName(dashboard.autoClients, row.value); </s> remove const clientName = getClientName(this.props.clients, value); </s> add const clientName = getClientName(this.props.clients, value) || getClientName(this.props.autoClients, value);
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/actions/index.js
const clientName = getClientName(this.props.clients, value) || getClientName(this.props.autoClients, value);
<mask> columns = [{ <mask> Header: 'IP', <mask> accessor: 'ip', <mask> Cell: ({ value }) => { <mask> const clientName = getClientName(this.props.clients, value); <mask> let client; <mask> <mask> if (clientName) { <mask> client = <span>{clientName} <small>({value})</small></span>; <mask> } else { </s> + client: add runtime clients table </s> remove const clientName = getClientName(dashboard.clients, row.value); </s> add const clientName = getClientName(dashboard.clients, row.value) || getClientName(dashboard.autoClients, row.value); </s> remove clients: payload, </s> add clients: payload.clients, autoClients: payload.autoClients, </s> remove const clients = await apiClient.getClients(); const sortedClients = sortClients(clients); dispatch(getClientsSuccess(sortedClients)); </s> add const data = await apiClient.getClients(); const sortedClients = data.clients && sortClients(data.clients); const sortedAutoClients = data.auto_clients && sortClients(data.auto_clients); dispatch(getClientsSuccess({ clients: sortedClients || [], autoClients: sortedAutoClients || [], })); </s> remove "client_confirm_delete": "Are you sure you want to delete client \"{{key}}\"?" </s> add "client_confirm_delete": "Are you sure you want to delete client \"{{key}}\"?", "auto_clients_title": "Clients (runtime)", "auto_clients_desc": "Data on the clients that use AdGuard Home, but not stored in the configuration"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/components/Dashboard/Clients.js
autoClients: PropTypes.array.isRequired,
<mask> topClients: PropTypes.object.isRequired, <mask> dnsQueries: PropTypes.number.isRequired, <mask> refreshButton: PropTypes.node.isRequired, <mask> clients: PropTypes.array.isRequired, <mask> t: PropTypes.func, <mask> }; <mask> <mask> export default withNamespaces()(Clients); </s> + client: add runtime clients table </s> remove const clients = await apiClient.getClients(); const sortedClients = sortClients(clients); dispatch(getClientsSuccess(sortedClients)); </s> add const data = await apiClient.getClients(); const sortedClients = data.clients && sortClients(data.clients); const sortedAutoClients = data.auto_clients && sortClients(data.auto_clients); dispatch(getClientsSuccess({ clients: sortedClients || [], autoClients: sortedAutoClients || [], })); </s> remove clients: payload, </s> add clients: payload.clients, autoClients: payload.autoClients, </s> remove <Clients clients={dashboard.clients} topStats={dashboard.topStats} isModalOpen={clients.isModalOpen} modalClientName={clients.modalClientName} modalType={clients.modalType} addClient={this.props.addClient} updateClient={this.props.updateClient} deleteClient={this.props.deleteClient} toggleClientModal={this.props.toggleClientModal} processingAdding={clients.processingAdding} processingDeleting={clients.processingDeleting} processingUpdating={clients.processingUpdating} /> </s> add <Fragment> <Clients clients={dashboard.clients} topStats={dashboard.topStats} isModalOpen={clients.isModalOpen} modalClientName={clients.modalClientName} modalType={clients.modalType} addClient={this.props.addClient} updateClient={this.props.updateClient} deleteClient={this.props.deleteClient} toggleClientModal={this.props.toggleClientModal} processingAdding={clients.processingAdding} processingDeleting={clients.processingDeleting} processingUpdating={clients.processingUpdating} /> <AutoClients autoClients={dashboard.autoClients} topStats={dashboard.topStats} /> </Fragment>
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/components/Dashboard/Clients.js
autoClients={dashboard.autoClients}
<mask> dnsQueries={dashboard.stats.dns_queries} <mask> refreshButton={refreshButton} <mask> topClients={dashboard.topStats.top_clients} <mask> clients={dashboard.clients} <mask> /> <mask> </div> <mask> <div className="col-lg-6"> <mask> <QueriedDomains <mask> dnsQueries={dashboard.stats.dns_queries} <mask> refreshButton={refreshButton} </s> + client: add runtime clients table </s> remove <Clients clients={dashboard.clients} topStats={dashboard.topStats} isModalOpen={clients.isModalOpen} modalClientName={clients.modalClientName} modalType={clients.modalType} addClient={this.props.addClient} updateClient={this.props.updateClient} deleteClient={this.props.deleteClient} toggleClientModal={this.props.toggleClientModal} processingAdding={clients.processingAdding} processingDeleting={clients.processingDeleting} processingUpdating={clients.processingUpdating} /> </s> add <Fragment> <Clients clients={dashboard.clients} topStats={dashboard.topStats} isModalOpen={clients.isModalOpen} modalClientName={clients.modalClientName} modalType={clients.modalType} addClient={this.props.addClient} updateClient={this.props.updateClient} deleteClient={this.props.deleteClient} toggleClientModal={this.props.toggleClientModal} processingAdding={clients.processingAdding} processingDeleting={clients.processingDeleting} processingUpdating={clients.processingUpdating} /> <AutoClients autoClients={dashboard.autoClients} topStats={dashboard.topStats} /> </Fragment> </s> remove clients: payload, </s> add clients: payload.clients, autoClients: payload.autoClients, </s> remove const clientName = getClientName(dashboard.clients, row.value); </s> add const clientName = getClientName(dashboard.clients, row.value) || getClientName(dashboard.autoClients, row.value);
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/components/Dashboard/index.js
const clientName = getClientName(dashboard.clients, row.value) || getClientName(dashboard.autoClients, row.value);
<mask> maxWidth: 250, <mask> Cell: (row) => { <mask> const { reason } = row.original; <mask> const isFiltered = row ? reason.indexOf('Filtered') === 0 : false; <mask> const clientName = getClientName(dashboard.clients, row.value); <mask> let client; <mask> <mask> if (clientName) { <mask> client = <span>{clientName} <small>({row.value})</small></span>; <mask> } else { </s> + client: add runtime clients table </s> remove const clientName = getClientName(this.props.clients, value); </s> add const clientName = getClientName(this.props.clients, value) || getClientName(this.props.autoClients, value); </s> remove const clients = await apiClient.getClients(); const sortedClients = sortClients(clients); dispatch(getClientsSuccess(sortedClients)); </s> add const data = await apiClient.getClients(); const sortedClients = data.clients && sortClients(data.clients); const sortedAutoClients = data.auto_clients && sortClients(data.auto_clients); dispatch(getClientsSuccess({ clients: sortedClients || [], autoClients: sortedAutoClients || [], })); </s> remove clients: payload, </s> add clients: payload.clients, autoClients: payload.autoClients, </s> remove "client_confirm_delete": "Are you sure you want to delete client \"{{key}}\"?" </s> add "client_confirm_delete": "Are you sure you want to delete client \"{{key}}\"?", "auto_clients_title": "Clients (runtime)", "auto_clients_desc": "Data on the clients that use AdGuard Home, but not stored in the configuration"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/components/Logs/index.js
import AutoClients from './Clients/AutoClients';
<mask> import Dhcp from './Dhcp'; <mask> import Encryption from './Encryption'; <mask> import Clients from './Clients'; <mask> import Checkbox from '../ui/Checkbox'; <mask> import Loading from '../ui/Loading'; <mask> import PageTitle from '../ui/PageTitle'; <mask> import Card from '../ui/Card'; </s> + client: add runtime clients table </s> remove clients: payload, </s> add clients: payload.clients, autoClients: payload.autoClients, </s> remove <Clients clients={dashboard.clients} topStats={dashboard.topStats} isModalOpen={clients.isModalOpen} modalClientName={clients.modalClientName} modalType={clients.modalType} addClient={this.props.addClient} updateClient={this.props.updateClient} deleteClient={this.props.deleteClient} toggleClientModal={this.props.toggleClientModal} processingAdding={clients.processingAdding} processingDeleting={clients.processingDeleting} processingUpdating={clients.processingUpdating} /> </s> add <Fragment> <Clients clients={dashboard.clients} topStats={dashboard.topStats} isModalOpen={clients.isModalOpen} modalClientName={clients.modalClientName} modalType={clients.modalType} addClient={this.props.addClient} updateClient={this.props.updateClient} deleteClient={this.props.deleteClient} toggleClientModal={this.props.toggleClientModal} processingAdding={clients.processingAdding} processingDeleting={clients.processingDeleting} processingUpdating={clients.processingUpdating} /> <AutoClients autoClients={dashboard.autoClients} topStats={dashboard.topStats} /> </Fragment> </s> remove const clientName = getClientName(dashboard.clients, row.value); </s> add const clientName = getClientName(dashboard.clients, row.value) || getClientName(dashboard.autoClients, row.value);
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/components/Settings/index.js
<Fragment> <Clients clients={dashboard.clients} topStats={dashboard.topStats} isModalOpen={clients.isModalOpen} modalClientName={clients.modalClientName} modalType={clients.modalType} addClient={this.props.addClient} updateClient={this.props.updateClient} deleteClient={this.props.deleteClient} toggleClientModal={this.props.toggleClientModal} processingAdding={clients.processingAdding} processingDeleting={clients.processingDeleting} processingUpdating={clients.processingUpdating} /> <AutoClients autoClients={dashboard.autoClients} topStats={dashboard.topStats} /> </Fragment>
<mask> processingTestUpstream={settings.processingTestUpstream} <mask> processingSetUpstream={settings.processingSetUpstream} <mask> /> <mask> {!dashboard.processingTopStats && !dashboard.processingClients && ( <mask> <Clients <mask> clients={dashboard.clients} <mask> topStats={dashboard.topStats} <mask> isModalOpen={clients.isModalOpen} <mask> modalClientName={clients.modalClientName} <mask> modalType={clients.modalType} <mask> addClient={this.props.addClient} <mask> updateClient={this.props.updateClient} <mask> deleteClient={this.props.deleteClient} <mask> toggleClientModal={this.props.toggleClientModal} <mask> processingAdding={clients.processingAdding} <mask> processingDeleting={clients.processingDeleting} <mask> processingUpdating={clients.processingUpdating} <mask> /> <mask> )} <mask> <Encryption <mask> encryption={this.props.encryption} <mask> setTlsConfig={this.props.setTlsConfig} <mask> validateTlsConfig={this.props.validateTlsConfig} </s> + client: add runtime clients table </s> remove const clients = await apiClient.getClients(); const sortedClients = sortClients(clients); dispatch(getClientsSuccess(sortedClients)); </s> add const data = await apiClient.getClients(); const sortedClients = data.clients && sortClients(data.clients); const sortedAutoClients = data.auto_clients && sortClients(data.auto_clients); dispatch(getClientsSuccess({ clients: sortedClients || [], autoClients: sortedAutoClients || [], })); </s> remove clients: payload, </s> add clients: payload.clients, autoClients: payload.autoClients,
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/components/Settings/index.js
clients: payload.clients, autoClients: payload.autoClients,
<mask> [actions.getClientsFailure]: state => ({ ...state, processingClients: false }), <mask> [actions.getClientsSuccess]: (state, { payload }) => { <mask> const newState = { <mask> ...state, <mask> clients: payload, <mask> processingClients: false, <mask> }; <mask> return newState; <mask> }, <mask> }, { </s> + client: add runtime clients table </s> remove const clientName = getClientName(this.props.clients, value); </s> add const clientName = getClientName(this.props.clients, value) || getClientName(this.props.autoClients, value); </s> remove const clients = await apiClient.getClients(); const sortedClients = sortClients(clients); dispatch(getClientsSuccess(sortedClients)); </s> add const data = await apiClient.getClients(); const sortedClients = data.clients && sortClients(data.clients); const sortedAutoClients = data.auto_clients && sortClients(data.auto_clients); dispatch(getClientsSuccess({ clients: sortedClients || [], autoClients: sortedAutoClients || [], })); </s> remove const clientName = getClientName(dashboard.clients, row.value); </s> add const clientName = getClientName(dashboard.clients, row.value) || getClientName(dashboard.autoClients, row.value);
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/reducers/index.js
autoClients: [],
<mask> dnsAddresses: [], <mask> dnsVersion: '', <mask> clients: [], <mask> topStats: [], <mask> }); <mask> <mask> const queryLogs = handleActions({ </s> + client: add runtime clients table </s> remove const clients = await apiClient.getClients(); const sortedClients = sortClients(clients); dispatch(getClientsSuccess(sortedClients)); </s> add const data = await apiClient.getClients(); const sortedClients = data.clients && sortClients(data.clients); const sortedAutoClients = data.auto_clients && sortClients(data.auto_clients); dispatch(getClientsSuccess({ clients: sortedClients || [], autoClients: sortedAutoClients || [], })); </s> remove clients: payload, </s> add clients: payload.clients, autoClients: payload.autoClients, </s> remove const clientName = getClientName(dashboard.clients, row.value); </s> add const clientName = getClientName(dashboard.clients, row.value) || getClientName(dashboard.autoClients, row.value); </s> remove const clientName = getClientName(this.props.clients, value); </s> add const clientName = getClientName(this.props.clients, value) || getClientName(this.props.autoClients, value);
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a8c7329f7d437031760e1f5719cc9f7ed3cc73a
client/src/reducers/index.js
github.com/AdguardTeam/golibs v0.11.2
<mask> go 1.18 <mask> <mask> require ( <mask> github.com/AdguardTeam/dnsproxy v0.46.2 <mask> github.com/AdguardTeam/golibs v0.11.0 <mask> github.com/AdguardTeam/urlfilter v0.16.0 <mask> github.com/NYTimes/gziphandler v1.1.1 <mask> github.com/ameshkov/dnscrypt/v2 v2.2.5 <mask> github.com/digineo/go-ipset/v2 v2.2.1 <mask> github.com/dimfeld/httptreemux/v5 v5.4.0 </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove github.com/AdguardTeam/golibs v0.11.0 h1:fWp5bRLL7N806HWeNiRM7vHJH+wwWQ3Z6kpGPeu2onM= github.com/AdguardTeam/golibs v0.11.0/go.mod h1:87bN2x4VsTritptE3XZg9l8T6gznWsIxHBcQ1DeRIXA= </s> add github.com/AdguardTeam/golibs v0.11.2 h1:JbQB1Dg2JWStXgHh1QqBbOLWnP4t9oDjppoBH6TVXSE= github.com/AdguardTeam/golibs v0.11.2/go.mod h1:87bN2x4VsTritptE3XZg9l8T6gznWsIxHBcQ1DeRIXA= </s> remove aghtest.DiscardLogOutput(m) </s> add testutil.DiscardLogOutput(m)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
go.mod
github.com/AdguardTeam/golibs v0.11.2 h1:JbQB1Dg2JWStXgHh1QqBbOLWnP4t9oDjppoBH6TVXSE= github.com/AdguardTeam/golibs v0.11.2/go.mod h1:87bN2x4VsTritptE3XZg9l8T6gznWsIxHBcQ1DeRIXA=
<mask> github.com/AdguardTeam/dnsproxy v0.46.2 h1:ZUKM713Ts5meYQqk6cJkUBMCFSWqFPXTgjXkN4RI1Vo= <mask> github.com/AdguardTeam/dnsproxy v0.46.2/go.mod h1:PAmRzFqls0E92XTglyY2ESAqMAzZJhHKErG1ZpRnpjA= <mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.10.4/go.mod h1:rSfQRGHIdgfxriDDNgNJ7HmE5zRoURq8R+VdR81Zuzw= <mask> github.com/AdguardTeam/golibs v0.11.0 h1:fWp5bRLL7N806HWeNiRM7vHJH+wwWQ3Z6kpGPeu2onM= <mask> github.com/AdguardTeam/golibs v0.11.0/go.mod h1:87bN2x4VsTritptE3XZg9l8T6gznWsIxHBcQ1DeRIXA= <mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU= <mask> github.com/AdguardTeam/urlfilter v0.16.0 h1:IO29m+ZyQuuOnPLTzHuXj35V1DZOp1Dcryl576P2syg= <mask> github.com/AdguardTeam/urlfilter v0.16.0/go.mod h1:46YZDOV1+qtdRDuhZKVPSSp7JWWes0KayqHrKAFBdEI= <mask> github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I= <mask> github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove github.com/AdguardTeam/golibs v0.11.0 </s> add github.com/AdguardTeam/golibs v0.11.2 </s> remove log.Debug("dns: %q requests an internal ip", pctx.Addr) </s> add log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) </s> remove log.Debug("dns: addr %s is not from locally-served network", ip) </s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> remove log.Debug("dns: request is for a service domain") </s> add log.Debug("dnsforward: request is for a service domain")
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
go.sum
// // TODO(a.garipov): Replace with testutil.
<mask> <mask> // DiscardLogOutput runs tests with discarded logger output. <mask> func DiscardLogOutput(m *testing.M) { <mask> // TODO(e.burkov): Refactor code and tests to not use the global mutable <mask> // logger. <mask> log.SetOutput(io.Discard) <mask> <mask> os.Exit(m.Run()) </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove aghtest.DiscardLogOutput(m) </s> add testutil.DiscardLogOutput(m) </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) { </s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) { </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) </s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: no dhcp record for %q", reqHost) </s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove // hostToIPTable is an alias for the type of Server.tableHostToIP. type hostToIPTable = map[string]net.IP </s> add // hostToIPTable is a convenient type alias for tables of host names to an IP // address. type hostToIPTable = map[string]netip.Addr // ipToHostTable is a convenient type alias for tables of IP addresses to their // host names. For example, for use with PTR queries. type ipToHostTable = map[netip.Addr]string
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/aghtest/aghtest.go
"net/netip"
<mask> "encoding/binary" <mask> "net" <mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd" </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove ptr, ok := resp.Answer[0].(*dns.PTR) require.True(t, ok) </s> add </s> remove log.Debug("dns: addr %s is not from locally-served network", ip) </s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip)
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
<mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/AdguardTeam/golibs/stringutil" <mask> "github.com/miekg/dns" <mask> "golang.org/x/exp/slices" <mask> ) <mask> <mask> //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. <mask> <mask> // To transfer information between modules </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. </s> add </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. </s> add </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) ip := slices.Clone(l.IP) </s> add // Assume that we only process IPv4 now. // // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4) if err != nil { log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
<mask> "github.com/miekg/dns" <mask> "golang.org/x/exp/slices" <mask> ) <mask> <mask> //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. <mask> <mask> // To transfer information between modules <mask> type dnsContext struct { <mask> proxyCtx *proxy.DNSContext <mask> <mask> // setts are the filtering settings for the client. </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove "golang.org/x/exp/slices" </s> add </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. </s> add </s> remove // hostToIPTable is an alias for the type of Server.tableHostToIP. type hostToIPTable = map[string]net.IP </s> add // hostToIPTable is a convenient type alias for tables of host names to an IP // address. type hostToIPTable = map[string]netip.Addr // ipToHostTable is a convenient type alias for tables of IP addresses to their // host names. For example, for use with PTR queries. type ipToHostTable = map[netip.Addr]string
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
func (s *Server) setTableIPToHost(t ipToHostTable) {
<mask> <mask> s.tableHostToIP = t <mask> } <mask> <mask> func (s *Server) setTableIPToHost(t *netutil.IPMap) { <mask> s.tableIPToHostLock.Lock() <mask> defer s.tableIPToHostLock.Unlock() <mask> <mask> s.tableIPToHost = t <mask> } </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove var err error add := true </s> add </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) { </s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { </s> remove if s.tableIPToHost == nil { return "", false } var v any v, ok = s.tableIPToHost.Get(ip) if !ok { return "", false } if host, ok = v.(string); !ok { log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) return "", false } </s> add host, ok = s.tableIPToHost[ip] </s> remove if s.tableHostToIP == nil { return nil, false } </s> add ip, ok = s.tableHostToIP[host] </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) { </s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
<mask> s.tableIPToHost = t <mask> } <mask> <mask> func (s *Server) onDHCPLeaseChanged(flags int) { <mask> var err error <mask> <mask> add := true <mask> switch flags { <mask> case dhcpd.LeaseChangedAdded, <mask> dhcpd.LeaseChangedAddedStatic, <mask> dhcpd.LeaseChangedRemovedStatic: <mask> // Go on. </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove add = false </s> add s.setTableHostToIP(nil) s.setTableIPToHost(nil) return </s> remove func (s *Server) setTableIPToHost(t *netutil.IPMap) { </s> add func (s *Server) setTableIPToHost(t ipToHostTable) { </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) { </s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { </s> remove if s.tableIPToHost == nil { return "", false } var v any v, ok = s.tableIPToHost.Get(ip) if !ok { return "", false } if host, ok = v.(string); !ok { log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) return "", false } </s> add host, ok = s.tableIPToHost[ip] </s> remove if s.tableHostToIP == nil { return nil, false } </s> add ip, ok = s.tableHostToIP[host]
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
s.setTableHostToIP(nil) s.setTableIPToHost(nil) return
<mask> dhcpd.LeaseChangedAddedStatic, <mask> dhcpd.LeaseChangedRemovedStatic: <mask> // Go on. <mask> case dhcpd.LeaseChangedRemovedAll: <mask> add = false <mask> default: <mask> return <mask> } <mask> <mask> var hostToIP hostToIPTable </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove var err error add := true </s> add </s> remove var hostToIP hostToIPTable var ipToHost *netutil.IPMap if add { ll := s.dhcpServer.Leases(dhcpd.LeasesAll) </s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll) hostToIP := make(hostToIPTable, len(ll)) ipToHost := make(ipToHostTable, len(ll)) for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err := netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) </s> remove hostToIP = make(hostToIPTable, len(ll)) ipToHost = netutil.NewIPMap(len(ll)) </s> add continue } </s> remove var ipFromTable net.IP ipFromTable, ok = s.tableHostToIP[host] if !ok { return nil, false } ip = make(net.IP, len(ipFromTable)) copy(ip, ipFromTable) return ip, true </s> add return ip, ok </s> remove if s.tableHostToIP == nil { return nil, false } </s> add ip, ok = s.tableHostToIP[host]
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
ll := s.dhcpServer.Leases(dhcpd.LeasesAll) hostToIP := make(hostToIPTable, len(ll)) ipToHost := make(ipToHostTable, len(ll)) for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err := netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err)
<mask> default: <mask> return <mask> } <mask> <mask> var hostToIP hostToIPTable <mask> var ipToHost *netutil.IPMap <mask> if add { <mask> ll := s.dhcpServer.Leases(dhcpd.LeasesAll) <mask> <mask> hostToIP = make(hostToIPTable, len(ll)) <mask> ipToHost = netutil.NewIPMap(len(ll)) <mask> <mask> for _, l := range ll { </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove hostToIP = make(hostToIPTable, len(ll)) ipToHost = netutil.NewIPMap(len(ll)) </s> add continue } </s> remove for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err = netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug( "dns: skipping invalid hostname %q from dhcp: %s", l.Hostname, err, ) } </s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) </s> remove add = false </s> add s.setTableHostToIP(nil) s.setTableIPToHost(nil) return </s> remove var err error add := true </s> add </s> remove wantIP: nil, </s> add wantIP: netip.Addr{},
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
continue }
<mask> var ipToHost *netutil.IPMap <mask> if add { <mask> ll := s.dhcpServer.Leases(dhcpd.LeasesAll) <mask> <mask> hostToIP = make(hostToIPTable, len(ll)) <mask> ipToHost = netutil.NewIPMap(len(ll)) <mask> <mask> for _, l := range ll { <mask> // TODO(a.garipov): Remove this after we're finished with the client <mask> // hostname validations in the DHCP server code. <mask> err = netutil.ValidateDomainName(l.Hostname) </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove var hostToIP hostToIPTable var ipToHost *netutil.IPMap if add { ll := s.dhcpServer.Leases(dhcpd.LeasesAll) </s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll) hostToIP := make(hostToIPTable, len(ll)) ipToHost := make(ipToHostTable, len(ll)) for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err := netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) </s> remove for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err = netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug( "dns: skipping invalid hostname %q from dhcp: %s", l.Hostname, err, ) } </s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) </s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove var err error add := true </s> add </s> remove add = false </s> add s.setTableHostToIP(nil) s.setTableIPToHost(nil) return
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix)
<mask> <mask> hostToIP = make(hostToIPTable, len(ll)) <mask> ipToHost = netutil.NewIPMap(len(ll)) <mask> <mask> for _, l := range ll { <mask> // TODO(a.garipov): Remove this after we're finished with the client <mask> // hostname validations in the DHCP server code. <mask> err = netutil.ValidateDomainName(l.Hostname) <mask> if err != nil { <mask> log.Debug( <mask> "dns: skipping invalid hostname %q from dhcp: %s", <mask> l.Hostname, <mask> err, <mask> ) <mask> } <mask> <mask> lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) <mask> ip := slices.Clone(l.IP) <mask> <mask> ipToHost.Set(ip, lowhost) </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove var hostToIP hostToIPTable var ipToHost *netutil.IPMap if add { ll := s.dhcpServer.Leases(dhcpd.LeasesAll) </s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll) hostToIP := make(hostToIPTable, len(ll)) ipToHost := make(ipToHostTable, len(ll)) for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err := netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) </s> remove hostToIP = make(hostToIPTable, len(ll)) ipToHost = netutil.NewIPMap(len(ll)) </s> add continue } </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) ip := slices.Clone(l.IP) </s> add // Assume that we only process IPv4 now. // // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4) if err != nil { log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err) </s> remove ipToHost.Set(ip, lowhost) hostToIP[lowhost] = ip </s> add continue </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
// Assume that we only process IPv4 now. // // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4) if err != nil { log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err)
<mask> err, <mask> ) <mask> } <mask> <mask> lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) <mask> ip := slices.Clone(l.IP) <mask> <mask> ipToHost.Set(ip, lowhost) <mask> hostToIP[lowhost] = ip <mask> } <mask> </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove ipToHost.Set(ip, lowhost) hostToIP[lowhost] = ip </s> add continue </s> remove for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err = netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug( "dns: skipping invalid hostname %q from dhcp: %s", l.Hostname, err, ) } </s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) </s> remove log.Debug("dns: added %d A/PTR entries from DHCP", ipToHost.Len()) </s> add ipToHost[ip] = lowhost hostToIP[lowhost] = ip </s> remove knownIP := net.IP{1, 2, 3, 4} </s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
continue
<mask> <mask> lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) <mask> ip := slices.Clone(l.IP) <mask> <mask> ipToHost.Set(ip, lowhost) <mask> hostToIP[lowhost] = ip <mask> } <mask> <mask> log.Debug("dns: added %d A/PTR entries from DHCP", ipToHost.Len()) <mask> } <mask> </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: added %d A/PTR entries from DHCP", ipToHost.Len()) </s> add ipToHost[ip] = lowhost hostToIP[lowhost] = ip </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) ip := slices.Clone(l.IP) </s> add // Assume that we only process IPv4 now. // // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4) if err != nil { log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err) </s> remove for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err = netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug( "dns: skipping invalid hostname %q from dhcp: %s", l.Hostname, err, ) } </s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
ipToHost[ip] = lowhost hostToIP[lowhost] = ip
<mask> ipToHost.Set(ip, lowhost) <mask> hostToIP[lowhost] = ip <mask> } <mask> <mask> log.Debug("dns: added %d A/PTR entries from DHCP", ipToHost.Len()) <mask> } <mask> <mask> s.setTableHostToIP(hostToIP) <mask> s.setTableIPToHost(ipToHost) <mask> } </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove ipToHost.Set(ip, lowhost) hostToIP[lowhost] = ip </s> add continue </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) ip := slices.Clone(l.IP) </s> add // Assume that we only process IPv4 now. // // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4) if err != nil { log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err) </s> remove for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err = netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug( "dns: skipping invalid hostname %q from dhcp: %s", l.Hostname, err, ) } </s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: added %d a and ptr entries from dhcp", len(ipToHost))
<mask> } <mask> <mask> s.setTableHostToIP(hostToIP) <mask> s.setTableIPToHost(ipToHost) <mask> } <mask> <mask> // processDDRQuery responds to Discovery of Designated Resolvers (DDR) SVCB <mask> // queries. The response contains different types of encryption supported by <mask> // current user configuration. </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: added %d A/PTR entries from DHCP", ipToHost.Len()) </s> add ipToHost[ip] = lowhost hostToIP[lowhost] = ip </s> remove // hostToIPTable is an alias for the type of Server.tableHostToIP. type hostToIPTable = map[string]net.IP </s> add // hostToIPTable is a convenient type alias for tables of host names to an IP // address. type hostToIPTable = map[string]netip.Addr // ipToHostTable is a convenient type alias for tables of IP addresses to their // host names. For example, for use with PTR queries. type ipToHostTable = map[netip.Addr]string </s> remove return host, true </s> add return host, ok </s> remove log.Debug("dns: parsing reversed addr: %s", err) </s> add log.Debug("dnsforward: parsing reversed addr: %s", err) </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) {
<mask> <mask> // dhcpHostToIP tries to get an IP leased by DHCP and returns the copy of <mask> // address since the data inside the internal table may be changed while request <mask> // processing. It's safe for concurrent use. <mask> func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) { <mask> s.tableHostToIPLock.Lock() <mask> defer s.tableHostToIPLock.Unlock() <mask> <mask> if s.tableHostToIP == nil { <mask> return nil, false </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove if s.tableHostToIP == nil { return nil, false } </s> add ip, ok = s.tableHostToIP[host] </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) { </s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { </s> remove return host, true </s> add return host, ok </s> remove if s.tableIPToHost == nil { return "", false } var v any v, ok = s.tableIPToHost.Get(ip) if !ok { return "", false } if host, ok = v.(string); !ok { log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) return "", false } </s> add host, ok = s.tableIPToHost[ip] </s> remove var ipFromTable net.IP ipFromTable, ok = s.tableHostToIP[host] if !ok { return nil, false } ip = make(net.IP, len(ipFromTable)) copy(ip, ipFromTable) return ip, true </s> add return ip, ok
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
ip, ok = s.tableHostToIP[host]
<mask> func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) { <mask> s.tableHostToIPLock.Lock() <mask> defer s.tableHostToIPLock.Unlock() <mask> <mask> if s.tableHostToIP == nil { <mask> return nil, false <mask> } <mask> <mask> var ipFromTable net.IP <mask> ipFromTable, ok = s.tableHostToIP[host] <mask> if !ok { <mask> return nil, false </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) { </s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) { </s> remove var ipFromTable net.IP ipFromTable, ok = s.tableHostToIP[host] if !ok { return nil, false } ip = make(net.IP, len(ipFromTable)) copy(ip, ipFromTable) return ip, true </s> add return ip, ok </s> remove if s.tableIPToHost == nil { return "", false } var v any v, ok = s.tableIPToHost.Get(ip) if !ok { return "", false } if host, ok = v.(string); !ok { log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) return "", false } </s> add host, ok = s.tableIPToHost[ip] </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) { </s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { </s> remove func (s *Server) setTableIPToHost(t *netutil.IPMap) { </s> add func (s *Server) setTableIPToHost(t ipToHostTable) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
return ip, ok
<mask> if s.tableHostToIP == nil { <mask> return nil, false <mask> } <mask> <mask> var ipFromTable net.IP <mask> ipFromTable, ok = s.tableHostToIP[host] <mask> if !ok { <mask> return nil, false <mask> } <mask> <mask> ip = make(net.IP, len(ipFromTable)) <mask> copy(ip, ipFromTable) <mask> <mask> return ip, true <mask> } <mask> <mask> // processDHCPHosts respond to A requests if the target hostname is known to <mask> // the server. <mask> // </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove if s.tableHostToIP == nil { return nil, false } </s> add ip, ok = s.tableHostToIP[host] </s> remove if s.tableIPToHost == nil { return "", false } var v any v, ok = s.tableIPToHost.Get(ip) if !ok { return "", false } if host, ok = v.(string); !ok { log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) return "", false } </s> add host, ok = s.tableIPToHost[ip] </s> remove return host, true </s> add return host, ok </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr) </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) { </s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost)
<mask> return resultCodeSuccess <mask> } <mask> <mask> if !dctx.isLocalClient { <mask> log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost) <mask> pctx.Res = s.genNXDomain(req) <mask> <mask> // Do not even put into query log. <mask> return resultCodeFinish <mask> } </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: %q requests an internal ip", pctx.Addr) </s> add log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) </s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: no dhcp record for %q", reqHost) </s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host) </s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host) </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip) </s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: no dhcp record for %q", reqHost)
<mask> ip, ok := s.dhcpHostToIP(reqHost) <mask> if !ok { <mask> // Go on and process them with filters, including dnsrewrite ones, and <mask> // possibly route them to a domain-specific upstream. <mask> log.Debug("dns: no dhcp record for %q", reqHost) <mask> <mask> return resultCodeSuccess <mask> } <mask> <mask> log.Debug("dns: dhcp record for %q is %s", reqHost, ip) </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip) </s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host) </s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host) </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) </s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip)
<mask> <mask> return resultCodeSuccess <mask> } <mask> <mask> log.Debug("dns: dhcp record for %q is %s", reqHost, ip) <mask> <mask> resp := s.makeResponse(req) <mask> if q.Qtype == dns.TypeA { <mask> a := &dns.A{ <mask> Hdr: s.hdr(req, dns.TypeA), </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove A: ip, </s> add A: ip.AsSlice(), </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host) </s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host) </s> remove log.Debug("dns: no dhcp record for %q", reqHost) </s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
A: ip.AsSlice(),
<mask> resp := s.makeResponse(req) <mask> if q.Qtype == dns.TypeA { <mask> a := &dns.A{ <mask> Hdr: s.hdr(req, dns.TypeA), <mask> A: ip, <mask> } <mask> resp.Answer = append(resp.Answer, a) <mask> } <mask> dctx.proxyCtx.Res = resp <mask> </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip) </s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host) </s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host) </s> remove var ipFromTable net.IP ipFromTable, ok = s.tableHostToIP[host] if !ok { return nil, false } ip = make(net.IP, len(ipFromTable)) copy(ip, ipFromTable) return ip, true </s> add return ip, ok </s> remove if tc.wantIP == nil { </s> add if tc.wantIP == (netip.Addr{}) { </s> remove } else if tc.wantIP == nil { </s> add } else if tc.wantIP == (netip.Addr{}) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: parsing reversed addr: %s", err)
<mask> } <mask> <mask> ip, err := netutil.IPFromReversedAddr(q.Name) <mask> if err != nil { <mask> log.Debug("dns: parsing reversed addr: %s", err) <mask> <mask> // DNS-Based Service Discovery uses PTR records having not an ARPA <mask> // format of the domain name in question. Those shouldn't be <mask> // invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and <mask> // RFC 2782. </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: validating service domain: %s", err) </s> add log.Debug("dnsforward: validating service domain: %s", err) </s> remove log.Error("dns: getting custom upstreams for client %s: %s", id, err) </s> add log.Error("dnsforward: getting custom upstreams for client %s: %s", id, err) </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr) </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) ip := slices.Clone(l.IP) </s> add // Assume that we only process IPv4 now. // // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4) if err != nil { log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) </s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: validating service domain: %s", err)
<mask> // invalidated. See http://www.dns-sd.org/ServerStaticSetup.html and <mask> // RFC 2782. <mask> name := strings.TrimSuffix(q.Name, ".") <mask> if err = netutil.ValidateSRVDomainName(name); err != nil { <mask> log.Debug("dns: validating service domain: %s", err) <mask> <mask> return resultCodeError <mask> } <mask> <mask> log.Debug("dns: request is for a service domain") </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: request is for a service domain") </s> add log.Debug("dnsforward: request is for a service domain") </s> remove log.Debug("dns: parsing reversed addr: %s", err) </s> add log.Debug("dnsforward: parsing reversed addr: %s", err) </s> remove log.Error("dns: getting custom upstreams for client %s: %s", id, err) </s> add log.Error("dnsforward: getting custom upstreams for client %s: %s", id, err) </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: using custom upstreams for client %s", id) </s> add log.Debug("dnsforward: using custom upstreams for client %s", id)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: request is for a service domain")
<mask> <mask> return resultCodeError <mask> } <mask> <mask> log.Debug("dns: request is for a service domain") <mask> <mask> return resultCodeSuccess <mask> } <mask> <mask> // Restrict an access to local addresses for external clients. We also </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: addr %s is not from locally-served network", ip) </s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> remove log.Debug("dns: validating service domain: %s", err) </s> add log.Debug("dnsforward: validating service domain: %s", err) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) </s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip) </s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove log.Debug("dns: no dhcp record for %q", reqHost) </s> add log.Debug("dnsforward: no dhcp record for %q", reqHost)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: addr %s is not from locally-served network", ip)
<mask> // Restrict an access to local addresses for external clients. We also <mask> // assume that all the DHCP leases we give are locally-served or at least <mask> // don't need to be accessible externally. <mask> if !s.privateNets.Contains(ip) { <mask> log.Debug("dns: addr %s is not from locally-served network", ip) <mask> <mask> return resultCodeSuccess <mask> } <mask> <mask> if !dctx.isLocalClient { </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: request is for a service domain") </s> add log.Debug("dnsforward: request is for a service domain") </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: %q requests an internal ip", pctx.Addr) </s> add log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) </s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host) </s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: %q requests an internal ip", pctx.Addr)
<mask> return resultCodeSuccess <mask> } <mask> <mask> if !dctx.isLocalClient { <mask> log.Debug("dns: %q requests an internal ip", pctx.Addr) <mask> pctx.Res = s.genNXDomain(req) <mask> <mask> // Do not even put into query log. <mask> return resultCodeFinish <mask> } </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) </s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove log.Debug("dns: addr %s is not from locally-served network", ip) </s> add log.Debug("dnsforward: addr %s is not from locally-served network", ip) </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip) </s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove log.Debug("dns: request is for a service domain") </s> add log.Debug("dnsforward: request is for a service domain")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) {
<mask> } <mask> <mask> // ipToDHCPHost tries to get a hostname leased by DHCP. It's safe for <mask> // concurrent use. <mask> func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) { <mask> s.tableIPToHostLock.Lock() <mask> defer s.tableIPToHostLock.Unlock() <mask> <mask> if s.tableIPToHost == nil { <mask> return "", false </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove if s.tableIPToHost == nil { return "", false } var v any v, ok = s.tableIPToHost.Get(ip) if !ok { return "", false } if host, ok = v.(string); !ok { log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) return "", false } </s> add host, ok = s.tableIPToHost[ip] </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) { </s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) { </s> remove func (s *Server) setTableIPToHost(t *netutil.IPMap) { </s> add func (s *Server) setTableIPToHost(t ipToHostTable) { </s> remove if s.tableHostToIP == nil { return nil, false } </s> add ip, ok = s.tableHostToIP[host] </s> remove return host, true </s> add return host, ok
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
host, ok = s.tableIPToHost[ip]
<mask> func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) { <mask> s.tableIPToHostLock.Lock() <mask> defer s.tableIPToHostLock.Unlock() <mask> <mask> if s.tableIPToHost == nil { <mask> return "", false <mask> } <mask> <mask> var v any <mask> v, ok = s.tableIPToHost.Get(ip) <mask> if !ok { <mask> return "", false <mask> } <mask> <mask> if host, ok = v.(string); !ok { <mask> log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) <mask> <mask> return "", false <mask> } <mask> <mask> return host, true <mask> } <mask> <mask> // processDHCPAddrs responds to PTR requests if the target IP is leased by the </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove return host, true </s> add return host, ok </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) { </s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { </s> remove if s.tableHostToIP == nil { return nil, false } </s> add ip, ok = s.tableHostToIP[host] </s> remove var ipFromTable net.IP ipFromTable, ok = s.tableHostToIP[host] if !ok { return nil, false } ip = make(net.IP, len(ipFromTable)) copy(ip, ipFromTable) return ip, true </s> add return ip, ok </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) { </s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
return host, ok
<mask> <mask> return "", false <mask> } <mask> <mask> return host, true <mask> } <mask> <mask> // processDHCPAddrs responds to PTR requests if the target IP is leased by the <mask> // DHCP server. <mask> func (s *Server) processDHCPAddrs(dctx *dnsContext) (rc resultCode) { </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove if s.tableIPToHost == nil { return "", false } var v any v, ok = s.tableIPToHost.Get(ip) if !ok { return "", false } if host, ok = v.(string); !ok { log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) return "", false } </s> add host, ok = s.tableIPToHost[ip] </s> remove var ipFromTable net.IP ipFromTable, ok = s.tableHostToIP[host] if !ok { return nil, false } ip = make(net.IP, len(ipFromTable)) copy(ip, ipFromTable) return ip, true </s> add return ip, ok </s> remove func (s *Server) ipToDHCPHost(ip net.IP) (host string, ok bool) { </s> add func (s *Server) ipToDHCPHost(ip netip.Addr) (host string, ok bool) { </s> remove func (s *Server) dhcpHostToIP(host string) (ip net.IP, ok bool) { </s> add func (s *Server) dhcpHostToIP(host string) (ip netip.Addr, ok bool) { </s> remove if s.tableHostToIP == nil { return nil, false } </s> add ip, ok = s.tableHostToIP[host]
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
// TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr)
<mask> if ip == nil { <mask> return resultCodeSuccess <mask> } <mask> <mask> host, ok := s.ipToDHCPHost(ip) <mask> if !ok { <mask> return resultCodeSuccess <mask> } <mask> <mask> log.Debug("dns: dhcp reverse record for %s is %q", ip, host) </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: dhcp reverse record for %s is %q", ip, host) </s> add log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host) </s> remove log.Debug("dns: no dhcp record for %q", reqHost) </s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip) </s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove if s.tableIPToHost == nil { return "", false } var v any v, ok = s.tableIPToHost.Get(ip) if !ok { return "", false } if host, ok = v.(string); !ok { log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) return "", false } </s> add host, ok = s.tableIPToHost[ip] </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: dhcp reverse record for %s is %q", ip, host)
<mask> if !ok { <mask> return resultCodeSuccess <mask> } <mask> <mask> log.Debug("dns: dhcp reverse record for %s is %q", ip, host) <mask> <mask> req := pctx.Req <mask> resp := s.makeResponse(req) <mask> ptr := &dns.PTR{ <mask> Hdr: dns.RR_Header{ </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: dhcp record for %q is %s", reqHost, ip) </s> add log.Debug("dnsforward: dhcp record for %q is %s", reqHost, ip) </s> remove log.Debug("dns: no dhcp record for %q", reqHost) </s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove A: ip, </s> add A: ip.AsSlice(), </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost)
<mask> // Respond with an NXDOMAIN. <mask> // <mask> // TODO(a.garipov): Route such queries to a custom upstream for the <mask> // local domain name if there is one. <mask> log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) <mask> pctx.Res = s.genNXDomain(req) <mask> <mask> return resultCodeFinish <mask> } <mask> </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> add log.Debug("dnsforward: %q requests for dhcp host %q", pctx.Addr, reqHost) </s> remove log.Debug("dns: %q requests an internal ip", pctx.Addr) </s> add log.Debug("dnsforward: %q requests an internal ip", pctx.Addr) </s> remove log.Debug("dns: no dhcp record for %q", reqHost) </s> add log.Debug("dnsforward: no dhcp record for %q", reqHost) </s> remove log.Debug("dns: request is for a service domain") </s> add log.Debug("dnsforward: request is for a service domain") </s> remove log.Debug("dns: using custom upstreams for client %s", id) </s> add log.Debug("dnsforward: using custom upstreams for client %s", id)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Error("dnsforward: getting custom upstreams for client %s: %s", id, err)
<mask> // Use the ClientID first, since it has a higher priority. <mask> id := stringutil.Coalesce(clientID, ipStringFromAddr(pctx.Addr)) <mask> upsConf, err := customUpsByClient(id) <mask> if err != nil { <mask> log.Error("dns: getting custom upstreams for client %s: %s", id, err) <mask> <mask> return <mask> } <mask> <mask> if upsConf != nil { </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Debug("dns: using custom upstreams for client %s", id) </s> add log.Debug("dnsforward: using custom upstreams for client %s", id) </s> remove log.Debug("dns: validating service domain: %s", err) </s> add log.Debug("dnsforward: validating service domain: %s", err) </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr) </s> remove var hostToIP hostToIPTable var ipToHost *netutil.IPMap if add { ll := s.dhcpServer.Leases(dhcpd.LeasesAll) </s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll) hostToIP := make(hostToIPTable, len(ll)) ipToHost := make(ipToHostTable, len(ll)) for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err := netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) </s> remove log.Debug("dns: parsing reversed addr: %s", err) </s> add log.Debug("dnsforward: parsing reversed addr: %s", err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
log.Debug("dnsforward: using custom upstreams for client %s", id)
<mask> return <mask> } <mask> <mask> if upsConf != nil { <mask> log.Debug("dns: using custom upstreams for client %s", id) <mask> } <mask> <mask> pctx.CustomUpstreamConfig = upsConf <mask> } <mask> </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove log.Error("dns: getting custom upstreams for client %s: %s", id, err) </s> add log.Error("dnsforward: getting custom upstreams for client %s: %s", id, err) </s> remove log.Debug("dns: validating service domain: %s", err) </s> add log.Debug("dnsforward: validating service domain: %s", err) </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr) </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) </s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove if s.tableIPToHost == nil { return "", false } var v any v, ok = s.tableIPToHost.Get(ip) if !ok { return "", false } if host, ok = v.(string); !ok { log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) return "", false } </s> add host, ok = s.tableIPToHost[ip]
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns.go
"net/netip"
<mask> import ( <mask> "net" <mask> "testing" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/dnsproxy/proxy" </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove aghtest.DiscardLogOutput(m) </s> add testutil.DiscardLogOutput(m) </s> remove github.com/AdguardTeam/golibs v0.11.0 </s> add github.com/AdguardTeam/golibs v0.11.2
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
"github.com/AdguardTeam/golibs/testutil"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/miekg/dns" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> const ( </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove aghtest.DiscardLogOutput(m) </s> add testutil.DiscardLogOutput(m) </s> remove "golang.org/x/exp/slices" </s> add </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. </s> add </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
knownIP := netip.MustParseAddr("1.2.3.4")
<mask> } <mask> } <mask> <mask> func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) { <mask> knownIP := net.IP{1, 2, 3, 4} <mask> <mask> testCases := []struct { <mask> name string <mask> host string <mask> wantIP net.IP <mask> wantRes resultCode </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove knownIP := net.IP{1, 2, 3, 4} </s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove wantIP net.IP </s> add wantIP netip.Addr </s> remove wantIP net.IP </s> add wantIP netip.Addr </s> remove ptr, ok := resp.Answer[0].(*dns.PTR) require.True(t, ok) </s> add </s> remove if s.tableHostToIP == nil { return nil, false } </s> add ip, ok = s.tableHostToIP[host]
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
wantIP netip.Addr
<mask> <mask> testCases := []struct { <mask> name string <mask> host string <mask> wantIP net.IP <mask> wantRes resultCode <mask> isLocalCli bool <mask> }{{ <mask> name: "local_client_success", <mask> host: "example.lan", </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP net.IP </s> add wantIP netip.Addr </s> remove knownIP := net.IP{1, 2, 3, 4} </s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove knownIP := net.IP{1, 2, 3, 4} </s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
wantIP: netip.Addr{},
<mask> isLocalCli: true, <mask> }, { <mask> name: "local_client_unknown_host", <mask> host: "wronghost.lan", <mask> wantIP: nil, <mask> wantRes: resultCodeSuccess, <mask> isLocalCli: true, <mask> }, { <mask> name: "external_client_known_host", <mask> host: "example.lan", </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
wantIP: netip.Addr{},
<mask> isLocalCli: true, <mask> }, { <mask> name: "external_client_known_host", <mask> host: "example.lan", <mask> wantIP: nil, <mask> wantRes: resultCodeFinish, <mask> isLocalCli: false, <mask> }, { <mask> name: "external_client_unknown_host", <mask> host: "wronghost.lan", </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
wantIP: netip.Addr{},
<mask> isLocalCli: false, <mask> }, { <mask> name: "external_client_unknown_host", <mask> host: "wronghost.lan", <mask> wantIP: nil, <mask> wantRes: resultCodeFinish, <mask> isLocalCli: false, <mask> }} <mask> <mask> for _, tc := range testCases { </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
if tc.wantIP == (netip.Addr{}) {
<mask> <mask> return <mask> } <mask> <mask> if tc.wantIP == nil { <mask> assert.Nil(t, pctx.Res) <mask> } else { <mask> require.NotNil(t, pctx.Res) <mask> <mask> ans := pctx.Res.Answer </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove } else if tc.wantIP == nil { </s> add } else if tc.wantIP == (netip.Addr{}) { </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) </s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip) </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) </s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip) </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr) </s> remove var ipFromTable net.IP ipFromTable, ok = s.tableHostToIP[host] if !ok { return nil, false } ip = make(net.IP, len(ipFromTable)) copy(ip, ipFromTable) return ip, true </s> add return ip, ok
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip)
<mask> <mask> ans := pctx.Res.Answer <mask> require.Len(t, ans, 1) <mask> <mask> assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) <mask> } <mask> }) <mask> } <mask> } <mask> </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) </s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip) </s> remove } else if tc.wantIP == nil { </s> add } else if tc.wantIP == (netip.Addr{}) { </s> remove assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype) assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name) </s> add ans := resp.Answer[0] assert.Equal(t, dns.TypePTR, ans.Header().Rrtype) assert.Equal(t, "34.12.168.192.in-addr.arpa.", ans.Header().Name) ptr := testutil.RequireTypeAssert[*dns.PTR](t, ans) </s> remove if tc.wantIP == nil { </s> add if tc.wantIP == (netip.Addr{}) { </s> remove ptr, ok := resp.Answer[0].(*dns.PTR) require.True(t, ok) </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
knownIP := netip.MustParseAddr("1.2.3.4")
<mask> examplecom = "example.com" <mask> examplelan = "example." + defaultLocalDomainSuffix <mask> ) <mask> <mask> knownIP := net.IP{1, 2, 3, 4} <mask> testCases := []struct { <mask> name string <mask> host string <mask> suffix string <mask> wantIP net.IP </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove knownIP := net.IP{1, 2, 3, 4} </s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove wantIP net.IP </s> add wantIP netip.Addr </s> remove wantIP net.IP </s> add wantIP netip.Addr </s> remove for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err = netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug( "dns: skipping invalid hostname %q from dhcp: %s", l.Hostname, err, ) } </s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) ip := slices.Clone(l.IP) </s> add // Assume that we only process IPv4 now. // // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4) if err != nil { log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
wantIP netip.Addr
<mask> testCases := []struct { <mask> name string <mask> host string <mask> suffix string <mask> wantIP net.IP <mask> wantRes resultCode <mask> qtyp uint16 <mask> }{{ <mask> name: "success_external", <mask> host: examplecom, </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP net.IP </s> add wantIP netip.Addr </s> remove knownIP := net.IP{1, 2, 3, 4} </s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove knownIP := net.IP{1, 2, 3, 4} </s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
wantIP: netip.Addr{},
<mask> }{{ <mask> name: "success_external", <mask> host: examplecom, <mask> suffix: defaultLocalDomainSuffix, <mask> wantIP: nil, <mask> wantRes: resultCodeSuccess, <mask> qtyp: dns.TypeA, <mask> }, { <mask> name: "success_external_non_a", <mask> host: examplecom, </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
wantIP: netip.Addr{},
<mask> }, { <mask> name: "success_external_non_a", <mask> host: examplecom, <mask> suffix: defaultLocalDomainSuffix, <mask> wantIP: nil, <mask> wantRes: resultCodeSuccess, <mask> qtyp: dns.TypeCNAME, <mask> }, { <mask> name: "success_internal", <mask> host: examplelan, </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
wantIP: netip.Addr{},
<mask> }, { <mask> name: "success_internal_unknown", <mask> host: "example-new.lan", <mask> suffix: defaultLocalDomainSuffix, <mask> wantIP: nil, <mask> wantRes: resultCodeSuccess, <mask> qtyp: dns.TypeA, <mask> }, { <mask> name: "success_internal_aaaa", <mask> host: examplelan, </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
wantIP: netip.Addr{},
<mask> }, { <mask> name: "success_internal_aaaa", <mask> host: examplelan, <mask> suffix: defaultLocalDomainSuffix, <mask> wantIP: nil, <mask> wantRes: resultCodeSuccess, <mask> qtyp: dns.TypeAAAA, <mask> }, { <mask> name: "success_custom_suffix", <mask> host: "example.custom", </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{}, </s> remove wantIP: nil, </s> add wantIP: netip.Addr{},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
} else if tc.wantIP == (netip.Addr{}) {
<mask> require.NotNil(t, pctx.Res) <mask> <mask> ans := pctx.Res.Answer <mask> require.Len(t, ans, 0) <mask> } else if tc.wantIP == nil { <mask> assert.Nil(t, pctx.Res) <mask> } else { <mask> require.NotNil(t, pctx.Res) <mask> <mask> ans := pctx.Res.Answer </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove if tc.wantIP == nil { </s> add if tc.wantIP == (netip.Addr{}) { </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) </s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip) </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) </s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip) </s> remove assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype) assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name) </s> add ans := resp.Answer[0] assert.Equal(t, dns.TypePTR, ans.Header().Rrtype) assert.Equal(t, "34.12.168.192.in-addr.arpa.", ans.Header().Name) ptr := testutil.RequireTypeAssert[*dns.PTR](t, ans) </s> remove host, ok := s.ipToDHCPHost(ip) </s> add // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ipAddr, err := netutil.IPToAddrNoMapped(ip) if err != nil { log.Debug("dnsforward: bad reverse ip %v from dhcp: %s", ip, err) return resultCodeSuccess } host, ok := s.ipToDHCPHost(ipAddr)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip)
<mask> <mask> ans := pctx.Res.Answer <mask> require.Len(t, ans, 1) <mask> <mask> assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) <mask> } <mask> }) <mask> } <mask> } <mask> </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dns_test.go
"net/netip"
<mask> import ( <mask> "fmt" <mask> "net" <mask> "net/http" <mask> "runtime" <mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghalg" </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove aghtest.DiscardLogOutput(m) </s> add testutil.DiscardLogOutput(m) </s> remove github.com/AdguardTeam/golibs v0.11.0 </s> add github.com/AdguardTeam/golibs v0.11.2
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dnsforward.go
<mask> "github.com/AdguardTeam/golibs/stringutil" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. <mask> <mask> // DefaultTimeout is the default upstream timeout <mask> const DefaultTimeout = 10 * time.Second <mask> <mask> // defaultClientIDCacheCount is the default count of items in the LRU ClientID <mask> // cache. The assumption here is that there won't be more than this many </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove "golang.org/x/exp/slices" </s> add </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. </s> add </s> remove log.Debug("dns: dhcp client hostname %q was not filtered", reqHost) </s> add log.Debug("dnsforward: dhcp client hostname %q was not filtered", reqHost) </s> remove // hostToIPTable is an alias for the type of Server.tableHostToIP. type hostToIPTable = map[string]net.IP </s> add // hostToIPTable is a convenient type alias for tables of host names to an IP // address. type hostToIPTable = map[string]netip.Addr // ipToHostTable is a convenient type alias for tables of IP addresses to their // host names. For example, for use with PTR queries. type ipToHostTable = map[netip.Addr]string </s> remove aghtest.DiscardLogOutput(m) </s> add testutil.DiscardLogOutput(m)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dnsforward.go
// hostToIPTable is a convenient type alias for tables of host names to an IP // address. type hostToIPTable = map[string]netip.Addr // ipToHostTable is a convenient type alias for tables of IP addresses to their // host names. For example, for use with PTR queries. type ipToHostTable = map[netip.Addr]string
<mask> var defaultBlockedHosts = []string{"version.bind", "id.server", "hostname.bind"} <mask> <mask> var webRegistered bool <mask> <mask> // hostToIPTable is an alias for the type of Server.tableHostToIP. <mask> type hostToIPTable = map[string]net.IP <mask> <mask> // Server is the main way to start a DNS server. <mask> // <mask> // Example: <mask> // </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove var ipFromTable net.IP ipFromTable, ok = s.tableHostToIP[host] if !ok { return nil, false } ip = make(net.IP, len(ipFromTable)) copy(ip, ipFromTable) return ip, true </s> add return ip, ok </s> remove add = false </s> add s.setTableHostToIP(nil) s.setTableIPToHost(nil) return </s> remove if s.tableIPToHost == nil { return "", false } var v any v, ok = s.tableIPToHost.Get(ip) if !ok { return "", false } if host, ok = v.(string); !ok { log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) return "", false } </s> add host, ok = s.tableIPToHost[ip] </s> remove // TODO(e.burkov): Use map[netip.Addr]struct{} instead. tableIPToHost *netutil.IPMap </s> add tableIPToHost ipToHostTable </s> remove var hostToIP hostToIPTable var ipToHost *netutil.IPMap if add { ll := s.dhcpServer.Leases(dhcpd.LeasesAll) </s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll) hostToIP := make(hostToIPTable, len(ll)) ipToHost := make(ipToHostTable, len(ll)) for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err := netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dnsforward.go
tableIPToHost ipToHostTable
<mask> <mask> tableHostToIP hostToIPTable <mask> tableHostToIPLock sync.Mutex <mask> <mask> // TODO(e.burkov): Use map[netip.Addr]struct{} instead. <mask> tableIPToHost *netutil.IPMap <mask> tableIPToHostLock sync.Mutex <mask> <mask> // clientIDCache is a temporary storage for ClientIDs that were extracted <mask> // during the BeforeRequestHandler stage. <mask> clientIDCache cache.Cache </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove // hostToIPTable is an alias for the type of Server.tableHostToIP. type hostToIPTable = map[string]net.IP </s> add // hostToIPTable is a convenient type alias for tables of host names to an IP // address. type hostToIPTable = map[string]netip.Addr // ipToHostTable is a convenient type alias for tables of IP addresses to their // host names. For example, for use with PTR queries. type ipToHostTable = map[netip.Addr]string </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. </s> add </s> remove log.Error("dns: getting custom upstreams for client %s: %s", id, err) </s> add log.Error("dnsforward: getting custom upstreams for client %s: %s", id, err) </s> remove var hostToIP hostToIPTable var ipToHost *netutil.IPMap if add { ll := s.dhcpServer.Leases(dhcpd.LeasesAll) </s> add ll := s.dhcpServer.Leases(dhcpd.LeasesAll) hostToIP := make(hostToIPTable, len(ll)) ipToHost := make(ipToHostTable, len(ll)) for _, l := range ll { // TODO(a.garipov): Remove this after we're finished with the client // hostname validations in the DHCP server code. err := netutil.ValidateDomainName(l.Hostname) if err != nil { log.Debug("dnsforward: skipping invalid hostname %q from dhcp: %s", l.Hostname, err) </s> remove log.Debug("dns: request is for a service domain") </s> add log.Debug("dnsforward: request is for a service domain")
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dnsforward.go
testutil.DiscardLogOutput(m)
<mask> "github.com/stretchr/testify/require" <mask> ) <mask> <mask> func TestMain(m *testing.M) { <mask> aghtest.DiscardLogOutput(m) <mask> } <mask> <mask> const ( <mask> tlsServerName = "testdns.adguard.com" <mask> testMessagesCount = 10 </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove //lint:file-ignore SA1019 TODO(a.garipov): Replace [*netutil.IPMap]. </s> add </s> remove func (s *Server) setTableIPToHost(t *netutil.IPMap) { </s> add func (s *Server) setTableIPToHost(t ipToHostTable) { </s> remove var err error add := true </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dnsforward_test.go
ans := resp.Answer[0] assert.Equal(t, dns.TypePTR, ans.Header().Rrtype) assert.Equal(t, "34.12.168.192.in-addr.arpa.", ans.Header().Name) ptr := testutil.RequireTypeAssert[*dns.PTR](t, ans)
<mask> require.NoErrorf(t, err, "%s", addr) <mask> <mask> require.Len(t, resp.Answer, 1) <mask> <mask> assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype) <mask> assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name) <mask> <mask> ptr, ok := resp.Answer[0].(*dns.PTR) <mask> require.True(t, ok) <mask> assert.Equal(t, dns.Fqdn("myhost."+localDomain), ptr.Ptr) <mask> } </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove ptr, ok := resp.Answer[0].(*dns.PTR) require.True(t, ok) </s> add </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) </s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip) </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) </s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip) </s> remove } else if tc.wantIP == nil { </s> add } else if tc.wantIP == (netip.Addr{}) { </s> remove lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) ip := slices.Clone(l.IP) </s> add // Assume that we only process IPv4 now. // // TODO(a.garipov): Remove once we switch to netip.Addr more fully. ip, err := netutil.IPToAddr(l.IP, netutil.AddrFamilyIPv4) if err != nil { log.Debug("dnsforward: skipping invalid ip %v from dhcp: %s", l.IP, err)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dnsforward_test.go
<mask> <mask> assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype) <mask> assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name) <mask> <mask> ptr, ok := resp.Answer[0].(*dns.PTR) <mask> require.True(t, ok) <mask> assert.Equal(t, dns.Fqdn("myhost."+localDomain), ptr.Ptr) <mask> } <mask> <mask> func TestPTRResponseFromHosts(t *testing.T) { <mask> // Prepare test hosts file. </s> Pull request: 5035-dhcp-hosts-netip-addr Updates #5035. Squashed commit of the following: commit 3a272842f738da322abb2bc5306aed94da79304b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 20:34:49 2022 +0300 dnsforward: imp docs, tests commit b442ca9b57d730be3af14c68759c706f1742e4c4 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 19:51:21 2022 +0300 dnsforward: imp code, tests commit 8fca6de93edb8cfdb0ff5a940d08f8700e12a423 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Wed Oct 26 16:38:27 2022 +0300 dnsforward: mv dhcp hosts to netip.Addr </s> remove assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype) assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name) </s> add ans := resp.Answer[0] assert.Equal(t, dns.TypePTR, ans.Header().Rrtype) assert.Equal(t, "34.12.168.192.in-addr.arpa.", ans.Header().Name) ptr := testutil.RequireTypeAssert[*dns.PTR](t, ans) </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) </s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip) </s> remove assert.Equal(t, tc.wantIP, ans[0].(*dns.A).A) </s> add a := testutil.RequireTypeAssert[*dns.A](t, ans[0]) ip, err := netutil.IPToAddr(a.A, netutil.AddrFamilyIPv4) require.NoError(t, err) assert.Equal(t, tc.wantIP, ip) </s> remove knownIP := net.IP{1, 2, 3, 4} </s> add knownIP := netip.MustParseAddr("1.2.3.4") </s> remove if s.tableHostToIP == nil { return nil, false } </s> add ip, ok = s.tableHostToIP[host]
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a935d4ffbd20c48b9f03d3eeb1c2b527e85ca32
internal/dnsforward/dnsforward_test.go
github.com/AdguardTeam/golibs v0.4.3
<mask> go 1.14 <mask> <mask> require ( <mask> github.com/AdguardTeam/dnsproxy v0.33.2 <mask> github.com/AdguardTeam/golibs v0.4.2 <mask> github.com/AdguardTeam/urlfilter v0.12.3 <mask> github.com/NYTimes/gziphandler v1.1.1 <mask> github.com/beefsack/go-rate v0.0.0-20200827232406-6cde80facd47 // indirect <mask> github.com/fsnotify/fsnotify v1.4.9 <mask> github.com/gobuffalo/packr v1.30.1 </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests </s> remove github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous= github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA= </s> add
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
go.mod
<mask> dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= <mask> dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= <mask> dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= <mask> git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= <mask> github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous= <mask> github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA= <mask> github.com/AdguardTeam/dnsproxy v0.33.2 h1:k5aMcsw3TA/G2DR8EjIkwutDPuuRkKh8xij4cFWC6Fk= <mask> github.com/AdguardTeam/dnsproxy v0.33.2/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA= <mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.4.2 h1:7M28oTZFoFwNmp8eGPb3ImmYbxGaJLyQXeIFVHjME0o= <mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests </s> remove github.com/AdguardTeam/golibs v0.4.2 </s> add github.com/AdguardTeam/golibs v0.4.3 </s> remove Question: &q, Answer: &a, Result: &res, ClientIP: net.ParseIP(client), Upstream: "upstream", </s> add Question: &q, Answer: &a, OrigAnswer: &a, Result: &res, ClientIP: net.ParseIP(client), Upstream: "upstream", </s> remove golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 h1:42cLlJJdEh+ySyeUUbEQ5bsTiq8voBeTuweGVkY6Puw= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= </s> add </s> remove golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf h1:kt3wY1Lu5MJAnKTfoMR52Cu4gwvna4VTzNOiT8tY73s= golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
go.sum
github.com/AdguardTeam/golibs v0.4.3 h1:nXTLLLlIyU4BSRF0An5azS0uimSK/YpIMOBAO0/v1RY= github.com/AdguardTeam/golibs v0.4.3/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/dnsproxy v0.33.2/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA= <mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.4.2 h1:7M28oTZFoFwNmp8eGPb3ImmYbxGaJLyQXeIFVHjME0o= <mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU= <mask> github.com/AdguardTeam/urlfilter v0.12.3 h1:FMjQG0eTgrr8xA3z2zaLVcCgGdpzoECPGWwgPjtwPNs= <mask> github.com/AdguardTeam/urlfilter v0.12.3/go.mod h1:1fcCQx5TGJANrQN6sHNNM9KPBl7qx7BJml45ko6vru0= <mask> github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= <mask> github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= <mask> github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests </s> remove github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous= github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA= </s> add </s> remove github.com/AdguardTeam/golibs v0.4.2 </s> add github.com/AdguardTeam/golibs v0.4.3 </s> remove Question: &q, Answer: &a, Result: &res, ClientIP: net.ParseIP(client), Upstream: "upstream", </s> add Question: &q, Answer: &a, OrigAnswer: &a, Result: &res, ClientIP: net.ParseIP(client), Upstream: "upstream", </s> remove golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 h1:42cLlJJdEh+ySyeUUbEQ5bsTiq8voBeTuweGVkY6Puw= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= </s> add </s> remove golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf h1:kt3wY1Lu5MJAnKTfoMR52Cu4gwvna4VTzNOiT8tY73s= golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
go.sum
<mask> golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= <mask> golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU= <mask> golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= <mask> golang.org/x/net v0.0.0-20201016165138-7b1cca2348c0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= <mask> golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 h1:42cLlJJdEh+ySyeUUbEQ5bsTiq8voBeTuweGVkY6Puw= <mask> golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= <mask> golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= <mask> golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= <mask> golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= <mask> golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= <mask> golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests </s> remove Question: &q, Answer: &a, Result: &res, ClientIP: net.ParseIP(client), Upstream: "upstream", </s> add Question: &q, Answer: &a, OrigAnswer: &a, Result: &res, ClientIP: net.ParseIP(client), Upstream: "upstream", </s> remove github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous= github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA= </s> add </s> remove golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf h1:kt3wY1Lu5MJAnKTfoMR52Cu4gwvna4VTzNOiT8tY73s= golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
go.sum
<mask> golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 h1:DYfZAGf2WMFjMxbgTjaC+2HC7NkNAQs+6Q8b9WEB/F4= <mask> golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf h1:kt3wY1Lu5MJAnKTfoMR52Cu4gwvna4VTzNOiT8tY73s= <mask> golang.org/x/sys v0.0.0-20201107080550-4d91cf3a1aaf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20201109165425-215b40eba54c h1:+B+zPA6081G5cEb2triOIJpcvSW4AYzmIyWAqMn2JAc= <mask> golang.org/x/sys v0.0.0-20201109165425-215b40eba54c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= <mask> golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= <mask> golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests </s> remove Question: &q, Answer: &a, Result: &res, ClientIP: net.ParseIP(client), Upstream: "upstream", </s> add Question: &q, Answer: &a, OrigAnswer: &a, Result: &res, ClientIP: net.ParseIP(client), Upstream: "upstream", </s> remove github.com/AdguardTeam/dnsproxy v0.33.1 h1:rEAS1fBEQ3JslzsfkcyMRV96OeBWFnKzXvksduI0ous= github.com/AdguardTeam/dnsproxy v0.33.1/go.mod h1:kLi6lMpErnZThy5haiRSis4q0KTB8uPWO4JQsU1EDJA= </s> add </s> remove golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 h1:42cLlJJdEh+ySyeUUbEQ5bsTiq8voBeTuweGVkY6Puw= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= </s> add
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
go.sum
"bytes"
<mask> package dnsfilter <mask> <mask> import ( <mask> "fmt" <mask> "net" <mask> "strings" <mask> "testing" </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/dnsfilter/dnsfilter_test.go
"strings"
<mask> import ( <mask> "bytes" <mask> "fmt" <mask> "net" <mask> "testing" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/testutil" <mask> "github.com/AdguardTeam/golibs/log" </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/dnsfilter/dnsfilter_test.go
"github.com/AdguardTeam/golibs/log"
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/testutil" <mask> "github.com/AdguardTeam/urlfilter/rules" <mask> "github.com/miekg/dns" <mask> "github.com/stretchr/testify/assert" <mask> ) </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/dnsfilter/dnsfilter_test.go
logOutput := &bytes.Buffer{} testutil.ReplaceLogWriter(t, logOutput) testutil.ReplaceLogLevel(t, log.DEBUG)
<mask> <mask> func TestSafeBrowsing(t *testing.T) { <mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil) <mask> defer d.Close() <mask> gctx.stats.Safebrowsing.Requests = 0 <mask> d.checkMatch(t, "wmconvirus.narod.ru") </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/dnsfilter/dnsfilter_test.go
assert.True(t, strings.Contains(logOutput.String(), "SafeBrowsing lookup for wmconvirus.narod.ru"))
<mask> d := NewForTest(&Config{SafeBrowsingEnabled: true}, nil) <mask> defer d.Close() <mask> gctx.stats.Safebrowsing.Requests = 0 <mask> d.checkMatch(t, "wmconvirus.narod.ru") <mask> d.checkMatch(t, "test.wmconvirus.narod.ru") <mask> d.checkMatchEmpty(t, "yandex.ru") <mask> d.checkMatchEmpty(t, "pornhub.com") <mask> </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests </s> remove res := dnsfilter.Result{} </s> add res := dnsfilter.Result{ IsFiltered: true, Rule: "SomeRule", Reason: dnsfilter.ReasonRewrite, ServiceName: "SomeService", FilterID: 1, }
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/dnsfilter/dnsfilter_test.go
logOutput := &bytes.Buffer{} testutil.ReplaceLogWriter(t, logOutput) testutil.ReplaceLogLevel(t, log.DEBUG)
<mask> <mask> // PARENTAL <mask> <mask> func TestParentalControl(t *testing.T) { <mask> d := NewForTest(&Config{ParentalEnabled: true}, nil) <mask> defer d.Close() <mask> d.checkMatch(t, "pornhub.com") <mask> assert.True(t, strings.Contains(logOutput.String(), "Parental lookup for pornhub.com")) <mask> d.checkMatch(t, "www.pornhub.com") <mask> d.checkMatchEmpty(t, "www.yandex.ru") </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/dnsfilter/dnsfilter_test.go
assert.True(t, strings.Contains(logOutput.String(), "Parental lookup for pornhub.com"))
<mask> <mask> d := NewForTest(&Config{ParentalEnabled: true}, nil) <mask> defer d.Close() <mask> d.checkMatch(t, "pornhub.com") <mask> d.checkMatch(t, "www.pornhub.com") <mask> d.checkMatchEmpty(t, "www.yandex.ru") <mask> d.checkMatchEmpty(t, "yandex.ru") <mask> d.checkMatchEmpty(t, "api.jquery.com") <mask> <mask> // test cached result </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests </s> remove github.com/AdguardTeam/golibs v0.4.2 </s> add github.com/AdguardTeam/golibs v0.4.3
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/dnsfilter/dnsfilter_test.go
"github.com/AdguardTeam/AdGuardHome/internal/agherr"
<mask> "crypto/sha256" <mask> "strings" <mask> "testing" <mask> <mask> "github.com/AdguardTeam/golibs/cache" <mask> "github.com/miekg/dns" <mask> "github.com/stretchr/testify/assert" <mask> ) <mask> </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/dnsfilter/sb_pc_test.go
"github.com/miekg/dns"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr" <mask> "github.com/AdguardTeam/golibs/cache" <mask> "github.com/stretchr/testify/assert" <mask> ) <mask> <mask> func TestSafeBrowsingHash(t *testing.T) { <mask> // test hostnameToHashes() <mask> hashes := hostnameToHashes("1.2.3.sub.host.com") </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/dnsfilter/sb_pc_test.go
s.conf.ConfigModified = func() {}
<mask> s.conf.UDPListenAddr = &net.UDPAddr{Port: 0} <mask> s.conf.TCPListenAddr = &net.TCPAddr{Port: 0} <mask> s.conf.UpstreamDNS = []string{"8.8.8.8:53", "8.8.4.4:53"} <mask> s.conf.FilteringConfig.ProtectionEnabled = true <mask> err := s.Prepare(nil) <mask> assert.True(t, err == nil) <mask> return s <mask> } <mask> <mask> func createServerTLSConfig(t *testing.T) (*tls.Config, []byte, []byte) { </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests </s> remove Question: &q, Answer: &a, Result: &res, ClientIP: net.ParseIP(client), Upstream: "upstream", </s> add Question: &q, Answer: &a, OrigAnswer: &a, Result: &res, ClientIP: net.ParseIP(client), Upstream: "upstream", </s> remove res := dnsfilter.Result{} </s> add res := dnsfilter.Result{ IsFiltered: true, Rule: "SomeRule", Reason: dnsfilter.ReasonRewrite, ServiceName: "SomeService", FilterID: 1, }
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/dnsforward/dnsforward_test.go
"bytes" "strings"
<mask> <mask> import ( <mask> "testing" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/testutil" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/stretchr/testify/assert" <mask> ) </s> Pull request: cover with tests Merge in DNS/adguard-home from 2271-cover-with-tests to master Updates #2271. Squashed commit of the following: commit db6440efe05171bc15367a2996521848ca348053 Merge: db7fa726b bf4c256c7 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 19:23:09 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit db7fa726bb91b08ec7aaa6c0c818c88b5feb87cd Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 18:26:51 2020 +0300 all: clean dependencies sum commit b8dc6078c4bcc0de1b7e9073832de122f6fe38a4 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:46:00 2020 +0300 testutil: improve code quality commit 001b7194682b1f00aa54dc5a28236faed5a5b02d Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 16:29:49 2020 +0300 testutil: enhance functionality commit f6ccd91a4df6c56778eab8ae50e88e3818b20dd3 Merge: 43fa2eefb 6358240e9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 15:57:37 2020 +0300 Merge branch 'master' into 2271-cover-with-tests commit 43fa2eefbc10ef361603cacc1ca12092b12a057a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 14:55:15 2020 +0300 querylog: replace fake log with real in tests commit b95bee7565a14a02c80c78131b3ced224663dd8a Author: Eugene Burkov <e.burkov@adguard.com> Date: Mon Nov 16 12:38:59 2020 +0300 dnsfilter: replace thoughtless declaration with idiomatic one commit a210b1586092e7ae91a9e67c972fa2d2f6baded6 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 19:00:25 2020 +0300 all: refresh golibs dependencies commit 4ff97bd1ade6c80e274ff5716e44df4eba55bdd9 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 18:38:47 2020 +0300 all: remove std log commit 542dbda10fefce9f46d15489712b163d919b1291 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Nov 13 13:46:39 2020 +0300 querylog: improve test logic and readability commit 796d402385925e8e62a1b4c7bf56e4ceec22418c Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 19:06:42 2020 +0300 all: improve code quality commit e81894c11ef15b0453e8e5297f1349936a32f9dd Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 18:32:30 2020 +0300 all: cover with tests commit 252d81fc8a50a91b02cf0f6f35cc22178a2a4d90 Author: Eugene Burkov <e.burkov@adguard.com> Date: Thu Nov 12 17:32:01 2020 +0300 all: cover with tests
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/8a9c6e8a02c6fd7805a6d6100f9e57b2e6bbca8b
internal/querylog/decode_test.go