docstring_tokens
stringlengths
18
16.9k
code_tokens
stringlengths
75
1.81M
html_url
stringlengths
74
116
file_name
stringlengths
3
311
keep keep keep keep replace keep keep keep keep keep
<mask> showPageSizeOptions={false} <mask> showPageJump={false} <mask> renderTotalPagesCount={() => false} <mask> previousText={ <mask> <svg className="icons icon--small icon--gray w-100 h-100"> <mask> <use xlinkHref="#arrow-left" /> <mask> </svg>} <mask> nextText={ <mask> <svg className="icons icon--small icon--gray w-100 h-100"> <mask> <use xlinkHref="#arrow-right" /> </s> - client: Use the same tooltip style everywhere Close #1866 Squashed commit of the following: commit 3347832caa33b01a0155b212987f02dc4824ab08 Merge: 7766502d d794b11e Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:12:45 2020 +0300 Merge branch 'master' into fix/1866 commit 7766502d4a904ad0a4d240481f7eabf0e25cfb62 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 12:16:59 2020 +0300 Fix icon color classes commit 90191bf74b5eb1855c733c226f7acb4e906c7ad9 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 11:46:22 2020 +0300 Use logs icons, use pointer cursor, fix review markup formatting commit 0ba50fcd956101f5054ce38c2329df3e8abdfcd2 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 18:05:30 2020 +0300 Use help cursor on tooltips commit bf4e14afe69f874d29be73d8cd4cfbe240ca0304 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:41:47 2020 +0300 Use tooltip in logs, rename tooltip classes commit 00568fdc8e8484c5bae67c51ee8189a3a558e219 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:01:49 2020 +0300 - client: Use the same tooltip style everywhere
https://github.com/AdguardTeam/AdGuardHome/commit/7d2c7a61f16ab2d6e0e72caf653b56a7d1881021
client/src/components/Settings/Clients/ClientsTable.js
keep keep keep keep replace keep keep keep keep keep
<mask> <svg className="icons icon--small icon--gray w-100 h-100"> <mask> <use xlinkHref="#arrow-left" /> <mask> </svg>} <mask> nextText={ <mask> <svg className="icons icon--small icon--gray w-100 h-100"> <mask> <use xlinkHref="#arrow-right" /> <mask> </svg>} <mask> loadingText={t('loading_table_status')} <mask> pageText='' <mask> ofText='' </s> - client: Use the same tooltip style everywhere Close #1866 Squashed commit of the following: commit 3347832caa33b01a0155b212987f02dc4824ab08 Merge: 7766502d d794b11e Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:12:45 2020 +0300 Merge branch 'master' into fix/1866 commit 7766502d4a904ad0a4d240481f7eabf0e25cfb62 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 12:16:59 2020 +0300 Fix icon color classes commit 90191bf74b5eb1855c733c226f7acb4e906c7ad9 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 11:46:22 2020 +0300 Use logs icons, use pointer cursor, fix review markup formatting commit 0ba50fcd956101f5054ce38c2329df3e8abdfcd2 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 18:05:30 2020 +0300 Use help cursor on tooltips commit bf4e14afe69f874d29be73d8cd4cfbe240ca0304 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:41:47 2020 +0300 Use tooltip in logs, rename tooltip classes commit 00568fdc8e8484c5bae67c51ee8189a3a558e219 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:01:49 2020 +0300 - client: Use the same tooltip style everywhere
https://github.com/AdguardTeam/AdGuardHome/commit/7d2c7a61f16ab2d6e0e72caf653b56a7d1881021
client/src/components/Settings/Clients/ClientsTable.js
keep keep keep keep replace keep keep keep keep keep
<mask> className="btn btn-link btn-block btn-sm" <mask> onClick={() => fields.push()} <mask> title={buttonTitle} <mask> > <mask> <svg className="icon icon--small"> <mask> <use xlinkHref="#plus" /> <mask> </svg> <mask> </button> <mask> </div> <mask> ); </s> - client: Use the same tooltip style everywhere Close #1866 Squashed commit of the following: commit 3347832caa33b01a0155b212987f02dc4824ab08 Merge: 7766502d d794b11e Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:12:45 2020 +0300 Merge branch 'master' into fix/1866 commit 7766502d4a904ad0a4d240481f7eabf0e25cfb62 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 12:16:59 2020 +0300 Fix icon color classes commit 90191bf74b5eb1855c733c226f7acb4e906c7ad9 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 11:46:22 2020 +0300 Use logs icons, use pointer cursor, fix review markup formatting commit 0ba50fcd956101f5054ce38c2329df3e8abdfcd2 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 18:05:30 2020 +0300 Use help cursor on tooltips commit bf4e14afe69f874d29be73d8cd4cfbe240ca0304 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:41:47 2020 +0300 Use tooltip in logs, rename tooltip classes commit 00568fdc8e8484c5bae67c51ee8189a3a558e219 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:01:49 2020 +0300 - client: Use the same tooltip style everywhere </s> remove <svg className="icon icon--small"> </s> add <svg className="icon icon--24"> </s> remove <svg className="icons icon--small"> </s> add <svg className="icons icon--24"> </s> remove className={`icons icon--small icon--active cursor--pointer ${detailedSelected}`} </s> add className={classNames('icons icon--24 icon--green cursor--pointer', { 'icon--selected': isDetailed, })} </s> remove className="icon icon--small icon-cross d-block d-md-none cursor--pointer" </s> add className="icon icon--24 icon-cross d-block d-md-none cursor--pointer" </s> remove {trackerData && <Popover data={trackerData} />} </s> add {trackerData && <Tooltip content={content} placement="top" className="tooltip-container tooltip-custom--wide"> <svg className="icons icon--24 icon--green ml-1"> <use xlinkHref="#privacy" /> </svg> </Tooltip>} </s> remove className={`icons icon--small icon--active mr-2 cursor--pointer ${plainSelected}`} </s> add className={classNames('icons icon--24 icon--green mr-2 cursor--pointer', { 'icon--selected': !isDetailed, })}
https://github.com/AdguardTeam/AdGuardHome/commit/7d2c7a61f16ab2d6e0e72caf653b56a7d1881021
client/src/components/Settings/Clients/Form.js
keep keep replace keep keep keep keep keep
<mask> .dropdown-item.active, <mask> .dropdown-item:active { <mask> background-color: #66b574; <mask> } <mask> <mask> .dropdown-menu { <mask> cursor: default; <mask> } </s> - client: Use the same tooltip style everywhere Close #1866 Squashed commit of the following: commit 3347832caa33b01a0155b212987f02dc4824ab08 Merge: 7766502d d794b11e Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:12:45 2020 +0300 Merge branch 'master' into fix/1866 commit 7766502d4a904ad0a4d240481f7eabf0e25cfb62 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 12:16:59 2020 +0300 Fix icon color classes commit 90191bf74b5eb1855c733c226f7acb4e906c7ad9 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 11:46:22 2020 +0300 Use logs icons, use pointer cursor, fix review markup formatting commit 0ba50fcd956101f5054ce38c2329df3e8abdfcd2 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 18:05:30 2020 +0300 Use help cursor on tooltips commit bf4e14afe69f874d29be73d8cd4cfbe240ca0304 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:41:47 2020 +0300 Use tooltip in logs, rename tooltip classes commit 00568fdc8e8484c5bae67c51ee8189a3a558e219 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:01:49 2020 +0300 - client: Use the same tooltip style everywhere </s> remove color: #66b574; </s> add color: var(--green-74); </s> remove border-bottom-color: #66b574; </s> add border-bottom-color: var(--green-74); </s> remove .icon--active { color: #66b574; </s> add .icon--lightgray { color: var(--gray-8); </s> remove border-color: #66b574; color: #66b574; </s> add border-color: var(--green-74); color: var(--green-74); </s> remove stroke: #66b574; </s> add stroke: var(--green-74); </s> add .icon--green { color: var(--green-74); }
https://github.com/AdguardTeam/AdGuardHome/commit/7d2c7a61f16ab2d6e0e72caf653b56a7d1881021
client/src/components/ui/Dropdown.css
keep keep keep replace replace replace keep keep replace replace replace keep keep keep
<mask> height: 100%; <mask> } <mask> <mask> .icon--small { <mask> width: 1.5rem; <mask> height: 1.5rem; <mask> } <mask> <mask> .icon--smallest { <mask> width: 1.2rem; <mask> height: 1.2rem; <mask> } <mask> <mask> .icon--gray { </s> - client: Use the same tooltip style everywhere Close #1866 Squashed commit of the following: commit 3347832caa33b01a0155b212987f02dc4824ab08 Merge: 7766502d d794b11e Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:12:45 2020 +0300 Merge branch 'master' into fix/1866 commit 7766502d4a904ad0a4d240481f7eabf0e25cfb62 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 12:16:59 2020 +0300 Fix icon color classes commit 90191bf74b5eb1855c733c226f7acb4e906c7ad9 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 11:46:22 2020 +0300 Use logs icons, use pointer cursor, fix review markup formatting commit 0ba50fcd956101f5054ce38c2329df3e8abdfcd2 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 18:05:30 2020 +0300 Use help cursor on tooltips commit bf4e14afe69f874d29be73d8cd4cfbe240ca0304 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:41:47 2020 +0300 Use tooltip in logs, rename tooltip classes commit 00568fdc8e8484c5bae67c51ee8189a3a558e219 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:01:49 2020 +0300 - client: Use the same tooltip style everywhere </s> remove color: #66b574; </s> add color: var(--green-74); </s> add .icon--green { color: var(--green-74); } </s> remove .icon--light-gray { color: var(--gray-8); } </s> add </s> remove .icon--active { color: #66b574; </s> add .icon--lightgray { color: var(--gray-8); </s> remove background-color: #66b574; </s> add background-color: var(--green-74);
https://github.com/AdguardTeam/AdGuardHome/commit/7d2c7a61f16ab2d6e0e72caf653b56a7d1881021
client/src/components/ui/Icons.css
keep keep keep add keep keep keep keep keep
<mask> .icon--gray { <mask> color: var(--gray-a5); <mask> } <mask> <mask> .icon--disabled { <mask> color: var(--gray-d8); <mask> } <mask> <mask> .icon--lightgray { </s> - client: Use the same tooltip style everywhere Close #1866 Squashed commit of the following: commit 3347832caa33b01a0155b212987f02dc4824ab08 Merge: 7766502d d794b11e Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:12:45 2020 +0300 Merge branch 'master' into fix/1866 commit 7766502d4a904ad0a4d240481f7eabf0e25cfb62 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 12:16:59 2020 +0300 Fix icon color classes commit 90191bf74b5eb1855c733c226f7acb4e906c7ad9 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 11:46:22 2020 +0300 Use logs icons, use pointer cursor, fix review markup formatting commit 0ba50fcd956101f5054ce38c2329df3e8abdfcd2 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 18:05:30 2020 +0300 Use help cursor on tooltips commit bf4e14afe69f874d29be73d8cd4cfbe240ca0304 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:41:47 2020 +0300 Use tooltip in logs, rename tooltip classes commit 00568fdc8e8484c5bae67c51ee8189a3a558e219 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:01:49 2020 +0300 - client: Use the same tooltip style everywhere </s> remove .icon--active { color: #66b574; </s> add .icon--lightgray { color: var(--gray-8); </s> remove .icon--smallest { width: 1.2rem; height: 1.2rem; </s> add .icon--20 { --size: 1.25rem; width: var(--size); height: var(--size); } .icon--18 { --size: 1.125rem; width: var(--size); height: var(--size); </s> remove .icon--light-gray { color: var(--gray-8); } </s> add </s> remove color: #66b574; </s> add color: var(--green-74); </s> remove border-color: #66b574; color: #66b574; </s> add border-color: var(--green-74); color: var(--green-74); </s> remove border-bottom-color: #66b574; </s> add border-bottom-color: var(--green-74);
https://github.com/AdguardTeam/AdGuardHome/commit/7d2c7a61f16ab2d6e0e72caf653b56a7d1881021
client/src/components/ui/Icons.css
keep keep keep keep replace replace keep
<mask> .icon--disabled { <mask> color: var(--gray-d8); <mask> } <mask> <mask> .icon--active { <mask> color: #66b574; <mask> } </s> - client: Use the same tooltip style everywhere Close #1866 Squashed commit of the following: commit 3347832caa33b01a0155b212987f02dc4824ab08 Merge: 7766502d d794b11e Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:12:45 2020 +0300 Merge branch 'master' into fix/1866 commit 7766502d4a904ad0a4d240481f7eabf0e25cfb62 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 12:16:59 2020 +0300 Fix icon color classes commit 90191bf74b5eb1855c733c226f7acb4e906c7ad9 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 11:46:22 2020 +0300 Use logs icons, use pointer cursor, fix review markup formatting commit 0ba50fcd956101f5054ce38c2329df3e8abdfcd2 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 18:05:30 2020 +0300 Use help cursor on tooltips commit bf4e14afe69f874d29be73d8cd4cfbe240ca0304 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:41:47 2020 +0300 Use tooltip in logs, rename tooltip classes commit 00568fdc8e8484c5bae67c51ee8189a3a558e219 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:01:49 2020 +0300 - client: Use the same tooltip style everywhere </s> add .icon--green { color: var(--green-74); } </s> remove color: #66b574; </s> add color: var(--green-74); </s> remove border-color: #66b574; color: #66b574; </s> add border-color: var(--green-74); color: var(--green-74); </s> remove border-bottom-color: #66b574; </s> add border-bottom-color: var(--green-74); </s> remove .icon--light-gray { color: var(--gray-8); } </s> add </s> remove .icon--smallest { width: 1.2rem; height: 1.2rem; </s> add .icon--20 { --size: 1.25rem; width: var(--size); height: var(--size); } .icon--18 { --size: 1.125rem; width: var(--size); height: var(--size);
https://github.com/AdguardTeam/AdGuardHome/commit/7d2c7a61f16ab2d6e0e72caf653b56a7d1881021
client/src/components/ui/Icons.css
keep keep keep add keep keep keep keep keep
<mask> --red: #cd201f; <mask> --orange: #fd9644; <mask> --yellow: #f1c40f; <mask> --green: #5eba00; <mask> --teal: #2bcbba; <mask> --cyan: #17a2b8; <mask> --white: #fff; <mask> --gray: #868e96; <mask> --gray-ac: #9aa0ac; </s> - client: Use the same tooltip style everywhere Close #1866 Squashed commit of the following: commit 3347832caa33b01a0155b212987f02dc4824ab08 Merge: 7766502d d794b11e Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:12:45 2020 +0300 Merge branch 'master' into fix/1866 commit 7766502d4a904ad0a4d240481f7eabf0e25cfb62 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 12:16:59 2020 +0300 Fix icon color classes commit 90191bf74b5eb1855c733c226f7acb4e906c7ad9 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 11:46:22 2020 +0300 Use logs icons, use pointer cursor, fix review markup formatting commit 0ba50fcd956101f5054ce38c2329df3e8abdfcd2 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 18:05:30 2020 +0300 Use help cursor on tooltips commit bf4e14afe69f874d29be73d8cd4cfbe240ca0304 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:41:47 2020 +0300 Use tooltip in logs, rename tooltip classes commit 00568fdc8e8484c5bae67c51ee8189a3a558e219 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:01:49 2020 +0300 - client: Use the same tooltip style everywhere </s> add --gray-ac: #9aa0ac; </s> remove color: #66b574; </s> add color: var(--green-74); </s> remove border-bottom-color: #66b574; </s> add border-bottom-color: var(--green-74); </s> remove stroke: #66b574; </s> add stroke: var(--green-74); </s> remove {dnssec_enabled && getHintElement({ </s> add {dnssec_enabled && getIconTooltip({ </s> remove const trackerHint = getHintElement({ </s> add const trackerHint = getIconTooltip({
https://github.com/AdguardTeam/AdGuardHome/commit/7d2c7a61f16ab2d6e0e72caf653b56a7d1881021
client/src/components/ui/Tabler.css
keep keep add keep keep keep keep
<mask> --cyan: #17a2b8; <mask> --white: #fff; <mask> --gray: #868e96; <mask> --gray-dark: #343a40; <mask> --azure: #45aaf2; <mask> --lime: #7bd235; <mask> --primary: #467fcf; </s> - client: Use the same tooltip style everywhere Close #1866 Squashed commit of the following: commit 3347832caa33b01a0155b212987f02dc4824ab08 Merge: 7766502d d794b11e Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:12:45 2020 +0300 Merge branch 'master' into fix/1866 commit 7766502d4a904ad0a4d240481f7eabf0e25cfb62 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 12:16:59 2020 +0300 Fix icon color classes commit 90191bf74b5eb1855c733c226f7acb4e906c7ad9 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 11:46:22 2020 +0300 Use logs icons, use pointer cursor, fix review markup formatting commit 0ba50fcd956101f5054ce38c2329df3e8abdfcd2 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 18:05:30 2020 +0300 Use help cursor on tooltips commit bf4e14afe69f874d29be73d8cd4cfbe240ca0304 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:41:47 2020 +0300 Use tooltip in logs, rename tooltip classes commit 00568fdc8e8484c5bae67c51ee8189a3a558e219 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:01:49 2020 +0300 - client: Use the same tooltip style everywhere </s> add --green-74: #66b574; --green-86: #66b586; </s> remove color: #66b574; </s> add color: var(--green-74); </s> remove border-bottom-color: #66b574; </s> add border-bottom-color: var(--green-74); </s> remove stroke: #66b574; </s> add stroke: var(--green-74); </s> remove {dnssec_enabled && getHintElement({ </s> add {dnssec_enabled && getIconTooltip({ </s> remove const trackerHint = getHintElement({ </s> add const trackerHint = getIconTooltip({
https://github.com/AdguardTeam/AdGuardHome/commit/7d2c7a61f16ab2d6e0e72caf653b56a7d1881021
client/src/components/ui/Tabler.css
keep keep keep keep replace keep keep keep keep keep
<mask> type="button" <mask> className="btn btn-secondary btn-icon btn-icon--green" <mask> onClick={removeField} <mask> > <mask> <svg className="icon icon--small"> <mask> <use xlinkHref="#cross" /> <mask> </svg> <mask> </button> <mask> </span> <mask> } </s> - client: Use the same tooltip style everywhere Close #1866 Squashed commit of the following: commit 3347832caa33b01a0155b212987f02dc4824ab08 Merge: 7766502d d794b11e Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:12:45 2020 +0300 Merge branch 'master' into fix/1866 commit 7766502d4a904ad0a4d240481f7eabf0e25cfb62 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 12:16:59 2020 +0300 Fix icon color classes commit 90191bf74b5eb1855c733c226f7acb4e906c7ad9 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 11:46:22 2020 +0300 Use logs icons, use pointer cursor, fix review markup formatting commit 0ba50fcd956101f5054ce38c2329df3e8abdfcd2 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 18:05:30 2020 +0300 Use help cursor on tooltips commit bf4e14afe69f874d29be73d8cd4cfbe240ca0304 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:41:47 2020 +0300 Use tooltip in logs, rename tooltip classes commit 00568fdc8e8484c5bae67c51ee8189a3a558e219 Author: ArtemBaskal <[email protected]> Date: Thu Jul 16 17:01:49 2020 +0300 - client: Use the same tooltip style everywhere </s> remove <svg className="icon icon--small"> </s> add <svg className="icon icon--24"> </s> remove <svg className="icons icon--small"> </s> add <svg className="icons icon--24"> </s> remove className="icon icon--small icon-cross d-block d-md-none cursor--pointer" </s> add className="icon icon--24 icon-cross d-block d-md-none cursor--pointer" </s> remove <IconTooltip text={tooltip} type='tooltip-custom--logs' /> </s> add <Tooltip content={tooltip} className="tooltip-container"> <svg className="icons icon--20 icon--gray"> <use xlinkHref="#question" /> </svg> </Tooltip> </s> remove <svg className="icons icon--smallest icon--gray" onClick={onClearInputClick}> </s> add <svg className="icons icon--20 icon--gray" onClick={onClearInputClick}> </s> remove className={`icons icon--small icon--active cursor--pointer ${detailedSelected}`} </s> add className={classNames('icons icon--24 icon--green cursor--pointer', { 'icon--selected': isDetailed, })}
https://github.com/AdguardTeam/AdGuardHome/commit/7d2c7a61f16ab2d6e0e72caf653b56a7d1881021
client/src/helpers/form.js
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> import Card from '../ui/Card'; <mask> <mask> const Clients = props => ( <mask> <Card title="Top blocked domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> <mask> <ReactTable <mask> data={map(props.topBlockedDomains, (value, prop) => ( <mask> { ip: prop, domain: value } <mask> ))} <mask> columns={[{ </s> Web UI API -- Give out 24-hour stat instead of last 3 minutes. </s> remove <Card title="Top queried domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top queried domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top clients" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top clients" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="General statistics" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="General statistics" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove timeWindow := time.Minute * 3 </s> add timeWindow := time.Hour * 24 </s> remove summed["stats_period"] = "3 minutes" </s> add summed["stats_period"] = "24 hours" </s> remove <Tooltip text="A number of DNS quieries processed in the last 3 minutes" /> </s> add <Tooltip text="A number of DNS quieries processed in the last 24 hours" />
https://github.com/AdguardTeam/AdGuardHome/commit/7d7360c700b858f8ae8a9763b1199a8ea30078b0
client/src/components/Dashboard/BlockedDomains.js
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> import Card from '../ui/Card'; <mask> <mask> const Clients = props => ( <mask> <Card title="Top clients" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> <mask> <ReactTable <mask> data={map(props.topClients, (value, prop) => ( <mask> { ip: prop, count: value } <mask> ))} <mask> columns={[{ </s> Web UI API -- Give out 24-hour stat instead of last 3 minutes. </s> remove <Card title="Top blocked domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top blocked domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top queried domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top queried domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="General statistics" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="General statistics" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove summed["stats_period"] = "3 minutes" </s> add summed["stats_period"] = "24 hours" </s> remove <Tooltip text="A number of DNS quieries processed in the last 3 minutes" /> </s> add <Tooltip text="A number of DNS quieries processed in the last 24 hours" /> </s> remove gen(&json, "top_clients", clients, false) </s> add gen(&json, "top_clients", clients, true) json.WriteString(" \"stats_period\": \"24 hours\"\n")
https://github.com/AdguardTeam/AdGuardHome/commit/7d7360c700b858f8ae8a9763b1199a8ea30078b0
client/src/components/Dashboard/Clients.js
keep keep keep keep replace keep keep keep keep keep
<mask> import Card from '../ui/Card'; <mask> import Tooltip from '../ui/Tooltip'; <mask> <mask> const Counters = props => ( <mask> <Card title="General statistics" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> <mask> <table className="table card-table"> <mask> <tbody> <mask> <tr> <mask> <td> <mask> DNS Queries </s> Web UI API -- Give out 24-hour stat instead of last 3 minutes. </s> remove <Tooltip text="A number of DNS quieries processed in the last 3 minutes" /> </s> add <Tooltip text="A number of DNS quieries processed in the last 24 hours" /> </s> remove <Card title="Top clients" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top clients" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top queried domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top queried domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top blocked domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top blocked domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove summed["stats_period"] = "3 minutes" </s> add summed["stats_period"] = "24 hours" </s> remove gen(&json, "top_clients", clients, false) </s> add gen(&json, "top_clients", clients, true) json.WriteString(" \"stats_period\": \"24 hours\"\n")
https://github.com/AdguardTeam/AdGuardHome/commit/7d7360c700b858f8ae8a9763b1199a8ea30078b0
client/src/components/Dashboard/Counters.js
keep keep keep keep replace keep keep keep keep keep
<mask> <tbody> <mask> <tr> <mask> <td> <mask> DNS Queries <mask> <Tooltip text="A number of DNS quieries processed in the last 3 minutes" /> <mask> </td> <mask> <td className="text-right"> <mask> <span className="text-muted"> <mask> {props.dnsQueries} <mask> </span> </s> Web UI API -- Give out 24-hour stat instead of last 3 minutes. </s> remove <Card title="General statistics" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="General statistics" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top clients" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top clients" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top queried domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top queried domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top blocked domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top blocked domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove summed["stats_period"] = "3 minutes" </s> add summed["stats_period"] = "24 hours" </s> remove timeWindow := time.Minute * 3 </s> add timeWindow := time.Hour * 24
https://github.com/AdguardTeam/AdGuardHome/commit/7d7360c700b858f8ae8a9763b1199a8ea30078b0
client/src/components/Dashboard/Counters.js
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> import Card from '../ui/Card'; <mask> <mask> const QueriedDomains = props => ( <mask> <Card title="Top queried domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> <mask> <ReactTable <mask> data={map(props.topQueriedDomains, (value, prop) => ( <mask> { ip: prop, count: value } <mask> ))} <mask> columns={[{ </s> Web UI API -- Give out 24-hour stat instead of last 3 minutes. </s> remove <Card title="Top blocked domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top blocked domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top clients" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top clients" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="General statistics" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="General statistics" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove summed["stats_period"] = "3 minutes" </s> add summed["stats_period"] = "24 hours" </s> remove <Tooltip text="A number of DNS quieries processed in the last 3 minutes" /> </s> add <Tooltip text="A number of DNS quieries processed in the last 24 hours" /> </s> remove gen(&json, "top_clients", clients, false) </s> add gen(&json, "top_clients", clients, true) json.WriteString(" \"stats_period\": \"24 hours\"\n")
https://github.com/AdguardTeam/AdGuardHome/commit/7d7360c700b858f8ae8a9763b1199a8ea30078b0
client/src/components/Dashboard/QueriedDomains.js
keep keep keep keep replace keep keep keep keep keep
<mask> // ----- <mask> // stats <mask> // ----- <mask> func handleStats(w http.ResponseWriter, r *http.Request) { <mask> histrical := generateMapFromStats(&statistics.perMinute, 0, 2) <mask> // sum them up <mask> summed := map[string]interface{}{} <mask> for key, values := range histrical { <mask> summedValue := 0.0 <mask> floats, ok := values.([]float64) </s> Web UI API -- Give out 24-hour stat instead of last 3 minutes. </s> remove timeWindow := time.Minute * 3 </s> add timeWindow := time.Hour * 24 </s> remove summed["stats_period"] = "3 minutes" </s> add summed["stats_period"] = "24 hours" </s> remove gen(&json, "top_clients", clients, false) </s> add gen(&json, "top_clients", clients, true) json.WriteString(" \"stats_period\": \"24 hours\"\n") </s> remove <Card title="Top clients" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top clients" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top queried domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top queried domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top blocked domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top blocked domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
https://github.com/AdguardTeam/AdGuardHome/commit/7d7360c700b858f8ae8a9763b1199a8ea30078b0
control.go
keep keep keep keep replace keep keep keep keep keep
<mask> summedValue += v <mask> } <mask> summed[key] = summedValue <mask> } <mask> summed["stats_period"] = "3 minutes" <mask> <mask> json, err := json.Marshal(summed) <mask> if err != nil { <mask> errortext := fmt.Sprintf("Unable to marshal status json: %s", err) <mask> log.Println(errortext) </s> Web UI API -- Give out 24-hour stat instead of last 3 minutes. </s> remove gen(&json, "top_clients", clients, false) </s> add gen(&json, "top_clients", clients, true) json.WriteString(" \"stats_period\": \"24 hours\"\n") </s> remove histrical := generateMapFromStats(&statistics.perMinute, 0, 2) </s> add histrical := generateMapFromStats(&statistics.perHour, 0, 24) </s> remove timeWindow := time.Minute * 3 </s> add timeWindow := time.Hour * 24 </s> remove <Card title="Top clients" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top clients" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top queried domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top queried domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top blocked domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top blocked domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
https://github.com/AdguardTeam/AdGuardHome/commit/7d7360c700b858f8ae8a9763b1199a8ea30078b0
control.go
keep keep keep keep replace keep keep keep keep keep
<mask> domains := map[string]int{} <mask> blocked := map[string]int{} <mask> clients := map[string]int{} <mask> now := time.Now() <mask> timeWindow := time.Minute * 3 <mask> notBefore := now.Add(timeWindow * -1) <mask> <mask> for _, value := range values { <mask> entry, ok := value.(map[string]interface{}) <mask> if !ok { </s> Web UI API -- Give out 24-hour stat instead of last 3 minutes. </s> remove histrical := generateMapFromStats(&statistics.perMinute, 0, 2) </s> add histrical := generateMapFromStats(&statistics.perHour, 0, 24) </s> remove summed["stats_period"] = "3 minutes" </s> add summed["stats_period"] = "24 hours" </s> remove <Card title="Top blocked domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top blocked domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove gen(&json, "top_clients", clients, false) </s> add gen(&json, "top_clients", clients, true) json.WriteString(" \"stats_period\": \"24 hours\"\n") </s> remove <Card title="Top clients" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top clients" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top queried domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top queried domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
https://github.com/AdguardTeam/AdGuardHome/commit/7d7360c700b858f8ae8a9763b1199a8ea30078b0
control.go
keep keep keep keep replace keep keep keep keep keep
<mask> json.WriteByte('\n') <mask> } <mask> gen(&json, "top_queried_domains", domains, true) <mask> gen(&json, "top_blocked_domains", blocked, true) <mask> gen(&json, "top_clients", clients, false) <mask> json.WriteString("}\n") <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> _, err = w.Write(json.Bytes()) <mask> if err != nil { </s> Web UI API -- Give out 24-hour stat instead of last 3 minutes. </s> remove summed["stats_period"] = "3 minutes" </s> add summed["stats_period"] = "24 hours" </s> remove timeWindow := time.Minute * 3 </s> add timeWindow := time.Hour * 24 </s> remove <Card title="Top clients" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top clients" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top queried domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top queried domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove <Card title="Top blocked domains" subtitle="in the last 3 minutes" bodyType="card-table" refresh={props.refreshButton}> </s> add <Card title="Top blocked domains" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}> </s> remove histrical := generateMapFromStats(&statistics.perMinute, 0, 2) </s> add histrical := generateMapFromStats(&statistics.perHour, 0, 24)
https://github.com/AdguardTeam/AdGuardHome/commit/7d7360c700b858f8ae8a9763b1199a8ea30078b0
control.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> handleClickOutside = () => { <mask> this.props.closeMenu(); <mask> }; <mask> <mask> toggleMenu = () => { <mask> this.props.toggleMenuOpen(); <mask> }; <mask> <mask> getActiveClassForDropdown = (URLS) => { <mask> const { pathname } = this.props.location; <mask> const isActivePage = Object.values(URLS).some(item => item === pathname); </s> - client: fix closing mobile menu </s> remove toggleMenuOpen: PropTypes.func, </s> add </s> remove onClick={this.toggleMenu} </s> add onClick={this.closeMenu} </s> remove toggleMenuOpen={this.toggleMenuOpen} </s> add </s> remove onClick={this.toggleMenu} </s> add onClick={this.closeMenu}
https://github.com/AdguardTeam/AdGuardHome/commit/7e2ef010399c0a308131c14beca1f35eb9e331fd
client/src/components/Header/Menu.js
keep keep keep keep replace keep keep keep keep keep
<mask> to={route} <mask> key={route} <mask> exact={exact || false} <mask> className={`order-${order} ${className}`} <mask> onClick={this.toggleMenu} <mask> > <mask> {icon && ( <mask> <svg className="nav-icon"> <mask> <use xlinkHref={`#${icon}`} /> <mask> </svg> </s> - client: fix closing mobile menu </s> remove onClick={this.toggleMenu} </s> add onClick={this.closeMenu} </s> remove toggleMenuOpen={this.toggleMenuOpen} </s> add </s> remove toggleMenuOpen: PropTypes.func, </s> add </s> remove toggleMenu = () => { this.props.toggleMenuOpen(); </s> add closeMenu = () => { this.props.closeMenu();
https://github.com/AdguardTeam/AdGuardHome/commit/7e2ef010399c0a308131c14beca1f35eb9e331fd
client/src/components/Header/Menu.js
keep keep keep keep replace keep keep keep keep keep
<mask> {MENU_ITEMS.map(item => ( <mask> <li <mask> className={`nav-item order-${item.order}`} <mask> key={item.text} <mask> onClick={this.toggleMenu} <mask> > <mask> {this.getNavLink({ ...item, className: 'nav-link' })} <mask> </li> <mask> ))} <mask> {this.getDropdown({ </s> - client: fix closing mobile menu </s> remove onClick={this.toggleMenu} </s> add onClick={this.closeMenu} </s> remove toggleMenu = () => { this.props.toggleMenuOpen(); </s> add closeMenu = () => { this.props.closeMenu(); </s> remove toggleMenuOpen={this.toggleMenuOpen} </s> add </s> remove toggleMenuOpen: PropTypes.func, </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/7e2ef010399c0a308131c14beca1f35eb9e331fd
client/src/components/Header/Menu.js
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> Menu.propTypes = { <mask> isMenuOpen: PropTypes.bool, <mask> closeMenu: PropTypes.func, <mask> toggleMenuOpen: PropTypes.func, <mask> location: PropTypes.object, <mask> t: PropTypes.func, <mask> }; <mask> <mask> export default withNamespaces()(enhanceWithClickOutside(Menu)); </s> - client: fix closing mobile menu </s> remove toggleMenu = () => { this.props.toggleMenuOpen(); </s> add closeMenu = () => { this.props.closeMenu(); </s> remove toggleMenuOpen={this.toggleMenuOpen} </s> add </s> remove onClick={this.toggleMenu} </s> add onClick={this.closeMenu} </s> remove onClick={this.toggleMenu} </s> add onClick={this.closeMenu}
https://github.com/AdguardTeam/AdGuardHome/commit/7e2ef010399c0a308131c14beca1f35eb9e331fd
client/src/components/Header/Menu.js
keep keep keep keep replace keep keep keep keep keep
<mask> </div> <mask> <Menu <mask> location={location} <mask> isMenuOpen={isMenuOpen} <mask> toggleMenuOpen={this.toggleMenuOpen} <mask> closeMenu={this.closeMenu} <mask> /> <mask> <div className="header__column"> <mask> <div className="header__right"> <mask> {!dashboard.processingProfile && dashboard.name && </s> - client: fix closing mobile menu </s> remove onClick={this.toggleMenu} </s> add onClick={this.closeMenu} </s> remove toggleMenuOpen: PropTypes.func, </s> add </s> remove onClick={this.toggleMenu} </s> add onClick={this.closeMenu} </s> remove toggleMenu = () => { this.props.toggleMenuOpen(); </s> add closeMenu = () => { this.props.closeMenu();
https://github.com/AdguardTeam/AdGuardHome/commit/7e2ef010399c0a308131c14beca1f35eb9e331fd
client/src/components/Header/index.js
keep keep add keep keep keep keep keep
<mask> return now <= (tokenDate + glTokenTimeoutSeconds) <mask> } <mask> <mask> func archIsLittleEndian() bool { <mask> var i int32 = 0x01020304 <mask> u := unsafe.Pointer(&i) <mask> pb := (*byte)(u) <mask> b := *pb </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> add var order binary.ByteOrder = binary.BigEndian </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove // IsOpenWRT returns true if host OS is OpenWRT. func IsOpenWRT() bool { </s> add // IsOpenWrt returns true if host OS is OpenWrt. func IsOpenWrt() bool { </s> remove _ip, ok := c["ip"] </s> add var ipVal interface{} ipVal, ok = c["ip"] </s> remove st, err := os.Stat(filepath.Join(dir, "data", "filters", "1.txt")) if err == nil && st.Size() != 0 { </s> add var fi os.FileInfo fi, err = os.Stat(filepath.Join(dir, "data", "filters", "1.txt")) if err == nil && fi.Size() != 0 { </s> remove dhcpv4 := map[string]interface{}{} val, ok := dhcp["gateway_ip"].(string) </s> add var str string str, ok = dhcp["gateway_ip"].(string)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/authglinet.go
keep add keep keep keep keep
<mask> buf := bytes.NewBuffer(bs) <mask> <mask> if archIsLittleEndian() { <mask> order = binary.LittleEndian <mask> } <mask> </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> add err = binary.Read(buf, order, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add // TODO(a.garipov): Replace with a smaller version of // https://github.com/josharian/native. </s> remove dnsEncryption := getDNSEncryption() if dnsEncryption.https != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.https) </s> add de := getDNSEncryption() if de.https != "" { dnsAddresses = append(dnsAddresses, de.https) </s> remove if dnsEncryption.tls != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.tls) </s> add if de.tls != "" { dnsAddresses = append(dnsAddresses, de.tls) </s> remove if workDir, err := filepath.EvalSymlinks(Context.workDir); err == nil { Context.workDir = workDir </s> add workDir, err := filepath.EvalSymlinks(Context.workDir) if err != nil { panic(err)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/authglinet.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep keep keep
<mask> } <mask> buf := bytes.NewBuffer(bs) <mask> <mask> if archIsLittleEndian() { <mask> err := binary.Read(buf, binary.LittleEndian, &dateToken) <mask> if err != nil { <mask> log.Error("binary.Read: %s", err) <mask> return 0 <mask> } <mask> } else { <mask> err := binary.Read(buf, binary.BigEndian, &dateToken) <mask> if err != nil { <mask> log.Error("binary.Read: %s", err) <mask> return 0 <mask> } <mask> } <mask> return dateToken <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> add err = binary.Read(buf, order, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> remove if e != nil { return nil, e </s> add if err != nil { return nil, err </s> remove if err := tmpFile.Close(); err != nil { log.Printf("Couldn't close temporary file: %s", err) </s> add if derr = tmpFile.Close(); derr != nil { log.Printf("Couldn't close temporary file: %s", derr) </s> remove resp, err := Context.client.Get(filter.URL) if resp != nil && resp.Body != nil { defer resp.Body.Close() } </s> add var resp *http.Response resp, err = Context.client.Get(filter.URL) </s> remove if err := os.Remove(tmpFileName); err != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, err) </s> add if derr = os.Remove(tmpFileName); derr != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, derr) </s> remove code, err := runInitdCommand("status") if err != nil { return service.StatusStopped, nil } if code != 0 { </s> add var code int code, err = runInitdCommand("status") if err != nil || code != 0 {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/authglinet.go
keep keep add keep keep
<mask> if archIsLittleEndian() { <mask> order = binary.LittleEndian <mask> } <mask> return dateToken <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> add var order binary.ByteOrder = binary.BigEndian </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove if err == nil { err = eff() </s> add if ferr == nil { ferr = eff() </s> remove return err </s> add return ferr </s> remove if dnsEncryption.quic != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.quic) </s> add if de.quic != "" { dnsAddresses = append(dnsAddresses, de.quic) </s> remove f = func() error { var err error </s> add f = func() (ferr error) {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/authglinet.go
keep keep keep keep replace keep keep keep keep keep
<mask> if !ok { <mask> return agherr.Error("client not found") <mask> } <mask> <mask> // check Name index <mask> if prev.Name != c.Name { <mask> _, ok = clients.list[c.Name] <mask> if ok { <mask> return agherr.Error("client already exists") <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove // check IP index </s> add // Second, check the IP index. </s> remove c2, ok := clients.idIndex[id] if ok && c2 != prev { return fmt.Errorf("another client uses the same ID (%q): %q", id, c2.Name) </s> add c2, ok2 := clients.idIndex[id] if ok2 && c2 != prev { return fmt.Errorf("another client uses the same id (%q): %q", id, c2.Name) </s> remove mac, ok := _mac.(string) </s> add var mac string mac, ok = macVal.(string) </s> remove log.Fatalf("client.mac is not a string: %v", _mac) </s> add log.Fatalf("client.mac is not a string: %v", macVal) </s> remove log.Fatalf("client.ip is not a string: %v", _ip) </s> add log.Fatalf("client.ip is not a string: %v", ipVal) </s> remove ip, ok := _ip.(string) </s> add var ip string ip, ok = ipVal.(string)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/clients.go
keep keep replace keep keep replace replace replace keep keep keep keep
<mask> } <mask> <mask> // check IP index <mask> if !equalStringSlices(prev.IDs, c.IDs) { <mask> for _, id := range c.IDs { <mask> c2, ok := clients.idIndex[id] <mask> if ok && c2 != prev { <mask> return fmt.Errorf("another client uses the same ID (%q): %q", id, c2.Name) <mask> } <mask> } <mask> <mask> // update ID index </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove // check Name index </s> add // First, check the name index. </s> remove f := dnsfilter.Filter{ </s> add f = dnsfilter.Filter{ </s> remove f := dnsfilter.Filter{ </s> add f = dnsfilter.Filter{ </s> remove _, ipnet, err := net.ParseCIDR(ipnetStr) </s> add var ipnet *net.IPNet _, ipnet, err = net.ParseCIDR(ipnetStr) </s> remove _, err := runInitdCommand("enable") </s> add _, err = runInitdCommand("enable")
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/clients.go
keep keep keep replace replace replace keep keep replace replace replace replace replace replace replace replace replace replace replace replace
<mask> f.Flush() <mask> } <mask> <mask> // The Shutdown() method of (*http.Server) needs to be called in a <mask> // separate goroutine, because it waits until all requests are handled <mask> // and will be blocked by it's own caller. <mask> if restartHTTP { <mask> ctx, cancel := context.WithTimeout(context.Background(), shutdownTimeout) <mask> <mask> shut := func(srv *http.Server) { <mask> defer cancel() <mask> err := srv.Shutdown(ctx) <mask> if err != nil { <mask> log.Debug("error while shutting down HTTP server: %s", err) <mask> } <mask> } <mask> go shut(web.httpServer) <mask> if web.httpServerBeta != nil { <mask> go shut(web.httpServerBeta) <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove shut := func(srv *http.Server) { if srv == nil { return } ctx, cancel := context.WithTimeout(ctx, shutdownTimeout) defer cancel() if err := srv.Shutdown(ctx); err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } </s> add var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, shutdownTimeout) </s> remove ctx, cancel := context.WithTimeout(ctx, shutdownTimeout) err = web.httpsServer.server.Shutdown(ctx) cancel() if err != nil { log.Debug("error while shutting down HTTP server: %s", err) } </s> add var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, shutdownTimeout) shutdownSrv(ctx, cancel, web.httpsServer.server) </s> remove shut(web.httpsServer.server) shut(web.httpServer) shut(web.httpServerBeta) </s> add shutdownSrv(ctx, cancel, web.httpsServer.server) shutdownSrv(ctx, cancel, web.httpServer) shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove err := startDNSServer() if err != nil { </s> add serr := startDNSServer() if serr != nil { </s> remove log.Info("Stopping HTTP server...") </s> add log.Info("stopping http server...")
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/controlinstall.go
keep keep replace replace replace keep replace replace keep
<mask> } <mask> <mask> dnsEncryption := getDNSEncryption() <mask> if dnsEncryption.https != "" { <mask> dnsAddresses = append(dnsAddresses, dnsEncryption.https) <mask> } <mask> if dnsEncryption.tls != "" { <mask> dnsAddresses = append(dnsAddresses, dnsEncryption.tls) <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if dnsEncryption.quic != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.quic) </s> add if de.quic != "" { dnsAddresses = append(dnsAddresses, de.quic) </s> remove certPEM, err := base64.StdEncoding.DecodeString(data.CertificateChain) </s> add var cert []byte cert, err = base64.StdEncoding.DecodeString(data.CertificateChain) </s> remove keyPEM, err := base64.StdEncoding.DecodeString(data.PrivateKey) </s> add var key []byte key, err = base64.StdEncoding.DecodeString(data.PrivateKey) </s> remove data.CertificateChain = string(certPEM) </s> add data.CertificateChain = string(cert) </s> remove data.PrivateKey = string(keyPEM) </s> add data.PrivateKey = string(key)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/dns.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> } <mask> if dnsEncryption.tls != "" { <mask> dnsAddresses = append(dnsAddresses, dnsEncryption.tls) <mask> } <mask> if dnsEncryption.quic != "" { <mask> dnsAddresses = append(dnsAddresses, dnsEncryption.quic) <mask> } <mask> <mask> return dnsAddresses <mask> } <mask> </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if dnsEncryption.tls != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.tls) </s> add if de.tls != "" { dnsAddresses = append(dnsAddresses, de.tls) </s> remove dnsEncryption := getDNSEncryption() if dnsEncryption.https != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.https) </s> add de := getDNSEncryption() if de.https != "" { dnsAddresses = append(dnsAddresses, de.https) </s> remove certPEM, err := base64.StdEncoding.DecodeString(data.CertificateChain) </s> add var cert []byte cert, err = base64.StdEncoding.DecodeString(data.CertificateChain) </s> remove keyPEM, err := base64.StdEncoding.DecodeString(data.PrivateKey) </s> add var key []byte key, err = base64.StdEncoding.DecodeString(data.PrivateKey) </s> remove data.PrivateKey = string(keyPEM) </s> add data.PrivateKey = string(key) </s> remove data.CertificateChain = string(certPEM) </s> add data.CertificateChain = string(cert)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/dns.go
keep add keep keep keep keep keep keep
<mask> } <mask> defer func() { <mask> if tmpFile != nil { <mask> if derr = tmpFile.Close(); derr != nil { <mask> log.Printf("Couldn't close temporary file: %s", derr) <mask> } <mask> <mask> tmpFileName := tmpFile.Name() </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if err := tmpFile.Close(); err != nil { log.Printf("Couldn't close temporary file: %s", err) </s> add if derr = tmpFile.Close(); derr != nil { log.Printf("Couldn't close temporary file: %s", derr) </s> remove if err := os.Remove(tmpFileName); err != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, err) </s> add if derr = os.Remove(tmpFileName); derr != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, derr) </s> remove resp, err := Context.client.Get(filter.URL) if resp != nil && resp.Body != nil { defer resp.Body.Close() } </s> add var resp *http.Response resp, err = Context.client.Get(filter.URL) </s> remove f = func() error { var err error </s> add f = func() (ferr error) { </s> remove log.Fatal(err) </s> add log.Fatal(serr) </s> remove log.Printf("cannot remove %s", launchdStdoutPath) </s> add log.Printf("removing stdout file: %s", err)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/filter.go
keep keep keep replace replace keep keep replace replace keep
<mask> } <mask> defer func() { <mask> if tmpFile != nil { <mask> if err := tmpFile.Close(); err != nil { <mask> log.Printf("Couldn't close temporary file: %s", err) <mask> } <mask> tmpFileName := tmpFile.Name() <mask> if err := os.Remove(tmpFileName); err != nil { <mask> log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, err) <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> add var derr error </s> remove resp, err := Context.client.Get(filter.URL) if resp != nil && resp.Body != nil { defer resp.Body.Close() } </s> add var resp *http.Response resp, err = Context.client.Get(filter.URL) </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove log.Printf("cannot remove %s", launchdStdoutPath) </s> add log.Printf("removing stdout file: %s", err) </s> add defer resp.Body.Close()
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/filter.go
keep keep keep keep replace keep keep keep keep keep
<mask> }() <mask> <mask> var reader io.Reader <mask> if filepath.IsAbs(filter.URL) { <mask> f, err := os.Open(filter.URL) <mask> if err != nil { <mask> return updated, fmt.Errorf("open file: %w", err) <mask> } <mask> defer f.Close() <mask> reader = f </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove resp, err := Context.client.Get(filter.URL) if resp != nil && resp.Body != nil { defer resp.Body.Close() } </s> add var resp *http.Response resp, err = Context.client.Get(filter.URL) </s> remove if err := tmpFile.Close(); err != nil { log.Printf("Couldn't close temporary file: %s", err) </s> add if derr = tmpFile.Close(); derr != nil { log.Printf("Couldn't close temporary file: %s", derr) </s> remove f = func() error { var err error </s> add f = func() (ferr error) { </s> add var derr error </s> remove certPEM, err := base64.StdEncoding.DecodeString(data.CertificateChain) </s> add var cert []byte cert, err = base64.StdEncoding.DecodeString(data.CertificateChain) </s> remove err = prevf() </s> add ferr = prevf()
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/filter.go
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> } <mask> defer f.Close() <mask> reader = f <mask> } else { <mask> resp, err := Context.client.Get(filter.URL) <mask> if resp != nil && resp.Body != nil { <mask> defer resp.Body.Close() <mask> } <mask> if err != nil { <mask> log.Printf("Couldn't request filter from URL %s, skipping: %s", filter.URL, err) <mask> return updated, err <mask> } <mask> </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> add defer resp.Body.Close() </s> remove f, err := os.Open(filter.URL) </s> add var f io.ReadCloser f, err = os.Open(filter.URL) </s> remove if err := tmpFile.Close(); err != nil { log.Printf("Couldn't close temporary file: %s", err) </s> add if derr = tmpFile.Close(); derr != nil { log.Printf("Couldn't close temporary file: %s", derr) </s> add var derr error </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove if err := os.Remove(tmpFileName); err != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, err) </s> add if derr = os.Remove(tmpFileName); derr != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, derr)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/filter.go
keep keep keep add keep keep keep keep keep
<mask> if err != nil { <mask> log.Printf("Couldn't request filter from URL %s, skipping: %s", filter.URL, err) <mask> return updated, err <mask> } <mask> <mask> if resp.StatusCode != http.StatusOK { <mask> log.Printf("Got status code %d from URL %s, skipping", resp.StatusCode, filter.URL) <mask> return updated, fmt.Errorf("got status code != 200: %d", resp.StatusCode) <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove resp, err := Context.client.Get(filter.URL) if resp != nil && resp.Body != nil { defer resp.Body.Close() } </s> add var resp *http.Response resp, err = Context.client.Get(filter.URL) </s> remove if err := tmpFile.Close(); err != nil { log.Printf("Couldn't close temporary file: %s", err) </s> add if derr = tmpFile.Close(); derr != nil { log.Printf("Couldn't close temporary file: %s", derr) </s> remove code, err := runInitdCommand("status") if err != nil { return service.StatusStopped, nil } if code != 0 { </s> add var code int code, err = runInitdCommand("status") if err != nil || code != 0 { </s> remove if err := os.Remove(tmpFileName); err != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, err) </s> add if derr = os.Remove(tmpFileName); derr != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, derr) </s> remove f, err := os.Open(filter.URL) </s> add var f io.ReadCloser f, err = os.Open(filter.URL) </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/filter.go
keep keep keep keep replace keep keep keep keep keep
<mask> for _, filter := range config.Filters { <mask> if !filter.Enabled { <mask> continue <mask> } <mask> f := dnsfilter.Filter{ <mask> ID: filter.ID, <mask> FilePath: filter.Path(), <mask> } <mask> filters = append(filters, f) <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove f := dnsfilter.Filter{ </s> add f = dnsfilter.Filter{ </s> remove con, err := dialer.DialContext(ctx, network, addr) </s> add conn, err = dialer.DialContext(ctx, network, addr) </s> remove _, ipnet, err := net.ParseCIDR(ipnetStr) </s> add var ipnet *net.IPNet _, ipnet, err = net.ParseCIDR(ipnetStr) </s> remove c2, ok := clients.idIndex[id] if ok && c2 != prev { return fmt.Errorf("another client uses the same ID (%q): %q", id, c2.Name) </s> add c2, ok2 := clients.idIndex[id] if ok2 && c2 != prev { return fmt.Errorf("another client uses the same id (%q): %q", id, c2.Name) </s> remove resp, err := Context.client.Get(filter.URL) if resp != nil && resp.Body != nil { defer resp.Body.Close() } </s> add var resp *http.Response resp, err = Context.client.Get(filter.URL) </s> remove f = func() error { var err error </s> add f = func() (ferr error) {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/filter.go
keep keep keep keep replace keep keep keep keep keep
<mask> for _, filter := range config.WhitelistFilters { <mask> if !filter.Enabled { <mask> continue <mask> } <mask> f := dnsfilter.Filter{ <mask> ID: filter.ID, <mask> FilePath: filter.Path(), <mask> } <mask> whiteFilters = append(whiteFilters, f) <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove f := dnsfilter.Filter{ </s> add f = dnsfilter.Filter{ </s> remove con, err := dialer.DialContext(ctx, network, addr) </s> add conn, err = dialer.DialContext(ctx, network, addr) </s> remove _, ipnet, err := net.ParseCIDR(ipnetStr) </s> add var ipnet *net.IPNet _, ipnet, err = net.ParseCIDR(ipnetStr) </s> remove c2, ok := clients.idIndex[id] if ok && c2 != prev { return fmt.Errorf("another client uses the same ID (%q): %q", id, c2.Name) </s> add c2, ok2 := clients.idIndex[id] if ok2 && c2 != prev { return fmt.Errorf("another client uses the same id (%q): %q", id, c2.Name) </s> remove resp, err := Context.client.Get(filter.URL) if resp != nil && resp.Body != nil { defer resp.Body.Close() } </s> add var resp *http.Response resp, err = Context.client.Get(filter.URL) </s> remove f = func() error { var err error </s> add f = func() (ferr error) {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/filter.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol) <mask> mux.HandleFunc("/debug/pprof/trace", pprof.Trace) <mask> go func() { <mask> log.Info("pprof: listening on localhost:6060") <mask> err := http.ListenAndServe("localhost:6060", mux) <mask> log.Error("Error while running the pprof server: %s", err) <mask> }() <mask> } <mask> } <mask> <mask> err := os.MkdirAll(Context.getDataDir(), 0o755) </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove shut := func(srv *http.Server) { defer cancel() err := srv.Shutdown(ctx) if err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } go shut(web.httpServer) if web.httpServerBeta != nil { go shut(web.httpServerBeta) } </s> add go shutdownSrv(ctx, cancel, web.httpServer) go shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove err := startDNSServer() if err != nil { </s> add serr := startDNSServer() if serr != nil { </s> remove log.Fatal(err) </s> add log.Fatal(serr) </s> remove shut := func(srv *http.Server) { if srv == nil { return } ctx, cancel := context.WithTimeout(ctx, shutdownTimeout) defer cancel() if err := srv.Shutdown(ctx); err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } </s> add var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, shutdownTimeout) </s> remove shut(web.httpsServer.server) shut(web.httpServer) shut(web.httpServerBeta) </s> add shutdownSrv(ctx, cancel, web.httpsServer.server) shutdownSrv(ctx, cancel, web.httpServer) shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove if err := os.Remove(tmpFileName); err != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, err) </s> add if derr = os.Remove(tmpFileName); derr != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, derr)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep keep keep keep replace keep keep keep keep keep
<mask> log.Fatal(err) <mask> } <mask> <mask> if !Context.firstRun { <mask> err := initDNSServer() <mask> if err != nil { <mask> log.Fatalf("%s", err) <mask> } <mask> Context.tls.Start() <mask> Context.autoHosts.Start() </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove err := startDNSServer() if err != nil { </s> add serr := startDNSServer() if serr != nil { </s> remove log.Fatal(err) </s> add log.Fatal(serr) </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() { </s> remove if err := tmpFile.Close(); err != nil { log.Printf("Couldn't close temporary file: %s", err) </s> add if derr = tmpFile.Close(); derr != nil { log.Printf("Couldn't close temporary file: %s", derr) </s> remove if err := os.Remove(tmpFileName); err != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, err) </s> add if derr = os.Remove(tmpFileName); derr != nil { log.Printf("Couldn't delete temporary file %s: %s", tmpFileName, derr)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep keep keep keep replace replace keep replace keep keep keep
<mask> Context.tls.Start() <mask> Context.autoHosts.Start() <mask> <mask> go func() { <mask> err := startDNSServer() <mask> if err != nil { <mask> closeDNSServer() <mask> log.Fatal(err) <mask> } <mask> }() <mask> </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove err := initDNSServer() </s> add err = initDNSServer() </s> remove f = func() error { var err error </s> add f = func() (ferr error) { </s> remove shut := func(srv *http.Server) { defer cancel() err := srv.Shutdown(ctx) if err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } go shut(web.httpServer) if web.httpServerBeta != nil { go shut(web.httpServerBeta) } </s> add go shutdownSrv(ctx, cancel, web.httpServer) go shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove err := http.ListenAndServe("localhost:6060", mux) log.Error("Error while running the pprof server: %s", err) </s> add lerr := http.ListenAndServe("localhost:6060", mux) log.Error("Error while running the pprof server: %s", lerr) </s> add var derr error
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> log.Info("AdGuard Home can bind to port 53") <mask> return <mask> } <mask> <mask> if opErr, ok := err.(*net.OpError); ok { <mask> if sysErr, ok := opErr.Err.(*os.SyscallError); ok { <mask> if errno, ok := sysErr.Err.(syscall.Errno); ok && errno == syscall.EACCES { <mask> msg := `Permission check failed. <mask> <mask> AdGuard Home is not allowed to bind to privileged ports (for instance, port 53). <mask> Please note, that this is crucial for a server to be able to use privileged ports. <mask> <mask> You have two options: </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove log.Fatal(msg) } } </s> add log.Fatal(msg) </s> remove log.Fatalf("client.mac is not a string: %v", _mac) </s> add log.Fatalf("client.mac is not a string: %v", macVal) </s> remove mac, ok := _mac.(string) </s> add var mac string mac, ok = macVal.(string) </s> remove log.Fatalf("client.ip is not a string: %v", _ip) </s> add log.Fatalf("client.ip is not a string: %v", ipVal) </s> remove _ip, ok := c["ip"] </s> add var ipVal interface{} ipVal, ok = c["ip"] </s> remove ip, ok := _ip.(string) </s> add var ip string ip, ok = ipVal.(string)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> 1. Run AdGuard Home with root privileges <mask> 2. On Linux you can grant the CAP_NET_BIND_SERVICE capability: <mask> https://github.com/AdguardTeam/AdGuardHome/internal/wiki/Getting-Started#running-without-superuser` <mask> <mask> log.Fatal(msg) <mask> } <mask> } <mask> } <mask> <mask> msg := fmt.Sprintf(`AdGuard failed to bind to port 53 due to %v <mask> <mask> Please note, that this is crucial for a DNS server to be able to use that port.`, err) </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if opErr, ok := err.(*net.OpError); ok { if sysErr, ok := opErr.Err.(*os.SyscallError); ok { if errno, ok := sysErr.Err.(syscall.Errno); ok && errno == syscall.EACCES { msg := `Permission check failed. </s> add if errors.Is(err, os.ErrPermission) { msg := `Permission check failed. </s> remove _, err := runInitdCommand("enable") </s> add _, err = runInitdCommand("enable") </s> remove func customDialContext(ctx context.Context, network, addr string) (net.Conn, error) { </s> add func customDialContext(ctx context.Context, network, addr string) (conn net.Conn, err error) { </s> remove dhcpv4["gateway_ip"] = val </s> add dhcpv4 := map[string]interface{}{ "gateway_ip": str, } </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() { </s> remove if bootstrapDNS, ok := (newDNSConfig)["bootstrap_dns"]; ok { newBootstrapConfig := []string{fmt.Sprint(bootstrapDNS)} (newDNSConfig)["bootstrap_dns"] = newBootstrapConfig (*diskConfig)["dns"] = newDNSConfig } else { </s> add bootstrapDNS, ok := newDNSConfig["bootstrap_dns"] if !ok {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> } else { <mask> Context.workDir = filepath.Dir(execPath) <mask> } <mask> <mask> if workDir, err := filepath.EvalSymlinks(Context.workDir); err == nil { <mask> Context.workDir = workDir <mask> } <mask> } <mask> <mask> // configureLogger configures logger level and output <mask> func configureLogger(args options) { </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> add Context.workDir = workDir </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() { </s> remove if err == nil { err = eff() </s> add if ferr == nil { ferr = eff() </s> remove // Removing log files on cleanup and ignore errors err := os.Remove(launchdStdoutPath) </s> add // Remove log files on cleanup and log errors. err = os.Remove(launchdStdoutPath) </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove dnsEncryption := getDNSEncryption() if dnsEncryption.https != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.https) </s> add de := getDNSEncryption() if de.https != "" { dnsAddresses = append(dnsAddresses, de.https)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep add keep keep keep keep keep
<mask> panic(err) <mask> } <mask> } <mask> <mask> // configureLogger configures logger level and output <mask> func configureLogger(args options) { <mask> ls := getLogSettings() </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if workDir, err := filepath.EvalSymlinks(Context.workDir); err == nil { Context.workDir = workDir </s> add workDir, err := filepath.EvalSymlinks(Context.workDir) if err != nil { panic(err) </s> remove shut := func(srv *http.Server) { defer cancel() err := srv.Shutdown(ctx) if err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } go shut(web.httpServer) if web.httpServerBeta != nil { go shut(web.httpServerBeta) } </s> add go shutdownSrv(ctx, cancel, web.httpServer) go shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove // Removing log files on cleanup and ignore errors err := os.Remove(launchdStdoutPath) </s> add // Remove log files on cleanup and log errors. err = os.Remove(launchdStdoutPath) </s> remove // The Shutdown() method of (*http.Server) needs to be called in a // separate goroutine, because it waits until all requests are handled // and will be blocked by it's own caller. </s> add // Method http.(*Server).Shutdown needs to be called in a separate // goroutine and with its own context, because it waits until all // requests are handled and will be blocked by it's own caller. </s> remove // IsOpenWRT returns true if host OS is OpenWRT. func IsOpenWRT() bool { </s> add // IsOpenWrt returns true if host OS is OpenWrt. func IsOpenWrt() bool { </s> remove log.Printf("cannot remove %s", launchdStdoutPath) </s> add log.Printf("removing stdout file: %s", err)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep keep keep keep replace keep keep keep keep keep
<mask> return errors.Is(err, os.ErrNotExist) <mask> } <mask> <mask> // Connect to a remote server resolving hostname using our own DNS server <mask> func customDialContext(ctx context.Context, network, addr string) (net.Conn, error) { <mask> log.Tracef("network:%v addr:%v", network, addr) <mask> <mask> host, port, err := net.SplitHostPort(addr) <mask> if err != nil { <mask> return nil, err </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove con, err := dialer.DialContext(ctx, network, addr) return con, err </s> add return dialer.DialContext(ctx, network, addr) </s> remove addrs, e := Context.dnsServer.Resolve(host) </s> add addrs, err := Context.dnsServer.Resolve(host) </s> remove con, err := dialer.DialContext(ctx, network, addr) </s> add conn, err = dialer.DialContext(ctx, network, addr) </s> remove if e != nil { return nil, e </s> add if err != nil { return nil, err </s> remove return con, err </s> add return conn, err </s> remove code, err := runInitdCommand("status") if err != nil { return service.StatusStopped, nil } if code != 0 { </s> add var code int code, err = runInitdCommand("status") if err != nil || code != 0 {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep replace replace keep keep replace keep keep
<mask> if net.ParseIP(host) != nil || config.DNS.Port == 0 { <mask> con, err := dialer.DialContext(ctx, network, addr) <mask> return con, err <mask> } <mask> <mask> addrs, e := Context.dnsServer.Resolve(host) <mask> log.Debug("dnsServer.Resolve: %s: %v", host, addrs) <mask> if e != nil { </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if e != nil { return nil, e </s> add if err != nil { return nil, err </s> remove con, err := dialer.DialContext(ctx, network, addr) </s> add conn, err = dialer.DialContext(ctx, network, addr) </s> remove code, err := runInitdCommand("status") if err != nil { return service.StatusStopped, nil } if code != 0 { </s> add var code int code, err = runInitdCommand("status") if err != nil || code != 0 { </s> remove func customDialContext(ctx context.Context, network, addr string) (net.Conn, error) { </s> add func customDialContext(ctx context.Context, network, addr string) (conn net.Conn, err error) { </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> } <mask> <mask> addrs, e := Context.dnsServer.Resolve(host) <mask> log.Debug("dnsServer.Resolve: %s: %v", host, addrs) <mask> if e != nil { <mask> return nil, e <mask> } <mask> <mask> if len(addrs) == 0 { <mask> return nil, fmt.Errorf("couldn't lookup host: %s", host) <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove addrs, e := Context.dnsServer.Resolve(host) </s> add addrs, err := Context.dnsServer.Resolve(host) </s> remove con, err := dialer.DialContext(ctx, network, addr) return con, err </s> add return dialer.DialContext(ctx, network, addr) </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove return con, err </s> add return conn, err </s> remove if err := tmpFile.Close(); err != nil { log.Printf("Couldn't close temporary file: %s", err) </s> add if derr = tmpFile.Close(); derr != nil { log.Printf("Couldn't close temporary file: %s", derr) </s> remove log.Fatalf("client.ip is not a string: %v", _ip) </s> add log.Fatalf("client.ip is not a string: %v", ipVal)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep replace keep keep keep keep replace keep keep
<mask> addr = net.JoinHostPort(a.String(), port) <mask> con, err := dialer.DialContext(ctx, network, addr) <mask> if err != nil { <mask> dialErrs = append(dialErrs, err) <mask> continue <mask> } <mask> return con, err <mask> } <mask> return nil, agherr.Many(fmt.Sprintf("couldn't dial to %s", addr), dialErrs...) </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove addrs, e := Context.dnsServer.Resolve(host) </s> add addrs, err := Context.dnsServer.Resolve(host) </s> remove con, err := dialer.DialContext(ctx, network, addr) return con, err </s> add return dialer.DialContext(ctx, network, addr) </s> remove func customDialContext(ctx context.Context, network, addr string) (net.Conn, error) { </s> add func customDialContext(ctx context.Context, network, addr string) (conn net.Conn, err error) { </s> remove if e != nil { return nil, e </s> add if err != nil { return nil, err </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> haveIP = len(addrs) != 0 <mask> assert.True(t, haveIP) <mask> <mask> for i := 1; ; i++ { <mask> st, err := os.Stat(filepath.Join(dir, "data", "filters", "1.txt")) <mask> if err == nil && st.Size() != 0 { <mask> break <mask> } <mask> if i == 5 { <mask> assert.True(t, false) <mask> break </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if e != nil { return nil, e </s> add if err != nil { return nil, err </s> remove return err </s> add return ferr </s> remove code, err := runInitdCommand("status") if err != nil { return service.StatusStopped, nil } if code != 0 { </s> add var code int code, err = runInitdCommand("status") if err != nil || code != 0 { </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove con, err := dialer.DialContext(ctx, network, addr) return con, err </s> add return dialer.DialContext(ctx, network, addr) </s> remove _, err := runInitdCommand(action) </s> add _, err = runInitdCommand(action)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/home_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> ipd = &ipDetector{ <mask> nets: make([]*net.IPNet, len(specialNetworks)), <mask> } <mask> for i, ipnetStr := range specialNetworks { <mask> _, ipnet, err := net.ParseCIDR(ipnetStr) <mask> if err != nil { <mask> return nil, err <mask> } <mask> <mask> ipd.nets[i] = ipnet </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove con, err := dialer.DialContext(ctx, network, addr) </s> add conn, err = dialer.DialContext(ctx, network, addr) </s> remove f := dnsfilter.Filter{ </s> add f = dnsfilter.Filter{ </s> remove f := dnsfilter.Filter{ </s> add f = dnsfilter.Filter{ </s> remove c2, ok := clients.idIndex[id] if ok && c2 != prev { return fmt.Errorf("another client uses the same ID (%q): %q", id, c2.Name) </s> add c2, ok2 := clients.idIndex[id] if ok2 && c2 != prev { return fmt.Errorf("another client uses the same id (%q): %q", id, c2.Name) </s> remove if e != nil { return nil, e </s> add if err != nil { return nil, err </s> remove // check IP index </s> add // Second, check the IP index.
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/ipdetector.go
keep keep replace replace keep replace keep keep
<mask> if eff != nil { <mask> prevf := f <mask> f = func() error { <mask> var err error <mask> if prevf != nil { <mask> err = prevf() <mask> } <mask> if err == nil { </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if err == nil { err = eff() </s> add if ferr == nil { ferr = eff() </s> add var derr error </s> remove f, err := os.Open(filter.URL) </s> add var f io.ReadCloser f, err = os.Open(filter.URL) </s> remove resp, err := Context.client.Get(filter.URL) if resp != nil && resp.Body != nil { defer resp.Body.Close() } </s> add var resp *http.Response resp, err = Context.client.Get(filter.URL) </s> remove log.Fatal(err) </s> add log.Fatal(serr)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/options.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> var err error <mask> if prevf != nil { <mask> err = prevf() <mask> } <mask> if err == nil { <mask> err = eff() <mask> } <mask> return err <mask> } <mask> } <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove err = prevf() </s> add ferr = prevf() </s> remove f = func() error { var err error </s> add f = func() (ferr error) { </s> remove return err </s> add return ferr </s> add var derr error </s> add err = binary.Read(buf, order, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/options.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> if err == nil { <mask> err = eff() <mask> } <mask> return err <mask> } <mask> } <mask> } <mask> knownParam = true <mask> break </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if err == nil { err = eff() </s> add if ferr == nil { ferr = eff() </s> remove err = prevf() </s> add ferr = prevf() </s> remove f = func() error { var err error </s> add f = func() (ferr error) { </s> remove shut := func(srv *http.Server) { if srv == nil { return } ctx, cancel := context.WithTimeout(ctx, shutdownTimeout) defer cancel() if err := srv.Shutdown(ctx); err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } </s> add var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, shutdownTimeout) </s> remove // IsOpenWRT returns true if host OS is OpenWRT. func IsOpenWRT() bool { </s> add // IsOpenWrt returns true if host OS is OpenWrt. func IsOpenWrt() bool { </s> remove st, err := os.Stat(filepath.Join(dir, "data", "filters", "1.txt")) if err == nil && st.Size() != 0 { </s> add var fi os.FileInfo fi, err = os.Stat(filepath.Join(dir, "data", "filters", "1.txt")) if err == nil && fi.Size() != 0 {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/options.go
keep keep keep replace replace replace replace keep replace replace replace replace replace keep keep keep keep
<mask> return nil <mask> } <mask> <mask> // Check the service's status <mask> // Note: on OpenWrt 'service' utility may not exist - we use our service script directly in this case. <mask> func svcStatus(s service.Service) (service.Status, error) { <mask> status, err := s.Status() <mask> if err != nil && service.Platform() == "unix-systemv" { <mask> code, err := runInitdCommand("status") <mask> if err != nil { <mask> return service.StatusStopped, nil <mask> } <mask> if code != 0 { <mask> return service.StatusStopped, nil <mask> } <mask> return service.StatusRunning, nil <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove // Perform an action on the service // Note: on OpenWrt 'service' utility may not exist - we use our service script directly in this case. func svcAction(s service.Service, action string) error { err := service.Control(s, action) </s> add // svcAction performs the action on the service. // // On OpenWrt, the service utility may not exist. We use our service script // directly in this case. func svcAction(s service.Service, action string) (err error) { err = service.Control(s, action) </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() { </s> remove _, err := runInitdCommand(action) </s> add _, err = runInitdCommand(action) </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove if e != nil { return nil, e </s> add if err != nil { return nil, err
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/service.go
keep keep keep replace replace replace replace keep keep replace keep keep keep keep
<mask> return status, err <mask> } <mask> <mask> // Perform an action on the service <mask> // Note: on OpenWrt 'service' utility may not exist - we use our service script directly in this case. <mask> func svcAction(s service.Service, action string) error { <mask> err := service.Control(s, action) <mask> if err != nil && service.Platform() == "unix-systemv" && <mask> (action == "start" || action == "stop" || action == "restart") { <mask> _, err := runInitdCommand(action) <mask> return err <mask> } <mask> return err <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove // Check the service's status // Note: on OpenWrt 'service' utility may not exist - we use our service script directly in this case. func svcStatus(s service.Service) (service.Status, error) { status, err := s.Status() </s> add // svcStatus check the service's status. // // On OpenWrt, the service utility may not exist. We use our service script // directly in this case. func svcStatus(s service.Service) (status service.Status, err error) { status, err = s.Status() </s> remove code, err := runInitdCommand("status") if err != nil { return service.StatusStopped, nil } if code != 0 { </s> add var code int code, err = runInitdCommand("status") if err != nil || code != 0 { </s> remove _, err := runInitdCommand("enable") </s> add _, err = runInitdCommand("enable") </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() { </s> remove // Removing log files on cleanup and ignore errors err := os.Remove(launchdStdoutPath) </s> add // Remove log files on cleanup and log errors. err = os.Remove(launchdStdoutPath)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> pidfile := fmt.Sprintf("/var/run/%s.pid", serviceName) <mask> data, err := ioutil.ReadFile(pidfile) <mask> if os.IsNotExist(err) { <mask> code, psdata, err := util.RunCommand("ps", "-C", serviceName, "-o", "pid=") <mask> if err != nil || code != 0 { <mask> log.Error("Can't find AdGuardHome process: %s code:%d", err, code) <mask> return <mask> } <mask> data = []byte(psdata) </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove code, err := runInitdCommand("status") if err != nil { return service.StatusStopped, nil } if code != 0 { </s> add var code int code, err = runInitdCommand("status") if err != nil || code != 0 { </s> remove data.CertificateChain = string(certPEM) </s> add data.CertificateChain = string(cert) </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove data.PrivateKey = string(keyPEM) </s> add data.PrivateKey = string(key) </s> remove con, err := dialer.DialContext(ctx, network, addr) return con, err </s> add return dialer.DialContext(ctx, network, addr) </s> remove certPEM, err := base64.StdEncoding.DecodeString(data.CertificateChain) </s> add var cert []byte cert, err = base64.StdEncoding.DecodeString(data.CertificateChain)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/service.go
keep keep keep keep replace keep keep replace
<mask> if err != nil { <mask> log.Fatal(err) <mask> } <mask> <mask> if util.IsOpenWRT() { <mask> // On OpenWrt it is important to run enable after the service installation <mask> // Otherwise, the service won't start on the system startup <mask> _, err := runInitdCommand("enable") </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() { </s> remove // Perform an action on the service // Note: on OpenWrt 'service' utility may not exist - we use our service script directly in this case. func svcAction(s service.Service, action string) error { err := service.Control(s, action) </s> add // svcAction performs the action on the service. // // On OpenWrt, the service utility may not exist. We use our service script // directly in this case. func svcAction(s service.Service, action string) (err error) { err = service.Control(s, action) </s> remove // Check the service's status // Note: on OpenWrt 'service' utility may not exist - we use our service script directly in this case. func svcStatus(s service.Service) (service.Status, error) { status, err := s.Status() </s> add // svcStatus check the service's status. // // On OpenWrt, the service utility may not exist. We use our service script // directly in this case. func svcStatus(s service.Service) (status service.Status, err error) { status, err = s.Status() </s> remove log.Printf("cannot remove %s", launchdStderrPath) </s> add log.Printf("removing stderr file: %s", err) </s> remove // check IP index </s> add // Second, check the IP index.
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> // handleServiceStatusCommand handles service "uninstall" command <mask> func handleServiceUninstallCommand(s service.Service) { <mask> if util.IsOpenWRT() { <mask> // On OpenWrt it is important to run disable command first <mask> // as it will remove the symlink <mask> _, err := runInitdCommand("disable") <mask> if err != nil { <mask> log.Fatal(err) </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() { </s> remove _, err := runInitdCommand("enable") </s> add _, err = runInitdCommand("enable") </s> remove // Check the service's status // Note: on OpenWrt 'service' utility may not exist - we use our service script directly in this case. func svcStatus(s service.Service) (service.Status, error) { status, err := s.Status() </s> add // svcStatus check the service's status. // // On OpenWrt, the service utility may not exist. We use our service script // directly in this case. func svcStatus(s service.Service) (status service.Status, err error) { status, err = s.Status() </s> remove // Perform an action on the service // Note: on OpenWrt 'service' utility may not exist - we use our service script directly in this case. func svcAction(s service.Service, action string) error { err := service.Control(s, action) </s> add // svcAction performs the action on the service. // // On OpenWrt, the service utility may not exist. We use our service script // directly in this case. func svcAction(s service.Service, action string) (err error) { err = service.Control(s, action) </s> remove shut := func(srv *http.Server) { defer cancel() err := srv.Shutdown(ctx) if err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } go shut(web.httpServer) if web.httpServerBeta != nil { go shut(web.httpServerBeta) } </s> add go shutdownSrv(ctx, cancel, web.httpServer) go shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove // The Shutdown() method of (*http.Server) needs to be called in a // separate goroutine, because it waits until all requests are handled // and will be blocked by it's own caller. </s> add // Method http.(*Server).Shutdown needs to be called in a separate // goroutine and with its own context, because it waits until all // requests are handled and will be blocked by it's own caller.
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/service.go
keep keep keep replace replace keep replace
<mask> } <mask> <mask> if runtime.GOOS == "darwin" { <mask> // Removing log files on cleanup and ignore errors <mask> err := os.Remove(launchdStdoutPath) <mask> if err != nil && !os.IsNotExist(err) { <mask> log.Printf("cannot remove %s", launchdStdoutPath) </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove log.Printf("cannot remove %s", launchdStderrPath) </s> add log.Printf("removing stderr file: %s", err) </s> remove if workDir, err := filepath.EvalSymlinks(Context.workDir); err == nil { Context.workDir = workDir </s> add workDir, err := filepath.EvalSymlinks(Context.workDir) if err != nil { panic(err) </s> remove code, err := runInitdCommand("status") if err != nil { return service.StatusStopped, nil } if code != 0 { </s> add var code int code, err = runInitdCommand("status") if err != nil || code != 0 { </s> remove st, err := os.Stat(filepath.Join(dir, "data", "filters", "1.txt")) if err == nil && st.Size() != 0 { </s> add var fi os.FileInfo fi, err = os.Stat(filepath.Join(dir, "data", "filters", "1.txt")) if err == nil && fi.Size() != 0 { </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> log.Printf("cannot remove %s", launchdStdoutPath) <mask> } <mask> err = os.Remove(launchdStderrPath) <mask> if err != nil && !os.IsNotExist(err) { <mask> log.Printf("cannot remove %s", launchdStderrPath) <mask> } <mask> } <mask> } <mask> <mask> // configureService defines additional settings of the service </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove log.Printf("cannot remove %s", launchdStdoutPath) </s> add log.Printf("removing stdout file: %s", err) </s> remove // Removing log files on cleanup and ignore errors err := os.Remove(launchdStdoutPath) </s> add // Remove log files on cleanup and log errors. err = os.Remove(launchdStdoutPath) </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() { </s> remove _, err := runInitdCommand("enable") </s> add _, err = runInitdCommand("enable") </s> remove resp, err := Context.client.Get(filter.URL) if resp != nil && resp.Body != nil { defer resp.Body.Close() } </s> add var resp *http.Response resp, err = Context.client.Get(filter.URL) </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/service.go
keep keep keep keep replace keep keep keep keep keep
<mask> c.Option["SystemdScript"] = systemdScript <mask> c.Option["SysvScript"] = sysvScript <mask> <mask> // On OpenWrt we're using a different type of sysvScript. <mask> if util.IsOpenWRT() { <mask> c.Option["SysvScript"] = openWrtScript <mask> } else if runtime.GOOS == "freebsd" { <mask> c.Option["SysvScript"] = freeBSDScript <mask> } <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove _, err := runInitdCommand("enable") </s> add _, err = runInitdCommand("enable") </s> remove if workDir, err := filepath.EvalSymlinks(Context.workDir); err == nil { Context.workDir = workDir </s> add workDir, err := filepath.EvalSymlinks(Context.workDir) if err != nil { panic(err) </s> remove if err == nil { err = eff() </s> add if ferr == nil { ferr = eff() </s> remove dnsEncryption := getDNSEncryption() if dnsEncryption.https != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.https) </s> add de := getDNSEncryption() if de.https != "" { dnsAddresses = append(dnsAddresses, de.https) </s> remove // Removing log files on cleanup and ignore errors err := os.Remove(launchdStdoutPath) </s> add // Remove log files on cleanup and log errors. err = os.Remove(launchdStdoutPath) </s> remove if bootstrapDNS, ok := (newDNSConfig)["bootstrap_dns"]; ok { newBootstrapConfig := []string{fmt.Sprint(bootstrapDNS)} (newDNSConfig)["bootstrap_dns"] = newBootstrapConfig (*diskConfig)["dns"] = newDNSConfig } else { </s> add bootstrapDNS, ok := newDNSConfig["bootstrap_dns"] if !ok {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/service.go
keep keep replace keep keep keep replace keep keep keep keep
<mask> <mask> if data.CertificateChain != "" { <mask> certPEM, err := base64.StdEncoding.DecodeString(data.CertificateChain) <mask> if err != nil { <mask> return data, fmt.Errorf("failed to base64-decode certificate chain: %w", err) <mask> } <mask> data.CertificateChain = string(certPEM) <mask> if data.CertificatePath != "" { <mask> return data, fmt.Errorf("certificate data and file can't be set together") <mask> } <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove data.PrivateKey = string(keyPEM) </s> add data.PrivateKey = string(key) </s> remove keyPEM, err := base64.StdEncoding.DecodeString(data.PrivateKey) </s> add var key []byte key, err = base64.StdEncoding.DecodeString(data.PrivateKey) </s> remove if dnsEncryption.quic != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.quic) </s> add if de.quic != "" { dnsAddresses = append(dnsAddresses, de.quic) </s> remove dnsEncryption := getDNSEncryption() if dnsEncryption.https != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.https) </s> add de := getDNSEncryption() if de.https != "" { dnsAddresses = append(dnsAddresses, de.https) </s> remove if dnsEncryption.tls != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.tls) </s> add if de.tls != "" { dnsAddresses = append(dnsAddresses, de.tls)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/tls.go
keep keep replace keep keep keep keep replace keep keep
<mask> <mask> if data.PrivateKey != "" { <mask> keyPEM, err := base64.StdEncoding.DecodeString(data.PrivateKey) <mask> if err != nil { <mask> return data, fmt.Errorf("failed to base64-decode private key: %w", err) <mask> } <mask> <mask> data.PrivateKey = string(keyPEM) <mask> if data.PrivateKeyPath != "" { <mask> return data, fmt.Errorf("private key data and file can't be set together") </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove data.CertificateChain = string(certPEM) </s> add data.CertificateChain = string(cert) </s> remove certPEM, err := base64.StdEncoding.DecodeString(data.CertificateChain) </s> add var cert []byte cert, err = base64.StdEncoding.DecodeString(data.CertificateChain) </s> remove if dnsEncryption.quic != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.quic) </s> add if de.quic != "" { dnsAddresses = append(dnsAddresses, de.quic) </s> remove dnsEncryption := getDNSEncryption() if dnsEncryption.https != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.https) </s> add de := getDNSEncryption() if de.https != "" { dnsAddresses = append(dnsAddresses, de.https) </s> remove if dnsEncryption.tls != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.tls) </s> add if de.tls != "" { dnsAddresses = append(dnsAddresses, de.tls)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/tls.go
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
<mask> return fmt.Errorf("dns configuration is not a map") <mask> } <mask> <mask> // Replace bootstrap_dns value filed with new array contains old bootstrap_dns inside <mask> if bootstrapDNS, ok := (newDNSConfig)["bootstrap_dns"]; ok { <mask> newBootstrapConfig := []string{fmt.Sprint(bootstrapDNS)} <mask> (newDNSConfig)["bootstrap_dns"] = newBootstrapConfig <mask> (*diskConfig)["dns"] = newDNSConfig <mask> } else { <mask> return fmt.Errorf("no bootstrap DNS in DNS config") <mask> } <mask> <mask> // Bump schema version <mask> (*diskConfig)["schema_version"] = 3 </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> add newBootstrapConfig := []string{fmt.Sprint(bootstrapDNS)} newDNSConfig["bootstrap_dns"] = newBootstrapConfig (*diskConfig)["dns"] = newDNSConfig </s> add // TODO(a.garipov): Replace with a smaller version of // https://github.com/josharian/native. </s> remove log.Fatalf("client.mac is not a string: %v", _mac) </s> add log.Fatalf("client.mac is not a string: %v", macVal) </s> remove _mac, ok := c["mac"] </s> add var macVal interface{} macVal, ok = c["mac"] </s> remove log.Fatalf("client.ip is not a string: %v", _ip) </s> add log.Fatalf("client.ip is not a string: %v", ipVal) </s> remove mac, ok := _mac.(string) </s> add var mac string mac, ok = macVal.(string)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep add keep keep keep keep keep keep
<mask> } <mask> <mask> // Bump schema version <mask> (*diskConfig)["schema_version"] = 3 <mask> <mask> return nil <mask> } <mask> </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove if bootstrapDNS, ok := (newDNSConfig)["bootstrap_dns"]; ok { newBootstrapConfig := []string{fmt.Sprint(bootstrapDNS)} (newDNSConfig)["bootstrap_dns"] = newBootstrapConfig (*diskConfig)["dns"] = newDNSConfig } else { </s> add bootstrapDNS, ok := newDNSConfig["bootstrap_dns"] if !ok { </s> remove _dhcp, ok := (*diskConfig)["dhcp"] </s> add dhcpVal, ok := (*diskConfig)["dhcp"] </s> add // TODO(a.garipov): Replace with a smaller version of // https://github.com/josharian/native. </s> remove return err </s> add return ferr </s> remove if err == nil { err = eff() </s> add if ferr == nil { ferr = eff() </s> add err = binary.Read(buf, order, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 }
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep replace keep keep replace
<mask> case map[interface{}]interface{}: <mask> _ip, ok := c["ip"] <mask> ids := []string{} <mask> if ok { <mask> ip, ok := _ip.(string) </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove log.Fatalf("client.ip is not a string: %v", _ip) </s> add log.Fatalf("client.ip is not a string: %v", ipVal) </s> remove switch dhcp := _dhcp.(type) { </s> add switch dhcp := dhcpVal.(type) { </s> remove dhcpv4 := map[string]interface{}{} val, ok := dhcp["gateway_ip"].(string) </s> add var str string str, ok = dhcp["gateway_ip"].(string) </s> remove _mac, ok := c["mac"] </s> add var macVal interface{} macVal, ok = c["mac"] </s> remove log.Fatalf("client.mac is not a string: %v", _mac) </s> add log.Fatalf("client.mac is not a string: %v", macVal)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep keep keep keep replace keep keep keep keep keep
<mask> ids := []string{} <mask> if ok { <mask> ip, ok := _ip.(string) <mask> if !ok { <mask> log.Fatalf("client.ip is not a string: %v", _ip) <mask> return nil <mask> } <mask> if len(ip) != 0 { <mask> ids = append(ids, ip) <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove ip, ok := _ip.(string) </s> add var ip string ip, ok = ipVal.(string) </s> remove _ip, ok := c["ip"] </s> add var ipVal interface{} ipVal, ok = c["ip"] </s> remove log.Fatalf("client.mac is not a string: %v", _mac) </s> add log.Fatalf("client.mac is not a string: %v", macVal) </s> remove _mac, ok := c["mac"] </s> add var macVal interface{} macVal, ok = c["mac"] </s> remove mac, ok := _mac.(string) </s> add var mac string mac, ok = macVal.(string) </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep replace keep replace keep keep keep keep
<mask> <mask> _mac, ok := c["mac"] <mask> if ok { <mask> mac, ok := _mac.(string) <mask> if !ok { <mask> log.Fatalf("client.mac is not a string: %v", _mac) <mask> return nil <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove log.Fatalf("client.mac is not a string: %v", _mac) </s> add log.Fatalf("client.mac is not a string: %v", macVal) </s> remove log.Fatalf("client.ip is not a string: %v", _ip) </s> add log.Fatalf("client.ip is not a string: %v", ipVal) </s> remove ip, ok := _ip.(string) </s> add var ip string ip, ok = ipVal.(string) </s> remove _ip, ok := c["ip"] </s> add var ipVal interface{} ipVal, ok = c["ip"] </s> remove if bootstrapDNS, ok := (newDNSConfig)["bootstrap_dns"]; ok { newBootstrapConfig := []string{fmt.Sprint(bootstrapDNS)} (newDNSConfig)["bootstrap_dns"] = newBootstrapConfig (*diskConfig)["dns"] = newDNSConfig } else { </s> add bootstrapDNS, ok := newDNSConfig["bootstrap_dns"] if !ok {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep keep keep keep replace keep keep keep keep keep
<mask> _mac, ok := c["mac"] <mask> if ok { <mask> mac, ok := _mac.(string) <mask> if !ok { <mask> log.Fatalf("client.mac is not a string: %v", _mac) <mask> return nil <mask> } <mask> if len(mac) != 0 { <mask> ids = append(ids, mac) <mask> } </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove mac, ok := _mac.(string) </s> add var mac string mac, ok = macVal.(string) </s> remove _mac, ok := c["mac"] </s> add var macVal interface{} macVal, ok = c["mac"] </s> remove log.Fatalf("client.ip is not a string: %v", _ip) </s> add log.Fatalf("client.ip is not a string: %v", ipVal) </s> remove ip, ok := _ip.(string) </s> add var ip string ip, ok = ipVal.(string) </s> remove _ip, ok := c["ip"] </s> add var ipVal interface{} ipVal, ok = c["ip"] </s> remove if bootstrapDNS, ok := (newDNSConfig)["bootstrap_dns"]; ok { newBootstrapConfig := []string{fmt.Sprint(bootstrapDNS)} (newDNSConfig)["bootstrap_dns"] = newBootstrapConfig (*diskConfig)["dns"] = newDNSConfig } else { </s> add bootstrapDNS, ok := newDNSConfig["bootstrap_dns"] if !ok {
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep replace keep keep keep keep replace
<mask> <mask> _dhcp, ok := (*diskConfig)["dhcp"] <mask> if !ok { <mask> return nil <mask> } <mask> <mask> switch dhcp := _dhcp.(type) { </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove dhcpv4 := map[string]interface{}{} val, ok := dhcp["gateway_ip"].(string) </s> add var str string str, ok = dhcp["gateway_ip"].(string) </s> remove _ip, ok := c["ip"] </s> add var ipVal interface{} ipVal, ok = c["ip"] </s> remove mac, ok := _mac.(string) </s> add var mac string mac, ok = macVal.(string) </s> remove ip, ok := _ip.(string) </s> add var ip string ip, ok = ipVal.(string) </s> remove _mac, ok := c["mac"] </s> add var macVal interface{} macVal, ok = c["mac"]
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep keep keep keep replace replace keep keep keep keep replace keep keep
<mask> } <mask> <mask> switch dhcp := _dhcp.(type) { <mask> case map[interface{}]interface{}: <mask> dhcpv4 := map[string]interface{}{} <mask> val, ok := dhcp["gateway_ip"].(string) <mask> if !ok { <mask> log.Fatalf("expecting dhcp.%s to be a string", "gateway_ip") <mask> return nil <mask> } <mask> dhcpv4["gateway_ip"] = val <mask> delete(dhcp, "gateway_ip") <mask> </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove switch dhcp := _dhcp.(type) { </s> add switch dhcp := dhcpVal.(type) { </s> remove val, ok = dhcp["subnet_mask"].(string) </s> add str, ok = dhcp["subnet_mask"].(string) </s> remove dhcpv4["subnet_mask"] = val </s> add dhcpv4["subnet_mask"] = str </s> remove dhcpv4["range_start"] = val </s> add dhcpv4["range_start"] = str </s> remove dhcpv4["range_end"] = val </s> add dhcpv4["range_end"] = str
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep replace keep keep keep keep replace keep keep keep
<mask> <mask> val, ok = dhcp["subnet_mask"].(string) <mask> if !ok { <mask> log.Fatalf("expecting dhcp.%s to be a string", "subnet_mask") <mask> return nil <mask> } <mask> dhcpv4["subnet_mask"] = val <mask> delete(dhcp, "subnet_mask") <mask> <mask> val, ok = dhcp["range_start"].(string) </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove val, ok = dhcp["range_start"].(string) </s> add str, ok = dhcp["range_start"].(string) </s> remove dhcpv4["gateway_ip"] = val </s> add dhcpv4 := map[string]interface{}{ "gateway_ip": str, } </s> remove dhcpv4["range_start"] = val </s> add dhcpv4["range_start"] = str </s> remove val, ok = dhcp["range_end"].(string) </s> add str, ok = dhcp["range_end"].(string) </s> remove dhcpv4["range_end"] = val </s> add dhcpv4["range_end"] = str
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep replace keep keep keep keep replace
<mask> <mask> val, ok = dhcp["range_start"].(string) <mask> if !ok { <mask> log.Fatalf("expecting dhcp.%s to be a string", "range_start") <mask> return nil <mask> } <mask> dhcpv4["range_start"] = val </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove dhcpv4["subnet_mask"] = val </s> add dhcpv4["subnet_mask"] = str </s> remove val, ok = dhcp["range_end"].(string) </s> add str, ok = dhcp["range_end"].(string) </s> remove dhcpv4["gateway_ip"] = val </s> add dhcpv4 := map[string]interface{}{ "gateway_ip": str, } </s> remove val, ok = dhcp["subnet_mask"].(string) </s> add str, ok = dhcp["subnet_mask"].(string) </s> remove dhcpv4["range_end"] = val </s> add dhcpv4["range_end"] = str
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep keep keep replace keep keep keep keep replace keep keep keep keep
<mask> dhcpv4["range_start"] = val <mask> delete(dhcp, "range_start") <mask> <mask> val, ok = dhcp["range_end"].(string) <mask> if !ok { <mask> log.Fatalf("expecting dhcp.%s to be a string", "range_end") <mask> return nil <mask> } <mask> dhcpv4["range_end"] = val <mask> delete(dhcp, "range_end") <mask> <mask> intVal, ok := dhcp["lease_duration"].(int) <mask> if !ok { </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove dhcpv4["range_start"] = val </s> add dhcpv4["range_start"] = str </s> remove intVal, ok := dhcp["lease_duration"].(int) </s> add var n int n, ok = dhcp["lease_duration"].(int) </s> remove val, ok = dhcp["range_start"].(string) </s> add str, ok = dhcp["range_start"].(string) </s> remove dhcpv4["subnet_mask"] = val </s> add dhcpv4["subnet_mask"] = str </s> remove dhcpv4["gateway_ip"] = val </s> add dhcpv4 := map[string]interface{}{ "gateway_ip": str, }
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep keep keep keep replace keep keep keep keep replace keep
<mask> } <mask> dhcpv4["range_end"] = val <mask> delete(dhcp, "range_end") <mask> <mask> intVal, ok := dhcp["lease_duration"].(int) <mask> if !ok { <mask> log.Fatalf("expecting dhcp.%s to be an integer", "lease_duration") <mask> return nil <mask> } <mask> dhcpv4["lease_duration"] = intVal <mask> delete(dhcp, "lease_duration") </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove dhcpv4["range_end"] = val </s> add dhcpv4["range_end"] = str </s> remove intVal, ok = dhcp["icmp_timeout_msec"].(int) </s> add n, ok = dhcp["icmp_timeout_msec"].(int) </s> remove val, ok = dhcp["range_end"].(string) </s> add str, ok = dhcp["range_end"].(string) </s> remove dhcpv4["icmp_timeout_msec"] = intVal </s> add dhcpv4["icmp_timeout_msec"] = n </s> remove dhcpv4["range_start"] = val </s> add dhcpv4["range_start"] = str
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep keep replace keep keep keep keep replace keep keep keep keep
<mask> delete(dhcp, "lease_duration") <mask> <mask> intVal, ok = dhcp["icmp_timeout_msec"].(int) <mask> if !ok { <mask> log.Fatalf("expecting dhcp.%s to be an integer", "icmp_timeout_msec") <mask> return nil <mask> } <mask> dhcpv4["icmp_timeout_msec"] = intVal <mask> delete(dhcp, "icmp_timeout_msec") <mask> <mask> dhcp["dhcpv4"] = dhcpv4 <mask> </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove dhcpv4["lease_duration"] = intVal </s> add dhcpv4["lease_duration"] = n </s> remove intVal, ok := dhcp["lease_duration"].(int) </s> add var n int n, ok = dhcp["lease_duration"].(int) </s> remove dhcpv4["range_end"] = val </s> add dhcpv4["range_end"] = str </s> remove dhcpv4["gateway_ip"] = val </s> add dhcpv4 := map[string]interface{}{ "gateway_ip": str, } </s> remove dhcpv4["subnet_mask"] = val </s> add dhcpv4["subnet_mask"] = str
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/upgrade.go
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
<mask> } <mask> <mask> web.httpsServer.cond.L.Lock() <mask> if web.httpsServer.server != nil { <mask> ctx, cancel := context.WithTimeout(ctx, shutdownTimeout) <mask> err = web.httpsServer.server.Shutdown(ctx) <mask> cancel() <mask> if err != nil { <mask> log.Debug("error while shutting down HTTP server: %s", err) <mask> } <mask> } <mask> web.httpsServer.enabled = enabled <mask> web.httpsServer.cert = cert <mask> web.httpsServer.cond.Broadcast() <mask> web.httpsServer.cond.L.Unlock() </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove shut := func(srv *http.Server) { if srv == nil { return } ctx, cancel := context.WithTimeout(ctx, shutdownTimeout) defer cancel() if err := srv.Shutdown(ctx); err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } </s> add var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, shutdownTimeout) </s> remove shut := func(srv *http.Server) { defer cancel() err := srv.Shutdown(ctx) if err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } go shut(web.httpServer) if web.httpServerBeta != nil { go shut(web.httpServerBeta) } </s> add go shutdownSrv(ctx, cancel, web.httpServer) go shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove shut(web.httpsServer.server) shut(web.httpServer) shut(web.httpServerBeta) </s> add shutdownSrv(ctx, cancel, web.httpsServer.server) shutdownSrv(ctx, cancel, web.httpServer) shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove log.Info("Stopping HTTP server...") </s> add log.Info("stopping http server...") </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove if err := tmpFile.Close(); err != nil { log.Printf("Couldn't close temporary file: %s", err) </s> add if derr = tmpFile.Close(); derr != nil { log.Printf("Couldn't close temporary file: %s", derr)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/web.go
keep replace keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep
<mask> func (web *Web) Close(ctx context.Context) { <mask> log.Info("Stopping HTTP server...") <mask> web.httpsServer.cond.L.Lock() <mask> web.httpsServer.shutdown = true <mask> web.httpsServer.cond.L.Unlock() <mask> <mask> shut := func(srv *http.Server) { <mask> if srv == nil { <mask> return <mask> } <mask> ctx, cancel := context.WithTimeout(ctx, shutdownTimeout) <mask> defer cancel() <mask> if err := srv.Shutdown(ctx); err != nil { <mask> log.Debug("error while shutting down HTTP server: %s", err) <mask> } <mask> } <mask> <mask> shut(web.httpsServer.server) <mask> shut(web.httpServer) </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove ctx, cancel := context.WithTimeout(ctx, shutdownTimeout) err = web.httpsServer.server.Shutdown(ctx) cancel() if err != nil { log.Debug("error while shutting down HTTP server: %s", err) } </s> add var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, shutdownTimeout) shutdownSrv(ctx, cancel, web.httpsServer.server) </s> remove shut := func(srv *http.Server) { defer cancel() err := srv.Shutdown(ctx) if err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } go shut(web.httpServer) if web.httpServerBeta != nil { go shut(web.httpServerBeta) } </s> add go shutdownSrv(ctx, cancel, web.httpServer) go shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove shut(web.httpsServer.server) shut(web.httpServer) shut(web.httpServerBeta) </s> add shutdownSrv(ctx, cancel, web.httpsServer.server) shutdownSrv(ctx, cancel, web.httpServer) shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove log.Info("Stopped HTTP server") </s> add log.Info("stopped http server") </s> remove if err := tmpFile.Close(); err != nil { log.Printf("Couldn't close temporary file: %s", err) </s> add if derr = tmpFile.Close(); derr != nil { log.Printf("Couldn't close temporary file: %s", derr)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/web.go
keep keep replace replace replace keep replace keep keep keep keep
<mask> } <mask> <mask> shut(web.httpsServer.server) <mask> shut(web.httpServer) <mask> shut(web.httpServerBeta) <mask> <mask> log.Info("Stopped HTTP server") <mask> } <mask> <mask> func (web *Web) tlsServerLoop() { <mask> for { </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove shut := func(srv *http.Server) { defer cancel() err := srv.Shutdown(ctx) if err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } go shut(web.httpServer) if web.httpServerBeta != nil { go shut(web.httpServerBeta) } </s> add go shutdownSrv(ctx, cancel, web.httpServer) go shutdownSrv(ctx, cancel, web.httpServerBeta) </s> remove log.Info("Stopping HTTP server...") </s> add log.Info("stopping http server...") </s> remove shut := func(srv *http.Server) { if srv == nil { return } ctx, cancel := context.WithTimeout(ctx, shutdownTimeout) defer cancel() if err := srv.Shutdown(ctx); err != nil { log.Debug("error while shutting down HTTP server: %s", err) } } </s> add var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, shutdownTimeout) </s> remove f := dnsfilter.Filter{ </s> add f = dnsfilter.Filter{ </s> remove f := dnsfilter.Filter{ </s> add f = dnsfilter.Filter{
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/home/web.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> if len(hostsFn) != 0 { <mask> a.hostsFn = hostsFn <mask> } <mask> <mask> if IsOpenWRT() { <mask> a.hostsDirs = append(a.hostsDirs, "/tmp/hosts") // OpenWRT: "/tmp/hosts/dhcp.cfg01411c" <mask> } <mask> <mask> // Load hosts initially <mask> a.updateHosts() <mask> </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove // IsOpenWRT returns true if host OS is OpenWRT. func IsOpenWRT() bool { </s> add // IsOpenWrt returns true if host OS is OpenWrt. func IsOpenWrt() bool { </s> add err = binary.Read(buf, order, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> remove err := binary.Read(buf, binary.LittleEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } } else { err := binary.Read(buf, binary.BigEndian, &dateToken) if err != nil { log.Error("binary.Read: %s", err) return 0 } </s> add order = binary.LittleEndian </s> remove // check Name index </s> add // First, check the name index. </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() { </s> remove if dnsEncryption.quic != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.quic) </s> add if de.quic != "" { dnsAddresses = append(dnsAddresses, de.quic)
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/util/autohosts.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> } <mask> return strings.TrimSpace(s) <mask> } <mask> <mask> // IsOpenWRT returns true if host OS is OpenWRT. <mask> func IsOpenWRT() bool { <mask> if runtime.GOOS != "linux" { <mask> return false <mask> } <mask> <mask> const etcDir = "/etc" </s> Pull request: home: rm var shadowing, vol. 4 Closes #2803. Squashed commit of the following: commit cb36cc8811160bb39a32fb8eddf962d0ebe9035a Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 14:21:46 2021 +0300 home: imp more commit 9ea7ccec8bb293881cf724d7ad57e6744243d8b9 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:58:10 2021 +0300 all: imp naming, refactor http srv shutdown commit f29221007c16fd3e7230bf2c1ac37b365f3e29aa Merge: 2247c05b bfbf73f3 Author: Ainar Garipov <[email protected]> Date: Fri Mar 12 13:35:17 2021 +0300 Merge branch 'master' into 2803-shadow-4 commit 2247c05b5521346aaf362d81ccdd64fee31f1e6d Author: Ainar Garipov <[email protected]> Date: Fri Jan 29 20:53:21 2021 +0300 home: rm var shadowing, vol. 4 </s> remove return err </s> add return ferr </s> remove if IsOpenWRT() { a.hostsDirs = append(a.hostsDirs, "/tmp/hosts") // OpenWRT: "/tmp/hosts/dhcp.cfg01411c" </s> add if IsOpenWrt() { // OpenWrt: "/tmp/hosts/dhcp.cfg01411c". a.hostsDirs = append(a.hostsDirs, "/tmp/hosts") </s> remove if dnsEncryption.quic != "" { dnsAddresses = append(dnsAddresses, dnsEncryption.quic) </s> add if de.quic != "" { dnsAddresses = append(dnsAddresses, de.quic) </s> remove if util.IsOpenWRT() { </s> add if util.IsOpenWrt() { </s> remove // check Name index </s> add // First, check the name index. </s> remove return con, err </s> add return conn, err
https://github.com/AdguardTeam/AdGuardHome/commit/7e64205d449f7783716f989f0fb635dc80840ee4
internal/util/helpers.go
keep keep keep keep replace keep keep keep keep keep
<mask> script: <mask> - node -v <mask> - npm -v <mask> # Prepare releases <mask> - ./release.sh <mask> - ls -l dist <mask> <mask> deploy: <mask> provider: releases <mask> api_key: $GITHUB_TOKEN </s> *: moved docker files to the packaging folder </s> add docker: docker build -t "$(DOCKER_IMAGE_DEV_NAME)" -f "$(DOCKERFILE)" . @echo Now you can run the docker image: @echo docker run --name "$(DOCKER_IMAGE_DEV_NAME)" -p 53:53/tcp -p 53:53/udp -p 3000:3000/tcp $(DOCKER_IMAGE_DEV_NAME) </s> add DOCKER_IMAGE_DEV_NAME=adguardhome-dev DOCKERFILE=packaging/docker/Dockerfile DOCKERFILE_HUB=packaging/docker/Dockerfile.travis
https://github.com/AdguardTeam/AdGuardHome/commit/7f224658e0b3b0fb4799ffa44a943792d08bce41
.travis.yml
keep keep add keep keep keep keep keep keep
<mask> JSFILES = $(shell find client -path client/node_modules -prune -o -type f -name '*.js') <mask> STATIC = build/static/index.html <mask> CHANNEL ?= release <mask> <mask> TARGET=AdGuardHome <mask> <mask> .PHONY: all build clean <mask> all: build <mask> </s> *: moved docker files to the packaging folder </s> add docker: docker build -t "$(DOCKER_IMAGE_DEV_NAME)" -f "$(DOCKERFILE)" . @echo Now you can run the docker image: @echo docker run --name "$(DOCKER_IMAGE_DEV_NAME)" -p 53:53/tcp -p 53:53/udp -p 3000:3000/tcp $(DOCKER_IMAGE_DEV_NAME) </s> remove - ./release.sh </s> add - ./build_release.sh
https://github.com/AdguardTeam/AdGuardHome/commit/7f224658e0b3b0fb4799ffa44a943792d08bce41
Makefile
keep keep add keep keep keep keep keep
<mask> CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=$(GIT_VERSION) -X main.channel=$(CHANNEL) -X main.goarm=$(GOARM)" -asmflags="-trimpath=$(PWD)" -gcflags="-trimpath=$(PWD)" <mask> PATH=$(GOPATH)/bin:$(PATH) packr clean <mask> <mask> clean: <mask> $(MAKE) cleanfast <mask> rm -rf build <mask> rm -rf client/node_modules <mask> </s> *: moved docker files to the packaging folder </s> add DOCKER_IMAGE_DEV_NAME=adguardhome-dev DOCKERFILE=packaging/docker/Dockerfile DOCKERFILE_HUB=packaging/docker/Dockerfile.travis </s> remove - ./release.sh </s> add - ./build_release.sh
https://github.com/AdguardTeam/AdGuardHome/commit/7f224658e0b3b0fb4799ffa44a943792d08bce41
Makefile
keep keep keep keep replace replace keep keep keep keep keep
<mask> /build/* <mask> /build2/* <mask> /data/ <mask> /dist/ <mask> /dnsfilter/tests/dnsfilter.TestLotsOfRules*.pprof <mask> /dnsfilter/tests/top-1m.csv <mask> /launchpad_credentials <mask> /querylog.json* <mask> /snapcraft_login <mask> AdGuardHome* <mask> coverage.txt </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenAutoHosts) { </s> add } else if res.Reason.In(filtering.Rewritten, filtering.RewrittenAutoHosts) { </s> remove } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> add } else if res.Reason.In(filtering.Rewritten, filtering.RewrittenRule) && </s> remove return nil, fmt.Errorf("dnsfilter failed to check host %q: %w", host, err) </s> add return nil, fmt.Errorf("filtering failed to check host %q: %w", host, err) </s> remove func (s *Server) filterDNSRequest(ctx *dnsContext) (*dnsfilter.Result, error) { </s> add func (s *Server) filterDNSRequest(ctx *dnsContext) (*filtering.Result, error) { </s> remove func (s *Server) getClientRequestFilteringSettings(ctx *dnsContext) *dnsfilter.FilteringSettings { </s> add func (s *Server) getClientRequestFilteringSettings(ctx *dnsContext) *filtering.Settings { </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering"
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
.gitignore
keep keep keep keep replace keep keep keep keep keep
<mask> "scopes": [ <mask> "", <mask> "ui", <mask> "global", <mask> "dnsfilter", <mask> "home", <mask> "dnsforward", <mask> "dhcpd", <mask> "querylog", <mask> "documentation", </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove reason: dnsfilter.FilteredParental, </s> add reason: filtering.FilteredParental, </s> remove reason: dnsfilter.FilteredSafeSearch, </s> add reason: filtering.FilteredSafeSearch, </s> remove reason: dnsfilter.FilteredSafeBrowsing, </s> add reason: filtering.FilteredSafeBrowsing, </s> remove reason: dnsfilter.FilteredBlockList, </s> add reason: filtering.FilteredBlockList, </s> remove reason: dnsfilter.NotFilteredNotFound, </s> add reason: filtering.NotFilteredNotFound, </s> remove Reason: dnsfilter.FilteredBlockList, </s> add Reason: filtering.FilteredBlockList,
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
changelog.config.js
keep keep keep keep replace keep keep keep keep keep
<mask> "os" <mask> "sort" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghstrings" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/ameshkov/dnscrypt/v2" <mask> ) </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering"
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/config.go
keep keep keep keep replace keep keep keep keep keep
<mask> // Callbacks for other modules <mask> // -- <mask> <mask> // FilterHandler is an optional additional filtering callback. <mask> FilterHandler func(clientAddr net.IP, clientID string, settings *dnsfilter.FilteringSettings) `yaml:"-"` <mask> <mask> // GetCustomUpstreamByClient - a callback function that returns upstreams configuration <mask> // based on the client IP address. Returns nil if there are no custom upstreams for the client <mask> // <mask> // TODO(e.burkov): Replace argument type with net.IP. </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove func applyAdditionalFiltering(clientAddr net.IP, clientID string, setts *dnsfilter.FilteringSettings) { </s> add func applyAdditionalFiltering(clientAddr net.IP, clientID string, setts *filtering.Settings) { </s> remove result *dnsfilter.Result </s> add result *filtering.Result </s> remove setts *dnsfilter.FilteringSettings </s> add setts *filtering.Settings </s> remove // On Windows we don't pass files to dnsfilter - we pass the whole data. // . Pass new filters to dnsfilter object - it analyzes new data while the old filters are still active // . dnsfilter activates new filters </s> add // On Windows we don't pass files to filtering - we pass the whole data. // . Pass new filters to filtering object - it analyzes new data while the old filters are still active // . filtering activates new filters </s> remove ProtectionEnabled bool `yaml:"protection_enabled"` // whether or not use any of dnsfilter features </s> add ProtectionEnabled bool `yaml:"protection_enabled"` // whether or not use any of filtering features </s> remove Result *dnsfilter.Result // Filtering result (optional) </s> add Result *filtering.Result // Filtering result (optional)
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/config.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // Protection configuration <mask> // -- <mask> <mask> ProtectionEnabled bool `yaml:"protection_enabled"` // whether or not use any of dnsfilter features <mask> BlockingMode string `yaml:"blocking_mode"` // mode how to answer filtered requests <mask> BlockingIPv4 net.IP `yaml:"blocking_ipv4"` // IP address to be returned for a blocked A request <mask> BlockingIPv6 net.IP `yaml:"blocking_ipv6"` // IP address to be returned for a blocked AAAA request <mask> BlockedResponseTTL uint32 `yaml:"blocked_response_ttl"` // if 0, then default is used (3600) <mask> </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove ProtectionEnabled: true, // whether or not use any of dnsfilter features </s> add ProtectionEnabled: true, // whether or not use any of filtering features </s> remove DnsfilterConf dnsfilter.Config `yaml:",inline"` </s> add DnsfilterConf filtering.Config `yaml:",inline"` </s> remove func (s *Server) filterDNSResponse(ctx *dnsContext) (*dnsfilter.Result, error) { </s> add func (s *Server) filterDNSResponse(ctx *dnsContext) (*filtering.Result, error) { </s> remove Result *dnsfilter.Result // Filtering result (optional) </s> add Result *filtering.Result // Filtering result (optional) </s> remove result *dnsfilter.Result </s> add result *filtering.Result </s> remove case dnsfilter.FilteredParental: </s> add case filtering.FilteredParental:
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/config.go
keep keep keep keep replace keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" <mask> ) <mask> </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering"
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/dns.go
keep replace keep replace
<mask> // setts are the filtering settings for the client. <mask> setts *dnsfilter.FilteringSettings <mask> startTime time.Time <mask> result *dnsfilter.Result </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove func (s *Server) getClientRequestFilteringSettings(ctx *dnsContext) *dnsfilter.FilteringSettings { </s> add func (s *Server) getClientRequestFilteringSettings(ctx *dnsContext) *filtering.Settings { </s> remove func applyAdditionalFiltering(clientAddr net.IP, clientID string, setts *dnsfilter.FilteringSettings) { </s> add func applyAdditionalFiltering(clientAddr net.IP, clientID string, setts *filtering.Settings) { </s> remove FilterHandler func(clientAddr net.IP, clientID string, settings *dnsfilter.FilteringSettings) `yaml:"-"` </s> add FilterHandler func(clientAddr net.IP, clientID string, settings *filtering.Settings) `yaml:"-"` </s> remove Result *dnsfilter.Result // Filtering result (optional) </s> add Result *filtering.Result // Filtering result (optional) </s> remove func (s *Server) genDNSFilterMessage(d *proxy.DNSContext, result *dnsfilter.Result) *dns.Msg { </s> add func (s *Server) genDNSFilterMessage(d *proxy.DNSContext, result *filtering.Result) *dns.Msg {
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> func (s *Server) handleDNSRequest(_ *proxy.Proxy, d *proxy.DNSContext) error { <mask> ctx := &dnsContext{ <mask> srv: s, <mask> proxyCtx: d, <mask> result: &dnsfilter.Result{}, <mask> startTime: time.Now(), <mask> } <mask> <mask> type modProcessFunc func(ctx *dnsContext) (rc resultCode) <mask> </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove result: &dnsfilter.Result{ </s> add result: &filtering.Result{ </s> remove func (s *Server) filterDNSRewrite(req *dns.Msg, res dnsfilter.Result, d *proxy.DNSContext) (err error) { </s> add func (s *Server) filterDNSRewrite(req *dns.Msg, res filtering.Result, d *proxy.DNSContext) (err error) { </s> remove func (s *Server) filterDNSRequest(ctx *dnsContext) (*dnsfilter.Result, error) { </s> add func (s *Server) filterDNSRequest(ctx *dnsContext) (*filtering.Result, error) { </s> remove func (s *Server) filterDNSResponse(ctx *dnsContext) (*dnsfilter.Result, error) { </s> add func (s *Server) filterDNSResponse(ctx *dnsContext) (*filtering.Result, error) { </s> remove func (s *Server) getClientRequestFilteringSettings(ctx *dnsContext) *dnsfilter.FilteringSettings { </s> add func (s *Server) getClientRequestFilteringSettings(ctx *dnsContext) *filtering.Settings { </s> remove func (s *Server) updateStats(ctx *dnsContext, elapsed time.Duration, res dnsfilter.Result) { </s> add func (s *Server) updateStats(ctx *dnsContext, elapsed time.Duration, res filtering.Result) {
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/dns.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> res := ctx.result <mask> var err error <mask> <mask> switch res.Reason { <mask> case dnsfilter.Rewritten, <mask> dnsfilter.RewrittenRule: <mask> <mask> if len(ctx.origQuestion.Name) == 0 { <mask> // origQuestion is set in case we get only CNAME without IP from rewrites table <mask> break <mask> } </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove return res.Reason == dnsfilter.NotFilteredAllowList </s> add return res.Reason == filtering.NotFilteredAllowList </s> remove case dnsfilter.FilteredParental: </s> add case filtering.FilteredParental: </s> remove } else if res.Reason == dnsfilter.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { </s> add } else if res.Reason == filtering.RewrittenAutoHosts && len(res.ReverseHosts) != 0 { </s> remove dnsfilter.Rewritten, dnsfilter.RewrittenAutoHosts, dnsfilter.RewrittenRule, </s> add filtering.Rewritten, filtering.RewrittenAutoHosts, filtering.RewrittenRule, </s> remove if result.Reason == dnsfilter.FilteredSafeSearch && </s> add if result.Reason == filtering.FilteredSafeSearch && </s> remove case dnsfilter.NotFilteredAllowList: </s> add case filtering.NotFilteredAllowList:
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> answer = append(answer, d.Res.Answer...) <mask> d.Res.Answer = answer <mask> } <mask> <mask> case dnsfilter.NotFilteredAllowList: <mask> // nothing <mask> <mask> default: <mask> if !ctx.protectionEnabled || // filters are disabled: there's nothing to check for <mask> !ctx.responseFromUpstream { // only check response if it's from an upstream server </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove Result *dnsfilter.Result // Filtering result (optional) </s> add Result *filtering.Result // Filtering result (optional) </s> remove return nil, fmt.Errorf("dnsfilter failed to check host %q: %w", host, err) </s> add return nil, fmt.Errorf("filtering failed to check host %q: %w", host, err) </s> remove result *dnsfilter.Result </s> add result *filtering.Result </s> remove // On Windows we don't pass files to dnsfilter - we pass the whole data. // . Pass new filters to dnsfilter object - it analyzes new data while the old filters are still active // . dnsfilter activates new filters </s> add // On Windows we don't pass files to filtering - we pass the whole data. // . Pass new filters to filtering object - it analyzes new data while the old filters are still active // . filtering activates new filters </s> remove ProtectionEnabled bool `yaml:"protection_enabled"` // whether or not use any of dnsfilter features </s> add ProtectionEnabled bool `yaml:"protection_enabled"` // whether or not use any of filtering features </s> remove setts *dnsfilter.FilteringSettings </s> add setts *filtering.Settings
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> if ctx.result != nil { <mask> ctx.origResp = origResp2 // matched by response <mask> } else { <mask> ctx.result = &dnsfilter.Result{} <mask> } <mask> } <mask> <mask> return resultCodeSuccess <mask> } </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove } else if res.Reason == dnsfilter.RewrittenRule { </s> add } else if res.Reason == filtering.RewrittenRule { </s> remove return nil, fmt.Errorf("dnsfilter failed to check host %q: %w", host, err) </s> add return nil, fmt.Errorf("filtering failed to check host %q: %w", host, err) </s> remove params.Result = &dnsfilter.Result{} </s> add params.Result = &filtering.Result{} </s> remove } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenRule) && </s> add } else if res.Reason.In(filtering.Rewritten, filtering.RewrittenRule) && </s> remove } else if res.Reason.In(dnsfilter.Rewritten, dnsfilter.RewrittenAutoHosts) { </s> add } else if res.Reason.In(filtering.Rewritten, filtering.RewrittenAutoHosts) { </s> remove c := dnsfilter.Config{} </s> add c := filtering.Config{}
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> "testing" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/miekg/dns" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/dns_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> "251.252.253.254.in-addr.arpa.": {"host1.example.net."}, <mask> "1.1.168.192.in-addr.arpa.": {"some.local-client."}, <mask> }, <mask> } <mask> s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{ <mask> UDPListenAddrs: []*net.UDPAddr{{}}, <mask> TCPListenAddrs: []*net.TCPAddr{{}}, <mask> }, ups) <mask> s.conf.UpstreamConfig.Upstreams = []upstream.Upstream{ups} <mask> startDeferStop(t, s) </s> Pull request: all: less annoying pkg names Merge in DNS/adguard-home from imp-naming to master Squashed commit of the following: commit d9e75c37af9a738384393735c141a41406d22eeb Author: Ainar Garipov <[email protected]> Date: Thu May 13 15:52:14 2021 +0300 all: less annoying pkg names </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{ </s> add s := createTestServer(t, &filtering.Config{}, ServerConfig{ </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{ </s> add s := createTestServer(t, &filtering.Config{}, ServerConfig{ </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{ </s> add s := createTestServer(t, &filtering.Config{}, ServerConfig{ </s> remove s = createTestServer(t, &dnsfilter.Config{}, ServerConfig{ </s> add s = createTestServer(t, &filtering.Config{}, ServerConfig{ </s> remove s := createTestServer(t, &dnsfilter.Config{}, ServerConfig{ </s> add s := createTestServer(t, &filtering.Config{}, ServerConfig{ </s> remove FilterHandler: func(_ net.IP, _ string, settings *dnsfilter.FilteringSettings) { </s> add FilterHandler: func(_ net.IP, _ string, settings *filtering.Settings) {
https://github.com/AdguardTeam/AdGuardHome/commit/7f2f8de92215eb2911241c036b8a5ed136d0eaed
internal/dnsforward/dns_test.go