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
<mask> "filter_category_security_desc": "Lists that specialize on blocking malware, phishing or scam domains", <mask> "filter_category_regional_desc": "Lists that focus on regional ads and tracking servers", <mask> "filter_category_other_desc": "Other blocklists", <mask> "original_response": "Original response", <mask> "click_to_view_queries": "Click to view queries" <mask> } </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove import React, { Component, Fragment } from 'react'; </s> add import React, { Component } from 'react'; </s> remove import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants'; </s> add import { ALL_INTERFACES_IP, FORM_NAME, ADDRESS_IN_USE_TEXT, PORT_53_FAQ_LINK, UBUNTU_SYSTEM_PORT, } from '../../helpers/constants'; </s> remove </button> } <hr className="divider--small" /> </div> } </s> add </button>} </div>} <hr className="divider--small" /> </s> remove return ( <option value={ip} key={name}> {name} - {ip} </option> ); } return false; }) </s> add return false; }) </s> remove <Fragment> </s> add <> </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); }
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/__locales/en.json
keep add keep keep keep keep keep
<mask> <mask> export const PRIVACY_POLICY_LINK = 'https://adguard.com/privacy/home.html'; <mask> <mask> export const INSTALL_FIRST_STEP = 1; <mask> export const INSTALL_TOTAL_STEPS = 5; <mask> <mask> export const SETTINGS_NAMES = { </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); } </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove if (isDown) { </s> add </s> remove </Fragment> </s> add </> </s> remove <option value={ip} key={name} disabled> <Fragment> {name} - {ip} (<Trans>down</Trans>) </Fragment> </s> add <option value={ip} key={name}> {name} - {ip}
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/helpers/constants.js
replace keep keep keep keep keep
<mask> import React, { Component, Fragment } from 'react'; <mask> import { connect } from 'react-redux'; <mask> import PropTypes from 'prop-types'; <mask> import { Field, reduxForm, formValueSelector } from 'redux-form'; <mask> import { Trans, withTranslation } from 'react-i18next'; <mask> import flow from 'lodash/flow'; </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants'; </s> add import { ALL_INTERFACES_IP, FORM_NAME, ADDRESS_IN_USE_TEXT, PORT_53_FAQ_LINK, UBUNTU_SYSTEM_PORT, } from '../../helpers/constants'; </s> remove return ( <option value={ip} key={name}> {name} - {ip} </option> ); } return false; }) </s> add return false; }) </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); } </s> remove <option value={ip} key={name} disabled> <Fragment> {name} - {ip} (<Trans>down</Trans>) </Fragment> </s> add <option value={ip} key={name}> {name} - {ip}
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep keep keep keep replace keep keep keep keep keep
<mask> import Controls from './Controls'; <mask> import AddressList from './AddressList'; <mask> <mask> import { getInterfaceIp } from '../../helpers/helpers'; <mask> import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants'; <mask> import { renderInputField, toNumber } from '../../helpers/form'; <mask> import { validateRequiredValue, validateInstallPort } from '../../helpers/validators'; <mask> <mask> const STATIC_STATUS = { <mask> ENABLED: 'yes', </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove import React, { Component, Fragment } from 'react'; </s> add import React, { Component } from 'react'; </s> remove return ( <option value={ip} key={name}> {name} - {ip} </option> ); } return false; }) </s> add return false; }) </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); } </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove <option value={ip} key={name} disabled> <Fragment> {name} - {ip} (<Trans>down</Trans>) </Fragment> </s> add <option value={ip} key={name}> {name} - {ip}
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep keep replace replace replace replace replace replace replace replace replace replace replace keep replace keep keep keep
<mask> <mask> const renderInterfaces = ((interfaces) => ( <mask> Object.keys(interfaces).map((item) => { <mask> const option = interfaces[item]; <mask> const { <mask> name, <mask> ip_addresses, <mask> flags, <mask> } = option; <mask> <mask> if (option && ip_addresses?.length > 0) { <mask> const ip = getInterfaceIp(option); <mask> const isDown = flags?.includes('down'); <mask> <mask> if (isDown) { <mask> return ( <mask> <option value={ip} key={name} disabled> <mask> <Fragment> </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove <option value={ip} key={name} disabled> <Fragment> {name} - {ip} (<Trans>down</Trans>) </Fragment> </s> add <option value={ip} key={name}> {name} - {ip} </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove return ( <option value={ip} key={name}> {name} - {ip} </option> ); } return false; }) </s> add return false; }) </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove </Fragment> </s> add </>
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep replace replace replace replace keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep
<mask> return ( <mask> <option value={ip} key={name} disabled> <mask> <Fragment> <mask> {name} - {ip} (<Trans>down</Trans>) <mask> </Fragment> <mask> </option> <mask> ); <mask> } <mask> <mask> return ( <mask> <option value={ip} key={name}> <mask> {name} - {ip} <mask> </option> <mask> ); <mask> } <mask> <mask> return false; <mask> }) <mask> )); <mask> </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove if (isDown) { </s> add </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); } </s> remove <Fragment> </s> add <> </s> remove <Fragment> </s> add <> </s> remove </Fragment> </s> add </>
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep replace keep replace
<mask> return ( <mask> <Fragment> <mask> {status === STATIC_STATUS.DISABLED && ( <mask> <Fragment> </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove </Fragment> </s> add </> </s> remove <option value={ip} key={name} disabled> <Fragment> {name} - {ip} (<Trans>down</Trans>) </Fragment> </s> add <option value={ip} key={name}> {name} - {ip} </s> remove if (isDown) { </s> add </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); } </s> remove && <Fragment> </s> add && <>
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep keep keep keep replace keep keep keep keep keep
<mask> onClick={() => this.handleStaticIp(ip)} <mask> > <mask> <Trans>set_static_ip</Trans> <mask> </button> <mask> </Fragment> <mask> )} <mask> {status === STATIC_STATUS.ERROR && ( <mask> <div className="text-danger"> <mask> <Trans>install_static_error</Trans> <mask> </div> </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove </button> } <hr className="divider--small" /> </div> } </s> add </button>} </div>} <hr className="divider--small" /> </s> remove </Fragment> </s> add </> </s> remove <Fragment> </s> add <> </s> remove <Fragment> </s> add <> </s> remove <hr className="divider--small" /> </Fragment> } </s> add </>} {dnsPort === UBUNTU_SYSTEM_PORT && !isDnsFixAvailable && dnsStatus.includes(ADDRESS_IN_USE_TEXT) && <Trans components={[<a href={PORT_53_FAQ_LINK} key="0">link</a>]}> port_53_faq_link </Trans>} <hr className="divider--small" /> </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); }
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep keep keep keep replace keep keep keep keep keep
<mask> install_static_ok <mask> </Trans> <mask> </div> <mask> )} <mask> </Fragment> <mask> ); <mask> }; <mask> <mask> handleAutofix = (type) => { <mask> const { </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove </Fragment> </s> add </> </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); } </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove return ( <option value={ip} key={name}> {name} - {ip} </option> ); } return false; }) </s> add return false; }) </s> remove <option value={ip} key={name} disabled> <Fragment> {name} - {ip} (<Trans>down</Trans>) </Fragment> </s> add <option value={ip} key={name}> {name} - {ip}
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep keep keep keep replace replace keep keep keep keep keep
<mask> dnsPort, <mask> handleFix, <mask> } = this.props; <mask> <mask> const web = { ip: webIp, port: webPort, autofix: false }; <mask> const dns = { ip: dnsIp, port: dnsPort, autofix: false }; <mask> const set_static_ip = false; <mask> <mask> if (type === 'web') { <mask> web.autofix = true; <mask> } else { </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); } </s> remove return ( <option value={ip} key={name}> {name} - {ip} </option> ); } return false; }) </s> add return false; }) </s> remove </Fragment> </s> add </> </s> remove import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants'; </s> add import { ALL_INTERFACES_IP, FORM_NAME, ADDRESS_IN_USE_TEXT, PORT_53_FAQ_LINK, UBUNTU_SYSTEM_PORT, } from '../../helpers/constants'; </s> remove if (isDown) { </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep keep keep keep replace replace keep keep keep keep keep
<mask> dnsPort, <mask> handleFix, <mask> } = this.props; <mask> <mask> const web = { ip: webIp, port: webPort, autofix: false }; <mask> const dns = { ip: dnsIp, port: dnsPort, autofix: false }; <mask> const set_static_ip = true; <mask> <mask> if (window.confirm(this.props.t('confirm_static_ip', { ip }))) { <mask> handleFix(web, dns, set_static_ip); <mask> } </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove const web = { ip: webIp, port: webPort, autofix: false }; const dns = { ip: dnsIp, port: dnsPort, autofix: false }; </s> add const web = { ip: webIp, port: webPort, autofix: false, }; const dns = { ip: dnsIp, port: dnsPort, autofix: false, }; </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); } </s> remove </Fragment> </s> add </> </s> remove if (isDown) { </s> add </s> remove import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants'; </s> add import { ALL_INTERFACES_IP, FORM_NAME, ADDRESS_IN_USE_TEXT, PORT_53_FAQ_LINK, UBUNTU_SYSTEM_PORT, } from '../../helpers/constants'; </s> remove return ( <option value={ip} key={name}> {name} - {ip} </option> ); } return false; }) </s> add return false; })
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
<mask> className="btn btn-secondary btn-sm ml-2" <mask> onClick={() => this.handleAutofix('web')} <mask> > <mask> <Trans>fix</Trans> <mask> </button> <mask> } <mask> <hr className="divider--small" /> <mask> </div> <mask> } <mask> </div> <mask> </div> <mask> <div className="setup__desc"> <mask> <Trans>install_settings_interface_link</Trans> <mask> <div className="mt-1"> </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove <hr className="divider--small" /> </Fragment> } </s> add </>} {dnsPort === UBUNTU_SYSTEM_PORT && !isDnsFixAvailable && dnsStatus.includes(ADDRESS_IN_USE_TEXT) && <Trans components={[<a href={PORT_53_FAQ_LINK} key="0">link</a>]}> port_53_faq_link </Trans>} <hr className="divider--small" /> </s> remove </Fragment> </s> add </> </s> remove && <Fragment> </s> add && <> </s> remove </Fragment> </s> add </> </s> remove Object.keys(interfaces).map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); </s> add Object.keys(interfaces) .map((item) => { const option = interfaces[item]; const { name, ip_addresses, flags, } = option; if (option && ip_addresses?.length > 0) { const ip = getInterfaceIp(option); const isDown = flags?.includes('down'); if (isDown) { return ( <option value={ip} key={name} disabled> <> {name} - {ip} (<Trans>down</Trans>) </> </option> ); } </s> remove <Fragment> </s> add <>
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep keep keep keep replace keep keep keep keep keep
<mask> </div> <mask> </div> <mask> <div className="col-12"> <mask> {dnsStatus <mask> && <Fragment> <mask> <div className="setup__error text-danger"> <mask> {dnsStatus} <mask> {isDnsFixAvailable <mask> && <button <mask> type="button" </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove <Fragment> </s> add <> </s> remove <hr className="divider--small" /> </Fragment> } </s> add </>} {dnsPort === UBUNTU_SYSTEM_PORT && !isDnsFixAvailable && dnsStatus.includes(ADDRESS_IN_USE_TEXT) && <Trans components={[<a href={PORT_53_FAQ_LINK} key="0">link</a>]}> port_53_faq_link </Trans>} <hr className="divider--small" /> </s> remove </Fragment> </s> add </> </s> remove </button> } <hr className="divider--small" /> </div> } </s> add </button>} </div>} <hr className="divider--small" /> </s> remove <Fragment> </s> add <> </s> remove </Fragment> </s> add </>
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> <p className="mb-1"> <mask> <Trans>autofix_warning_result</Trans> <mask> </p> <mask> </div>} <mask> <hr className="divider--small" /> <mask> </Fragment> <mask> } <mask> </div> <mask> </div> <mask> <div className="setup__desc"> <mask> <Trans>install_settings_dns_desc</Trans> <mask> <div className="mt-1"> </s> + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal <[email protected]> Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use </s> remove </button> } <hr className="divider--small" /> </div> } </s> add </button>} </div>} <hr className="divider--small" /> </s> remove </Fragment> </s> add </> </s> remove && <Fragment> </s> add && <> </s> remove <Fragment> </s> add <> </s> remove </Fragment> </s> add </> </s> remove <Fragment> </s> add <>
https://github.com/AdguardTeam/AdGuardHome/commit/4175d822797be0d997df43fb81fea3614c2accf9
client/src/install/Setup/Settings.js
keep keep keep keep replace keep keep keep keep keep
<mask> "add_blocklist": "Add blocklist", <mask> "add_allowlist": "Add allowlist", <mask> "cancel_btn": "Cancel", <mask> "enter_name_hint": "Enter name", <mask> "enter_url_hint": "Enter URL", <mask> "check_updates_btn": "Check for updates", <mask> "new_blocklist": "New blocklist", <mask> "new_allowlist": "New allowlist", <mask> "edit_blocklist": "Edit blocklist", <mask> "edit_allowlist": "Edit allowlist", </s> + client: Validate adding of absolute path to the filtering lists </s> add "form_error_url_or_path_format": "Invalid url or absolute path of the list", </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants'; </s> add import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH, } from '../helpers/constants'; </s> add export const R_UNIX_ABSOLUTE_PATH = /^\/([A-z0-9-_+]+\/)*([A-z0-9]+\.(txt))$/; export const R_WIN_ABSOLUTE_PATH = /^[a-zA-Z]:\\[\\\S|*\S]?.*\.(txt)$/; </s> remove <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a> </s> add {isValidAbsolutePath(value) ? value : <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a>} </s> add import { isValidAbsolutePath } from '../../helpers/form'; </s> remove placeholder={t('enter_url_hint')} validate={[required, isValidUrl]} </s> add placeholder={t('enter_url_or_path_hint')} validate={[required, isValidPath]}
https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5
client/src/__locales/en.json
keep keep keep add keep keep keep keep keep
<mask> "edit_allowlist": "Edit allowlist", <mask> "enter_valid_blocklist": "Enter a valid URL to the blocklist.", <mask> "enter_valid_allowlist": "Enter a valid URL to the allowlist.", <mask> "form_error_url_format": "Invalid url format", <mask> "custom_filter_rules": "Custom filtering rules", <mask> "custom_filter_rules_hint": "Enter one rule on a line. You can use either adblock rules or hosts files syntax.", <mask> "examples_title": "Examples", <mask> "example_meaning_filter_block": "block access to the example.org domain and all its subdomains", <mask> "example_meaning_filter_whitelist": "unblock access to the example.org domain and all its subdomains", </s> + client: Validate adding of absolute path to the filtering lists </s> remove "enter_url_hint": "Enter URL", </s> add "enter_url_or_path_hint": "Enter URL or absolute path of the list", </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants'; </s> add import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH, } from '../helpers/constants'; </s> add export const R_UNIX_ABSOLUTE_PATH = /^\/([A-z0-9-_+]+\/)*([A-z0-9]+\.(txt))$/; export const R_WIN_ABSOLUTE_PATH = /^[a-zA-Z]:\\[\\\S|*\S]?.*\.(txt)$/; </s> remove <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a> </s> add {isValidAbsolutePath(value) ? value : <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a>} </s> add import { isValidAbsolutePath } from '../../helpers/form'; </s> remove placeholder={t('enter_url_hint')} validate={[required, isValidUrl]} </s> add placeholder={t('enter_url_or_path_hint')} validate={[required, isValidPath]}
https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5
client/src/__locales/en.json
keep keep keep keep replace keep keep keep keep keep
<mask> import { Field, reduxForm } from 'redux-form'; <mask> import { Trans, withNamespaces } from 'react-i18next'; <mask> import flow from 'lodash/flow'; <mask> <mask> import { renderInputField, required, isValidUrl } from '../../helpers/form'; <mask> <mask> const Form = (props) => { <mask> const { <mask> t, <mask> closeModal, </s> + client: Validate adding of absolute path to the filtering lists </s> add import { isValidAbsolutePath } from '../../helpers/form'; </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants'; </s> add import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH, } from '../helpers/constants'; </s> add export const R_UNIX_ABSOLUTE_PATH = /^\/([A-z0-9-_+]+\/)*([A-z0-9]+\.(txt))$/; export const R_WIN_ABSOLUTE_PATH = /^[a-zA-Z]:\\[\\\S|*\S]?.*\.(txt)$/; </s> remove <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a> </s> add {isValidAbsolutePath(value) ? value : <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a>} </s> remove placeholder={t('enter_url_hint')} validate={[required, isValidUrl]} </s> add placeholder={t('enter_url_or_path_hint')} validate={[required, isValidPath]} </s> add "form_error_url_or_path_format": "Invalid url or absolute path of the list",
https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5
client/src/components/Filters/Form.js
keep keep keep keep replace replace keep keep keep keep keep
<mask> name="url" <mask> type="text" <mask> component={renderInputField} <mask> className="form-control" <mask> placeholder={t('enter_url_hint')} <mask> validate={[required, isValidUrl]} <mask> /> <mask> </div> <mask> <div className="form__description"> <mask> {whitelist ? ( <mask> <Trans>enter_valid_allowlist</Trans> </s> + client: Validate adding of absolute path to the filtering lists </s> remove <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a> </s> add {isValidAbsolutePath(value) ? value : <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a>} </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants'; </s> add import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH, } from '../helpers/constants'; </s> add export const R_UNIX_ABSOLUTE_PATH = /^\/([A-z0-9-_+]+\/)*([A-z0-9]+\.(txt))$/; export const R_WIN_ABSOLUTE_PATH = /^[a-zA-Z]:\\[\\\S|*\S]?.*\.(txt)$/; </s> add import { isValidAbsolutePath } from '../../helpers/form'; </s> remove import { renderInputField, required, isValidUrl } from '../../helpers/form'; </s> add import { renderInputField, required, isValidPath } from '../../helpers/form'; </s> add "form_error_url_or_path_format": "Invalid url or absolute path of the list",
https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5
client/src/components/Filters/Form.js
keep keep keep add keep keep keep keep keep
<mask> import { withNamespaces, Trans } from 'react-i18next'; <mask> import CellWrap from '../ui/CellWrap'; <mask> import { MODAL_TYPE } from '../../helpers/constants'; <mask> import { formatDetailedDateTime } from '../../helpers/helpers'; <mask> <mask> class Table extends Component { <mask> getDateCell = row => CellWrap(row, formatDetailedDateTime); <mask> <mask> renderCheckbox = ({ original }) => { </s> + client: Validate adding of absolute path to the filtering lists </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants'; </s> add import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH, } from '../helpers/constants'; </s> remove import { renderInputField, required, isValidUrl } from '../../helpers/form'; </s> add import { renderInputField, required, isValidPath } from '../../helpers/form'; </s> remove <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a> </s> add {isValidAbsolutePath(value) ? value : <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a>} </s> add export const R_UNIX_ABSOLUTE_PATH = /^\/([A-z0-9-_+]+\/)*([A-z0-9]+\.(txt))$/; export const R_WIN_ABSOLUTE_PATH = /^[a-zA-Z]:\\[\\\S|*\S]?.*\.(txt)$/; </s> remove placeholder={t('enter_url_hint')} validate={[required, isValidUrl]} </s> add placeholder={t('enter_url_or_path_hint')} validate={[required, isValidPath]} </s> add "form_error_url_or_path_format": "Invalid url or absolute path of the list",
https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5
client/src/components/Filters/Table.js
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> accessor: 'url', <mask> minWidth: 200, <mask> Cell: ({ value }) => ( <mask> <div className="logs__row logs__row--overflow"> <mask> <a <mask> href={value} <mask> target="_blank" <mask> rel="noopener noreferrer" <mask> className="link logs__text" <mask> > <mask> {value} <mask> </a> <mask> </div> <mask> ), <mask> }, <mask> { <mask> Header: <Trans>rules_count_table_header</Trans>, </s> + client: Validate adding of absolute path to the filtering lists </s> remove placeholder={t('enter_url_hint')} validate={[required, isValidUrl]} </s> add placeholder={t('enter_url_or_path_hint')} validate={[required, isValidPath]} </s> add import { isValidAbsolutePath } from '../../helpers/form'; </s> remove import { renderInputField, required, isValidUrl } from '../../helpers/form'; </s> add import { renderInputField, required, isValidPath } from '../../helpers/form'; </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants'; </s> add import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH, } from '../helpers/constants'; </s> add export const R_UNIX_ABSOLUTE_PATH = /^\/([A-z0-9-_+]+\/)*([A-z0-9]+\.(txt))$/; export const R_WIN_ABSOLUTE_PATH = /^[a-zA-Z]:\\[\\\S|*\S]?.*\.(txt)$/; </s> add "form_error_url_or_path_format": "Invalid url or absolute path of the list",
https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5
client/src/components/Filters/Table.js
keep keep add keep keep keep keep
<mask> export const R_MAC = /^((([a-fA-F0-9][a-fA-F0-9]+[-]){5}|([a-fA-F0-9][a-fA-F0-9]+[:]){5})([a-fA-F0-9][a-fA-F0-9])$)|(^([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]+[.]){2}([a-fA-F0-9][a-fA-F0-9][a-fA-F0-9][a-fA-F0-9]))$/; <mask> export const R_CIDR_IPV6 = /^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/(12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))$/; <mask> export const R_PATH_LAST_PART = /\/[^/]*$/; <mask> <mask> export const STATS_NAMES = { <mask> avg_processing_time: 'average_processing_time', <mask> blocked_filtering: 'Blocked by filters', </s> + client: Validate adding of absolute path to the filtering lists </s> remove import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants'; </s> add import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH, } from '../helpers/constants'; </s> remove import { renderInputField, required, isValidUrl } from '../../helpers/form'; </s> add import { renderInputField, required, isValidPath } from '../../helpers/form'; </s> add import { isValidAbsolutePath } from '../../helpers/form'; </s> remove <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a> </s> add {isValidAbsolutePath(value) ? value : <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a>} </s> remove placeholder={t('enter_url_hint')} validate={[required, isValidUrl]} </s> add placeholder={t('enter_url_or_path_hint')} validate={[required, isValidPath]} </s> add "form_error_url_or_path_format": "Invalid url or absolute path of the list",
https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5
client/src/helpers/constants.js
keep keep keep replace keep keep keep keep keep
<mask> import React, { Fragment } from 'react'; <mask> import { Trans } from 'react-i18next'; <mask> import PropTypes from 'prop-types'; <mask> import { R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL } from '../helpers/constants'; <mask> import { createOnBlurHandler } from './helpers'; <mask> <mask> export const renderField = (props, elementType) => { <mask> const { <mask> input, id, className, placeholder, type, disabled, normalizeOnBlur, </s> + client: Validate adding of absolute path to the filtering lists </s> remove import { renderInputField, required, isValidUrl } from '../../helpers/form'; </s> add import { renderInputField, required, isValidPath } from '../../helpers/form'; </s> add import { isValidAbsolutePath } from '../../helpers/form'; </s> add export const R_UNIX_ABSOLUTE_PATH = /^\/([A-z0-9-_+]+\/)*([A-z0-9]+\.(txt))$/; export const R_WIN_ABSOLUTE_PATH = /^[a-zA-Z]:\\[\\\S|*\S]?.*\.(txt)$/; </s> remove <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a> </s> add {isValidAbsolutePath(value) ? value : <a href={value} target="_blank" rel="noopener noreferrer" className="link logs__text" > {value} </a>} </s> remove placeholder={t('enter_url_hint')} validate={[required, isValidUrl]} </s> add placeholder={t('enter_url_or_path_hint')} validate={[required, isValidPath]} </s> add "form_error_url_or_path_format": "Invalid url or absolute path of the list",
https://github.com/AdguardTeam/AdGuardHome/commit/421ad744cb36f20167f723dee9966439d2bd14c5
client/src/helpers/form.js
keep keep keep keep replace replace keep keep keep keep keep
<mask> <mask> assertWriting(t, f, "127.0.0.2 newhost\n") <mask> require.NoError(t, f.Sync()) <mask> <mask> // Wait until fsnotify has triggerred and processed the <mask> // file-modification event. <mask> time.Sleep(50 * time.Millisecond) <mask> <mask> t.Run("notified", func(t *testing.T) { <mask> ips := ehc.Process("newhost", dns.TypeA) <mask> assert.NotNil(t, ips) </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> add setupBootstraps(t) </s> add setupBootstraps(t) </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL) </s> remove assert.Equal(t, "example.org", mc.PayloadContent[0].DNSSettings.ServerName) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Equal(t, "example.org", s.ServerName) assert.Empty(t, s.ServerURL)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/aghnet/etchostscontainer_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // TestErrUpstream implements upstream.Upstream interface for replacing real <mask> // upstream in tests. <mask> type TestErrUpstream struct { <mask> // The error returned by Exchange may be unwraped to the Err. <mask> Err error <mask> } <mask> <mask> // Exchange always returns nil Msg and non-nil error. <mask> func (u *TestErrUpstream) Exchange(*dns.Msg) (*dns.Msg, error) { </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> add // DNSProtocol is the required protocol to be used. The valid values // are "HTTPS" and "TLS". </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> add "github.com/AdguardTeam/golibs/errors" </s> add // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/aghtest/upstream.go
keep keep keep keep replace keep keep keep keep keep
<mask> case <mask> rounded == 0, <mask> rounded*time.Second != d.Duration, <mask> rounded%60 != 0: <mask> // Return the uncutted value if it's either equal to zero or has <mask> // fractions of a second or even whole seconds in it. <mask> return str <mask> <mask> case (rounded%secsInHour)/minsInHour != 0: <mask> return str[:len(str)-tailMin] </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove if d.clientID != "" { d.ServerName = d.clientID + "." + d.ServerName </s> add if clientID != "" { d.ServerName = clientID + "." + d.ServerName </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) return } </s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> add </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> remove if req.Web.Port == 0 || req.DNS.Port == 0 { httpError(w, http.StatusBadRequest, "port value can't be 0") </s> add </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"`
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/aghtime/duration.go
keep keep keep keep replace keep keep keep keep keep
<mask> // *Duration. <mask> // <mask> // TODO(e.burkov): Make it able to parse larger units like days. <mask> func (d *Duration) UnmarshalText(b []byte) (err error) { <mask> defer func() { err = errors.Annotate(err, "unmarshalling duration: %w") }() <mask> <mask> d.Duration, err = time.ParseDuration(string(b)) <mask> <mask> return err <mask> } </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove req := applyConfigReq{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) return } </s> add httpError(w, http.StatusBadRequest, "%s", err) </s> add // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> remove func getMobileConfig(d dnsSettings) ([]byte, error) { </s> add func encodeMobileConfig(d *dnsSettings, clientID string) ([]byte, error) { </s> add setupBootstraps(t)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/aghtime/duration.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> } <mask> <mask> // durationEncodingTester is a helper struct to simplify testing different <mask> // Duration marshalling and unmarshalling cases. <mask> type durationEncodingTester struct { <mask> PtrMap map[string]*Duration `json:"ptr_map" yaml:"ptr_map"` <mask> PtrSlice []*Duration `json:"ptr_slice" yaml:"ptr_slice"` <mask> PtrValue *Duration `json:"ptr_value" yaml:"ptr_value"` <mask> PtrArray [1]*Duration `json:"ptr_array" yaml:"ptr_array"` </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> add // payloadContent is a Device Management Profile payload. // // See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127. </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> remove Name string PayloadDescription string PayloadDisplayName string PayloadIdentifier string </s> add DNSSettings *dnsSettings </s> add "github.com/AdguardTeam/golibs/errors" </s> add // DNSProtocol is the required protocol to be used. The valid values // are "HTTPS" and "TLS".
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/aghtime/duration_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> // defaultTestDur is the default time.Duration value to be used throughout the tests of <mask> // Duration. <mask> const defaultTestDur = time.Millisecond <mask> <mask> // checkFields verifies m's fields. It expects the m to be unmarshalled from <mask> // one of the constant strings above. <mask> func (m *durationEncodingTester) checkFields(t *testing.T, d Duration) { <mask> t.Run("pointers_map", func(t *testing.T) { <mask> require.NotNil(t, m.PtrMap) <mask> </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> add // DNSProtocol is the required protocol to be used. The valid values // are "HTTPS" and "TLS". </s> add // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> remove // Return the uncutted value if it's either equal to zero or has </s> add // Return the uncut value if it's either equal to zero or has </s> remove // The error returned by Exchange may be unwraped to the Err. </s> add // The error returned by Exchange may be unwrapped to the Err.
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/aghtime/duration_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> // Restrict an access to local addresses for external clients. We also <mask> // assume that all the DHCP leases we give are locally-served or at <mask> // least don't need to be unaccessable externally. <mask> if s.subnetDetector.IsLocallyServedNetwork(ip) { <mask> if !ctx.isLocalClient { <mask> log.Debug("dns: %q requests for internal ip", d.Addr) <mask> d.Res = s.genNXDomain(req) <mask> </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> remove // The error returned by Exchange may be unwraped to the Err. </s> add // The error returned by Exchange may be unwrapped to the Err. </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add "github.com/AdguardTeam/golibs/errors" </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings.
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/dnsforward/dns.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> <mask> dnsforward.TLSConfig `yaml:",inline" json:",inline"` <mask> } <mask> <mask> // initialize to default values, will be changed later when reading config or parsing command line <mask> var config = configuration{ <mask> BindPort: 3000, <mask> BetaBindPort: 0, <mask> BindHost: net.IP{0, 0, 0, 0}, <mask> AuthAttempts: 5, <mask> AuthBlockMin: 15, </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove // Return the uncutted value if it's either equal to zero or has </s> add // Return the uncut value if it's either equal to zero or has </s> remove var curConfig configuration copyInstallSettings(&curConfig, &config) </s> add var curConfig *configuration copyInstallSettings(curConfig, config) </s> remove // checkFields verifies m's fields. It expects the m to be unmarshalled from </s> add // checkFields verifies m's fields. It expects the m to be unmarshaled from </s> remove err = configureOS(&config) </s> add err = configureOS(config) </s> remove // least don't need to be unaccessable externally. </s> add // least don't need to be inaccessible externally. </s> remove PayloadDescription: "Adds AdGuard Home to Big Sur and iOS 14 or newer systems", PayloadDisplayName: dspName, PayloadIdentifier: genUUIDv4(), PayloadRemovalDisallowed: false, PayloadType: "Configuration", PayloadUUID: genUUIDv4(), </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/config.go
keep add keep keep keep keep keep
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // getAddrsResponse is the response for /install/get_addresses endpoint. <mask> type getAddrsResponse struct { </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> add "github.com/AdguardTeam/golibs/stringutil" </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // DNSProtocol is the required protocol to be used. The valid values // are "HTTPS" and "TLS".
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/controlinstall.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/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> ) <mask> <mask> // getAddrsResponse is the response for /install/get_addresses endpoint. <mask> type getAddrsResponse struct { <mask> WebPort int `json:"web_port"` </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> add "github.com/AdguardTeam/golibs/errors" </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> add "github.com/AdguardTeam/golibs/stringutil" </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> remove DNSSettings dnsSettings </s> add PayloadDisplayName string PayloadDescription string
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/controlinstall.go
keep keep replace replace keep replace replace replace
<mask> // Apply new configuration, start DNS server, restart Web server <mask> func (web *Web) handleInstallConfigure(w http.ResponseWriter, r *http.Request) { <mask> req := applyConfigReq{} <mask> err := json.NewDecoder(r.Body).Decode(&req) <mask> if err != nil { <mask> httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) <mask> return <mask> } </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove if req.Web.Port == 0 || req.DNS.Port == 0 { httpError(w, http.StatusBadRequest, "port value can't be 0") </s> add </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> add // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig) </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/controlinstall.go
keep keep keep keep replace replace keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep
<mask> httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) <mask> return <mask> } <mask> <mask> if req.Web.Port == 0 || req.DNS.Port == 0 { <mask> httpError(w, http.StatusBadRequest, "port value can't be 0") <mask> return <mask> } <mask> <mask> restartHTTP := true <mask> if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { <mask> // no need to rebind <mask> restartHTTP = false <mask> } <mask> <mask> // validate that hosts and ports are bindable <mask> if restartHTTP { <mask> err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) <mask> if err != nil { <mask> httpError( <mask> w, <mask> http.StatusBadRequest, <mask> "can not listen on IP:port %s: %s", <mask> netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), <mask> err, <mask> ) <mask> <mask> return <mask> } <mask> <mask> } <mask> <mask> err = aghnet.CheckPacketPortAvailable(req.DNS.IP, req.DNS.Port) </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) return } </s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove req := applyConfigReq{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig) </s> remove var curConfig configuration copyInstallSettings(&curConfig, &config) </s> add var curConfig *configuration copyInstallSettings(curConfig, config) </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/controlinstall.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> httpError(w, http.StatusBadRequest, "%s", err) <mask> return <mask> } <mask> <mask> var curConfig configuration <mask> copyInstallSettings(&curConfig, &config) <mask> <mask> Context.firstRun = false <mask> config.BindHost = req.Web.IP <mask> config.BindPort = req.Web.Port <mask> config.DNS.BindHosts = []net.IP{req.DNS.IP} </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> remove if req.Web.Port == 0 || req.DNS.Port == 0 { httpError(w, http.StatusBadRequest, "port value can't be 0") </s> add </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig) </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) return } </s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig) </s> remove // initialize to default values, will be changed later when reading config or parsing command line var config = configuration{ </s> add // config is the global configuration structure. // // TODO(a.garipov, e.burkov): This global is afwul and must be removed. var config = &configuration{
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/controlinstall.go
keep keep keep keep replace keep keep keep keep keep
<mask> // underlying functions potentially restart the HTTPS server. <mask> err = StartMods() <mask> if err != nil { <mask> Context.firstRun = true <mask> copyInstallSettings(&config, &curConfig) <mask> httpError(w, http.StatusInternalServerError, "%s", err) <mask> return <mask> } <mask> <mask> u := User{} </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig) </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) return } </s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove req := applyConfigReq{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove mobileconfig, err := getMobileConfig(d) </s> add mobileconfig, err := encodeMobileConfig(d, clientID) </s> remove d := dnsSettings{ DNSProtocol: dnsp, ServerName: host, clientID: clientID, </s> add d := &dnsSettings{ DNSProtocol: dnsp, ServerName: host, ServerAddresses: cloneBootstrap(),
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/controlinstall.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> err = config.write() <mask> if err != nil { <mask> Context.firstRun = true <mask> copyInstallSettings(&config, &curConfig) <mask> httpError(w, http.StatusInternalServerError, "Couldn't write config: %s", err) <mask> return <mask> } <mask> <mask> web.conf.firstRun = false </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig) </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) return } </s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove mobileconfig, err := getMobileConfig(d) </s> add mobileconfig, err := encodeMobileConfig(d, clientID) </s> remove req := applyConfigReq{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove var curConfig configuration copyInstallSettings(&curConfig, &config) </s> add var curConfig *configuration copyInstallSettings(curConfig, config)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/controlinstall.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> setupContext(args) <mask> <mask> err = configureOS(&config) <mask> fatalOnError(err) <mask> <mask> // clients package uses filtering package's static data (filtering.BlockedSvcKnown()), <mask> // so we have to initialize filtering's static data first, <mask> // but also avoid relying on automatic Go init() function </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove data := mobileConfig{ PayloadContent: []payloadContent{{ Name: dspName, PayloadDescription: "Configures device to use AdGuard Home", PayloadDisplayName: dspName, PayloadIdentifier: fmt.Sprintf("com.apple.dnsSettings.managed.%s", genUUIDv4()), PayloadType: "com.apple.dnsSettings.managed", </s> add payloadID := fmt.Sprintf("%s.%s", dnsSettingsPayloadType, genUUIDv4()) data := &mobileConfig{ PayloadDescription: "Adds AdGuard Home to macOS Big Sur " + "and iOS 14 or newer systems", PayloadDisplayName: dspName, PayloadIdentifier: genUUIDv4(), PayloadType: "Configuration", PayloadUUID: genUUIDv4(), PayloadContent: []*payloadContent{{ PayloadType: dnsSettingsPayloadType, PayloadIdentifier: payloadID, </s> remove // least don't need to be unaccessable externally. </s> add // least don't need to be inaccessible externally. </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> remove // initialize to default values, will be changed later when reading config or parsing command line var config = configuration{ </s> add // config is the global configuration structure. // // TODO(a.garipov, e.burkov): This global is afwul and must be removed. var config = &configuration{ </s> remove defer func() { err = errors.Annotate(err, "unmarshalling duration: %w") }() </s> add defer func() { err = errors.Annotate(err, "unmarshaling duration: %w") }() </s> remove req := applyConfigReq{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/home.go
keep keep keep add keep keep keep keep keep
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> uuid "github.com/satori/go.uuid" <mask> "howett.net/plist" <mask> ) <mask> <mask> // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> add "github.com/AdguardTeam/golibs/errors" </s> add "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel.
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep add keep keep keep keep keep keep
<mask> "howett.net/plist" <mask> ) <mask> <mask> type dnsSettings struct { <mask> // DNSProtocol is the required protocol to be used. The valid values <mask> // are "HTTPS" and "TLS". <mask> DNSProtocol string <mask> <mask> // ServerURL is the URI template of the DoH server. It must be empty if </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> add // DNSProtocol is the required protocol to be used. The valid values // are "HTTPS" and "TLS". </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> remove // checkFields verifies m's fields. It expects the m to be unmarshalled from </s> add // checkFields verifies m's fields. It expects the m to be unmarshaled from </s> add "github.com/AdguardTeam/golibs/stringutil" </s> remove // The error returned by Exchange may be unwraped to the Err. </s> add // The error returned by Exchange may be unwrapped to the Err. </s> add "github.com/AdguardTeam/golibs/errors"
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep add keep keep keep keep keep keep
<mask> // <mask> // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. <mask> type dnsSettings struct { <mask> DNSProtocol string <mask> <mask> // ServerURL is the URI template of the DoH server. It must be empty if <mask> // DNSProtocol is not "HTTPS". <mask> ServerURL string `plist:",omitempty"` <mask> </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> add // payloadContent is a Device Management Profile payload. // // See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127. </s> remove DNSSettings dnsSettings </s> add PayloadDisplayName string PayloadDescription string </s> remove Name string PayloadDescription string PayloadDisplayName string PayloadIdentifier string </s> add DNSSettings *dnsSettings
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> ) <mask> <mask> type dnsSettings struct { <mask> DNSProtocol string <mask> ServerURL string `plist:",omitempty"` <mask> ServerName string `plist:",omitempty"` <mask> clientID string <mask> } <mask> <mask> type payloadContent struct { <mask> Name string <mask> PayloadDescription string </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove Name string PayloadDescription string PayloadDisplayName string PayloadIdentifier string </s> add DNSSettings *dnsSettings </s> remove DNSSettings dnsSettings </s> add PayloadDisplayName string PayloadDescription string </s> add // DNSProtocol is the required protocol to be used. The valid values // are "HTTPS" and "TLS". </s> add // payloadContent is a Device Management Profile payload. // // See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127. </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings.
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep add keep keep keep keep
<mask> } <mask> <mask> type payloadContent struct { <mask> DNSSettings *dnsSettings <mask> <mask> PayloadType string </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove Name string PayloadDescription string PayloadDisplayName string PayloadIdentifier string </s> add DNSSettings *dnsSettings </s> remove DNSSettings dnsSettings </s> add PayloadDisplayName string PayloadDescription string </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> remove PayloadContent []payloadContent </s> add PayloadContent []*payloadContent </s> add PayloadIdentifier string
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> clientID string <mask> } <mask> <mask> type payloadContent struct { <mask> Name string <mask> PayloadDescription string <mask> PayloadDisplayName string <mask> PayloadIdentifier string <mask> PayloadType string <mask> PayloadUUID string <mask> DNSSettings dnsSettings <mask> PayloadVersion int <mask> } </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove DNSSettings dnsSettings </s> add PayloadDisplayName string PayloadDescription string </s> add PayloadIdentifier string </s> remove PayloadContent []payloadContent </s> add PayloadContent []*payloadContent </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // payloadContent is a Device Management Profile payload. // // See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127.
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep add keep keep keep keep keep
<mask> <mask> PayloadType string <mask> PayloadUUID string <mask> PayloadDisplayName string <mask> PayloadDescription string <mask> PayloadVersion int <mask> } </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove DNSSettings dnsSettings </s> add PayloadDisplayName string PayloadDescription string </s> remove Name string PayloadDescription string PayloadDisplayName string PayloadIdentifier string </s> add DNSSettings *dnsSettings </s> remove PayloadContent []payloadContent </s> add PayloadContent []*payloadContent </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // payloadContent is a Device Management Profile payload. // // See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127.
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep keep replace keep keep keep keep keep
<mask> PayloadDisplayName string <mask> PayloadIdentifier string <mask> PayloadType string <mask> PayloadUUID string <mask> DNSSettings dnsSettings <mask> PayloadVersion int <mask> } <mask> <mask> type mobileConfig struct { <mask> PayloadDescription string </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove Name string PayloadDescription string PayloadDisplayName string PayloadIdentifier string </s> add DNSSettings *dnsSettings </s> add PayloadIdentifier string </s> remove PayloadContent []payloadContent </s> add PayloadContent []*payloadContent </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> add // payloadContent is a Device Management Profile payload. // // See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127. </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"`
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep add keep keep keep keep
<mask> } <mask> <mask> type mobileConfig struct { <mask> PayloadDescription string <mask> PayloadDisplayName string <mask> PayloadIdentifier string </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove DNSSettings dnsSettings </s> add PayloadDisplayName string PayloadDescription string </s> remove Name string PayloadDescription string PayloadDisplayName string PayloadIdentifier string </s> add DNSSettings *dnsSettings </s> add PayloadIdentifier string </s> remove PayloadContent []payloadContent </s> add PayloadContent []*payloadContent </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // payloadContent is a Device Management Profile payload. // // See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127.
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep keep replace keep keep keep keep keep
<mask> PayloadDisplayName string <mask> PayloadIdentifier string <mask> PayloadType string <mask> PayloadUUID string <mask> PayloadContent []payloadContent <mask> PayloadVersion int <mask> PayloadRemovalDisallowed bool <mask> } <mask> <mask> func genUUIDv4() string { </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> add PayloadIdentifier string </s> remove DNSSettings dnsSettings </s> add PayloadDisplayName string PayloadDescription string </s> remove Name string PayloadDescription string PayloadDisplayName string PayloadIdentifier string </s> add DNSSettings *dnsSettings </s> add // dnsSettingsPayloadType is the payload type for a DNSSettings profile. const dnsSettingsPayloadType = "com.apple.dnsSettings.managed" // mobileConfig contains the TopLevel properties for configuring Device // Management Profiles. // // See https://developer.apple.com/documentation/devicemanagement/toplevel. </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // payloadContent is a Device Management Profile payload. // // See https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles#3234127.
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep keep replace keep keep keep keep keep
<mask> dnsProtoHTTPS = "HTTPS" <mask> dnsProtoTLS = "TLS" <mask> ) <mask> <mask> func getMobileConfig(d dnsSettings) ([]byte, error) { <mask> var dspName string <mask> switch proto := d.DNSProtocol; proto { <mask> case dnsProtoHTTPS: <mask> dspName = fmt.Sprintf("%s DoH", d.ServerName) <mask> u := &url.URL{ </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove Path: path.Join("/dns-query", d.clientID), </s> add Path: path.Join("/dns-query", clientID), </s> remove if d.clientID != "" { d.ServerName = d.clientID + "." + d.ServerName </s> add if clientID != "" { d.ServerName = clientID + "." + d.ServerName </s> remove // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> add </s> remove assert.Equal(t, "https://example.org/dns-query", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query", s.ServerURL) </s> remove assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL) </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep replace keep keep keep keep replace replace keep keep keep
<mask> Host: d.ServerName, <mask> Path: path.Join("/dns-query", d.clientID), <mask> } <mask> d.ServerURL = u.String() <mask> // Empty the ServerName field since it is only must be presented <mask> // in DNS-over-TLS configuration. <mask> // <mask> // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. <mask> d.ServerName = "" <mask> case dnsProtoTLS: <mask> dspName = fmt.Sprintf("%s DoT", d.ServerName) </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove if d.clientID != "" { d.ServerName = d.clientID + "." + d.ServerName </s> add if clientID != "" { d.ServerName = clientID + "." + d.ServerName </s> remove func getMobileConfig(d dnsSettings) ([]byte, error) { </s> add func encodeMobileConfig(d *dnsSettings, clientID string) ([]byte, error) { </s> remove ServerURL string `plist:",omitempty"` ServerName string `plist:",omitempty"` clientID string </s> add // ServerURL is the URI template of the DoH server. It must be empty if // DNSProtocol is not "HTTPS". ServerURL string `plist:",omitempty"` // ServerName is the hostname of the DoT server. It must be empty if // DNSProtocol is not "TLS". ServerName string `plist:",omitempty"` // ServerAddresses is a list of plain DNS server IP addresses used to // resolve the hostname in ServerURL or ServerName. ServerAddresses []string `plist:",omitempty"` </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> add // DNSProtocol is the required protocol to be used. The valid values // are "HTTPS" and "TLS".
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. <mask> d.ServerName = "" <mask> case dnsProtoTLS: <mask> dspName = fmt.Sprintf("%s DoT", d.ServerName) <mask> if d.clientID != "" { <mask> d.ServerName = d.clientID + "." + d.ServerName <mask> } <mask> default: <mask> return nil, fmt.Errorf("bad dns protocol %q", proto) <mask> } <mask> </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> add </s> remove data := mobileConfig{ PayloadContent: []payloadContent{{ Name: dspName, PayloadDescription: "Configures device to use AdGuard Home", PayloadDisplayName: dspName, PayloadIdentifier: fmt.Sprintf("com.apple.dnsSettings.managed.%s", genUUIDv4()), PayloadType: "com.apple.dnsSettings.managed", </s> add payloadID := fmt.Sprintf("%s.%s", dnsSettingsPayloadType, genUUIDv4()) data := &mobileConfig{ PayloadDescription: "Adds AdGuard Home to macOS Big Sur " + "and iOS 14 or newer systems", PayloadDisplayName: dspName, PayloadIdentifier: genUUIDv4(), PayloadType: "Configuration", PayloadUUID: genUUIDv4(), PayloadContent: []*payloadContent{{ PayloadType: dnsSettingsPayloadType, PayloadIdentifier: payloadID, </s> remove func getMobileConfig(d dnsSettings) ([]byte, error) { </s> add func encodeMobileConfig(d *dnsSettings, clientID string) ([]byte, error) { </s> remove Path: path.Join("/dns-query", d.clientID), </s> add Path: path.Join("/dns-query", clientID), </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
<mask> default: <mask> return nil, fmt.Errorf("bad dns protocol %q", proto) <mask> } <mask> <mask> data := mobileConfig{ <mask> PayloadContent: []payloadContent{{ <mask> Name: dspName, <mask> PayloadDescription: "Configures device to use AdGuard Home", <mask> PayloadDisplayName: dspName, <mask> PayloadIdentifier: fmt.Sprintf("com.apple.dnsSettings.managed.%s", genUUIDv4()), <mask> PayloadType: "com.apple.dnsSettings.managed", <mask> PayloadUUID: genUUIDv4(), <mask> PayloadVersion: 1, <mask> DNSSettings: d, <mask> }}, <mask> PayloadDescription: "Adds AdGuard Home to Big Sur and iOS 14 or newer systems", </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove PayloadDescription: "Adds AdGuard Home to Big Sur and iOS 14 or newer systems", PayloadDisplayName: dspName, PayloadIdentifier: genUUIDv4(), PayloadRemovalDisallowed: false, PayloadType: "Configuration", PayloadUUID: genUUIDv4(), </s> add </s> add PayloadDisplayName: dspName, PayloadDescription: "Configures device to use AdGuard Home", </s> remove if d.clientID != "" { d.ServerName = d.clientID + "." + d.ServerName </s> add if clientID != "" { d.ServerName = clientID + "." + d.ServerName </s> add PayloadRemovalDisallowed: false, </s> remove err = configureOS(&config) </s> add err = configureOS(config) </s> remove // Return the uncutted value if it's either equal to zero or has </s> add // Return the uncut value if it's either equal to zero or has
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep add keep keep keep keep keep
<mask> PayloadContent: []*payloadContent{{ <mask> PayloadType: dnsSettingsPayloadType, <mask> PayloadIdentifier: payloadID, <mask> PayloadUUID: genUUIDv4(), <mask> PayloadVersion: 1, <mask> DNSSettings: d, <mask> }}, <mask> PayloadVersion: 1, <mask> PayloadRemovalDisallowed: false, </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove PayloadDescription: "Adds AdGuard Home to Big Sur and iOS 14 or newer systems", PayloadDisplayName: dspName, PayloadIdentifier: genUUIDv4(), PayloadRemovalDisallowed: false, PayloadType: "Configuration", PayloadUUID: genUUIDv4(), </s> add </s> remove data := mobileConfig{ PayloadContent: []payloadContent{{ Name: dspName, PayloadDescription: "Configures device to use AdGuard Home", PayloadDisplayName: dspName, PayloadIdentifier: fmt.Sprintf("com.apple.dnsSettings.managed.%s", genUUIDv4()), PayloadType: "com.apple.dnsSettings.managed", </s> add payloadID := fmt.Sprintf("%s.%s", dnsSettingsPayloadType, genUUIDv4()) data := &mobileConfig{ PayloadDescription: "Adds AdGuard Home to macOS Big Sur " + "and iOS 14 or newer systems", PayloadDisplayName: dspName, PayloadIdentifier: genUUIDv4(), PayloadType: "Configuration", PayloadUUID: genUUIDv4(), PayloadContent: []*payloadContent{{ PayloadType: dnsSettingsPayloadType, PayloadIdentifier: payloadID, </s> add PayloadRemovalDisallowed: false, </s> remove assert.Equal(t, "cli42.example.org", mc.PayloadContent[0].DNSSettings.ServerName) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Equal(t, "cli42.example.org", s.ServerName) assert.Empty(t, s.ServerURL) </s> add // DNSProtocol is the required protocol to be used. The valid values // are "HTTPS" and "TLS". </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings.
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
<mask> PayloadUUID: genUUIDv4(), <mask> PayloadVersion: 1, <mask> DNSSettings: d, <mask> }}, <mask> PayloadDescription: "Adds AdGuard Home to Big Sur and iOS 14 or newer systems", <mask> PayloadDisplayName: dspName, <mask> PayloadIdentifier: genUUIDv4(), <mask> PayloadRemovalDisallowed: false, <mask> PayloadType: "Configuration", <mask> PayloadUUID: genUUIDv4(), <mask> PayloadVersion: 1, <mask> } <mask> <mask> return plist.MarshalIndent(data, plist.XMLFormat, "\t") <mask> } </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove data := mobileConfig{ PayloadContent: []payloadContent{{ Name: dspName, PayloadDescription: "Configures device to use AdGuard Home", PayloadDisplayName: dspName, PayloadIdentifier: fmt.Sprintf("com.apple.dnsSettings.managed.%s", genUUIDv4()), PayloadType: "com.apple.dnsSettings.managed", </s> add payloadID := fmt.Sprintf("%s.%s", dnsSettingsPayloadType, genUUIDv4()) data := &mobileConfig{ PayloadDescription: "Adds AdGuard Home to macOS Big Sur " + "and iOS 14 or newer systems", PayloadDisplayName: dspName, PayloadIdentifier: genUUIDv4(), PayloadType: "Configuration", PayloadUUID: genUUIDv4(), PayloadContent: []*payloadContent{{ PayloadType: dnsSettingsPayloadType, PayloadIdentifier: payloadID, </s> add PayloadDisplayName: dspName, PayloadDescription: "Configures device to use AdGuard Home", </s> add PayloadRemovalDisallowed: false, </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> remove // Duration marshalling and unmarshalling cases. </s> add // Duration marshalling and unmarshaling cases. </s> remove // Return the uncutted value if it's either equal to zero or has </s> add // Return the uncut value if it's either equal to zero or has
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep add keep keep keep keep keep keep
<mask> DNSSettings: d, <mask> }}, <mask> PayloadVersion: 1, <mask> } <mask> <mask> return plist.MarshalIndent(data, plist.XMLFormat, "\t") <mask> } <mask> <mask> func respondJSONError(w http.ResponseWriter, status int, msg string) { </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove PayloadDescription: "Adds AdGuard Home to Big Sur and iOS 14 or newer systems", PayloadDisplayName: dspName, PayloadIdentifier: genUUIDv4(), PayloadRemovalDisallowed: false, PayloadType: "Configuration", PayloadUUID: genUUIDv4(), </s> add </s> add PayloadDisplayName: dspName, PayloadDescription: "Configures device to use AdGuard Home", </s> add // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> remove data := mobileConfig{ PayloadContent: []payloadContent{{ Name: dspName, PayloadDescription: "Configures device to use AdGuard Home", PayloadDisplayName: dspName, PayloadIdentifier: fmt.Sprintf("com.apple.dnsSettings.managed.%s", genUUIDv4()), PayloadType: "com.apple.dnsSettings.managed", </s> add payloadID := fmt.Sprintf("%s.%s", dnsSettingsPayloadType, genUUIDv4()) data := &mobileConfig{ PayloadDescription: "Adds AdGuard Home to macOS Big Sur " + "and iOS 14 or newer systems", PayloadDisplayName: dspName, PayloadIdentifier: genUUIDv4(), PayloadType: "Configuration", PayloadUUID: genUUIDv4(), PayloadContent: []*payloadContent{{ PayloadType: dnsSettingsPayloadType, PayloadIdentifier: payloadID, </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) return } </s> add httpError(w, http.StatusBadRequest, "%s", err) </s> remove req := applyConfigReq{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep keep replace replace replace replace keep keep replace keep keep
<mask> return <mask> } <mask> } <mask> <mask> d := dnsSettings{ <mask> DNSProtocol: dnsp, <mask> ServerName: host, <mask> clientID: clientID, <mask> } <mask> <mask> mobileconfig, err := getMobileConfig(d) <mask> if err != nil { <mask> respondJSONError(w, http.StatusInternalServerError, err.Error()) </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig) </s> remove copyInstallSettings(&config, &curConfig) </s> add copyInstallSettings(config, curConfig) </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add </s> remove req := applyConfigReq{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) return } </s> add httpError(w, http.StatusBadRequest, "%s", err)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep keep add keep keep keep keep keep
<mask> <mask> _, _ = w.Write(mobileconfig) <mask> } <mask> <mask> func handleMobileConfigDoH(w http.ResponseWriter, r *http.Request) { <mask> handleMobileConfig(w, r, dnsProtoHTTPS) <mask> } <mask> <mask> func handleMobileConfigDoT(w http.ResponseWriter, r *http.Request) { </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove req := applyConfigReq{} err := json.NewDecoder(r.Body).Decode(&req) </s> add req, restartHTTP, err := decodeApplyConfigReq(r.Body) </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) return } </s> add httpError(w, http.StatusBadRequest, "%s", err) </s> add PayloadRemovalDisallowed: false, </s> add setupBootstraps(t) </s> add setupBootstraps(t) </s> remove PayloadContent []payloadContent </s> add PayloadContent []*payloadContent
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig.go
keep keep add keep keep keep keep
<mask> "net/http/httptest" <mask> "testing" <mask> <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> "howett.net/plist" <mask> ) </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> add "github.com/AdguardTeam/golibs/stringutil" </s> add // dnsSettings is the DNSSetting.DNSSettings mobileconfig profile. // // See https://developer.apple.com/documentation/devicemanagement/dnssettings/dnssettings. </s> add "github.com/AdguardTeam/golibs/errors" </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove func getMobileConfig(d dnsSettings) ([]byte, error) { </s> add func encodeMobileConfig(d *dnsSettings, clientID string) ([]byte, error) { </s> remove restartHTTP := true if config.BindHost.Equal(req.Web.IP) && config.BindPort == req.Web.Port { // no need to rebind restartHTTP = false } // validate that hosts and ports are bindable if restartHTTP { err = aghnet.CheckPortAvailable(req.Web.IP, req.Web.Port) if err != nil { httpError( w, http.StatusBadRequest, "can not listen on IP:port %s: %s", netutil.JoinHostPort(req.Web.IP.String(), req.Web.Port), err, ) return } } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig_test.go
keep keep keep add keep keep keep keep
<mask> } <mask> } <mask> <mask> func TestHandleMobileConfigDoH(t *testing.T) { <mask> t.Run("success", func(t *testing.T) { <mask> r, err := http.NewRequest(http.MethodGet, "https://example.com:12345/apple/doh.mobileconfig?host=example.org", nil) <mask> require.NoError(t, err) <mask> </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> add setupBootstraps(t) </s> remove assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL) </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> add // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> remove httpError(w, http.StatusBadRequest, "Failed to parse 'configure' JSON: %s", err) return } </s> add httpError(w, http.StatusBadRequest, "%s", err)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> _, err = plist.Unmarshal(w.Body.Bytes(), &mc) <mask> require.NoError(t, err) <mask> <mask> require.Len(t, mc.PayloadContent, 1) <mask> assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) <mask> assert.Equal(t, "example.org DoH", mc.PayloadContent[0].PayloadDisplayName) <mask> assert.Equal(t, "https://example.org/dns-query", mc.PayloadContent[0].DNSSettings.ServerURL) <mask> }) <mask> <mask> t.Run("error_no_host", func(t *testing.T) { </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "https://example.org/dns-query", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query", s.ServerURL) </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL) </s> remove assert.Equal(t, "example.org", mc.PayloadContent[0].DNSSettings.ServerName) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Equal(t, "example.org", s.ServerName) assert.Empty(t, s.ServerURL)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> require.Len(t, mc.PayloadContent, 1) <mask> assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) <mask> assert.Equal(t, "example.org DoH", mc.PayloadContent[0].PayloadDisplayName) <mask> assert.Equal(t, "https://example.org/dns-query", mc.PayloadContent[0].DNSSettings.ServerURL) <mask> }) <mask> <mask> t.Run("error_no_host", func(t *testing.T) { <mask> oldTLSConf := Context.tls <mask> t.Cleanup(func() { Context.tls = oldTLSConf }) </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove assert.Equal(t, "example.org", mc.PayloadContent[0].DNSSettings.ServerName) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Equal(t, "example.org", s.ServerName) assert.Empty(t, s.ServerURL) </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL) </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig_test.go
keep keep keep replace keep keep keep keep keep keep keep keep replace keep keep keep keep
<mask> require.NoError(t, err) <mask> <mask> require.Len(t, mc.PayloadContent, 1) <mask> assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) <mask> assert.Equal(t, "example.org DoH", mc.PayloadContent[0].PayloadDisplayName) <mask> assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL) <mask> }) <mask> } <mask> <mask> require.Len(t, mc.PayloadContent, 1) <mask> assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) <mask> assert.Equal(t, "example.org DoH", mc.PayloadContent[0].PayloadDisplayName) <mask> assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL) <mask> }) <mask> } <mask> <mask> func TestHandleMobileConfigDoT(t *testing.T) { </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "https://example.org/dns-query", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query", s.ServerURL) </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "cli42.example.org", mc.PayloadContent[0].DNSSettings.ServerName) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Equal(t, "cli42.example.org", s.ServerName) assert.Empty(t, s.ServerURL)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig_test.go
keep keep add keep keep keep keep
<mask> } <mask> <mask> func TestHandleMobileConfigDoT(t *testing.T) { <mask> t.Run("success", func(t *testing.T) { <mask> r, err := http.NewRequest(http.MethodGet, "https://example.com:12345/apple/dot.mobileconfig?host=example.org", nil) <mask> require.NoError(t, err) <mask> </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> add setupBootstraps(t) </s> remove assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL) </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> add // cloneBootstrap returns a clone of the current bootstrap DNS servers. func cloneBootstrap() (bootstrap []string) { config.RLock() defer config.RUnlock() return stringutil.CloneSlice(config.DNS.BootstrapDNS) } </s> remove // Wait until fsnotify has triggerred and processed the // file-modification event. </s> add // Wait until fsnotify has triggered and processed the file-modification // event.
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> _, err = plist.Unmarshal(w.Body.Bytes(), &mc) <mask> require.NoError(t, err) <mask> <mask> require.Len(t, mc.PayloadContent, 1) <mask> assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) <mask> assert.Equal(t, "example.org DoT", mc.PayloadContent[0].PayloadDisplayName) <mask> assert.Equal(t, "example.org", mc.PayloadContent[0].DNSSettings.ServerName) <mask> }) <mask> <mask> t.Run("error_no_host", func(t *testing.T) { </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org", mc.PayloadContent[0].DNSSettings.ServerName) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Equal(t, "example.org", s.ServerName) assert.Empty(t, s.ServerURL) </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "cli42.example.org", mc.PayloadContent[0].DNSSettings.ServerName) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Equal(t, "cli42.example.org", s.ServerName) assert.Empty(t, s.ServerURL) </s> remove assert.Equal(t, "https://example.org/dns-query", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query", s.ServerURL)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> require.Len(t, mc.PayloadContent, 1) <mask> assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) <mask> assert.Equal(t, "example.org DoT", mc.PayloadContent[0].PayloadDisplayName) <mask> assert.Equal(t, "example.org", mc.PayloadContent[0].DNSSettings.ServerName) <mask> }) <mask> <mask> t.Run("error_no_host", func(t *testing.T) { <mask> oldTLSConf := Context.tls <mask> t.Cleanup(func() { Context.tls = oldTLSConf }) </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove assert.Equal(t, "https://example.org/dns-query", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query", s.ServerURL) </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "cli42.example.org", mc.PayloadContent[0].DNSSettings.ServerName) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Equal(t, "cli42.example.org", s.ServerName) assert.Empty(t, s.ServerURL) </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig_test.go
keep keep replace keep replace
<mask> <mask> require.Len(t, mc.PayloadContent, 1) <mask> assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) <mask> assert.Equal(t, "example.org DoT", mc.PayloadContent[0].PayloadDisplayName) <mask> assert.Equal(t, "cli42.example.org", mc.PayloadContent[0].DNSSettings.ServerName) </s> Pull request: home: add bootstrap to mobileconfig, imp code Updates #3568. Squashed commit of the following: commit ec342e6223e2b2efe9a8bf833d5406a44c6417e4 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 15:16:07 2021 +0300 home: imp tests commit 67cd771e631938d3e8a5340315314210de796174 Author: Ainar Garipov <[email protected]> Date: Mon Sep 13 14:34:03 2021 +0300 home: add bootstrap to mobileconfig, imp code </s> remove assert.Equal(t, "example.org DoT", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org", mc.PayloadContent[0].DNSSettings.ServerName) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Equal(t, "example.org", s.ServerName) assert.Empty(t, s.ServerURL) </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "example.org DoH", mc.PayloadContent[0].Name) </s> add </s> remove assert.Equal(t, "https://example.org/dns-query/cli42", mc.PayloadContent[0].DNSSettings.ServerURL) </s> add s := mc.PayloadContent[0].DNSSettings require.NotNil(t, s) assert.Equal(t, testBootstrapDNS, s.ServerAddresses) assert.Empty(t, s.ServerName) assert.Equal(t, "https://example.org/dns-query/cli42", s.ServerURL)
https://github.com/AdguardTeam/AdGuardHome/commit/424f20da985b043ce4a6c5b5830d3e414e832196
internal/home/mobileconfig_test.go
keep add keep keep keep keep
<mask> ) <mask> <mask> // OK responds with word OK. <mask> func OK(w http.ResponseWriter) { <mask> if _, err := io.WriteString(w, "OK\n"); err != nil { <mask> log.Error("couldn't write body: %s", err) </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove log.Debug("tx.Commit: %s", err) </s> add log.Error("stats: committing a transaction: %s", err) </s> remove log.Error("db.Begin: %s", err) </s> add log.Error("stats: opening a transaction: %s", err) </s> remove log.Tracef("db.Begin...") tx, err := db.Begin(wr) </s> add log.Tracef("opening a database transaction") tx, err := db.Begin(writable) </s> remove func (s *statsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> remove log.Tracef("db.Begin") </s> add log.Tracef("transaction has been opened") </s> remove err := os.Remove(s.conf.Filename) </s> add err := os.Remove(s.filename)
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/aghhttp/aghhttp.go
keep keep keep keep replace keep keep keep keep keep
<mask> import ( <mask> "encoding/json" <mask> "fmt" <mask> "net" <mask> "net/http" <mask> "path/filepath" <mask> "runtime" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove "net/http" </s> add </s> remove "net/http" </s> add </s> add "encoding" </s> remove "net/http" </s> add </s> remove "net/http" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/dhcpd/dhcpd.go
keep keep add keep keep keep keep
<mask> "runtime" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> ) <mask> </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove "net/http" </s> add </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> remove bolt "go.etcd.io/bbolt" </s> add "go.etcd.io/bbolt" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "sync/atomic" </s> remove "net/http" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/dhcpd/dhcpd.go
keep keep keep keep replace keep keep keep keep keep
<mask> // Called when the configuration is changed by HTTP request <mask> ConfigModified func() `yaml:"-"` <mask> <mask> // Register an HTTP handler <mask> HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` <mask> <mask> Enabled bool `yaml:"enabled"` <mask> InterfaceName string `yaml:"interface_name"` <mask> <mask> // LocalDomainName is the domain name used for DHCP hosts. For example, </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add HTTPRegister aghhttp.RegisterFunc </s> remove // Register an HTTP handler HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add // HTTPRegister is the function that registers handlers for the stats // endpoints. HTTPRegister aghhttp.RegisterFunc </s> remove // Called when the configuration is changed by HTTP request </s> add // ConfigModified will be called each time the configuration changed via web // interface. </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add HTTPRegister aghhttp.RegisterFunc </s> remove Filename string // database file name LimitDays uint32 // time limit (in days) UnitID unitIDCallback // user function to get the current unit ID. If nil, the current time hour is used. </s> add // UnitID is the function to generate the identifier for current unit. If // nil, the default function is used, see newUnitID. UnitID UnitIDGenFunc
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/dhcpd/dhcpd.go
keep keep keep keep replace keep keep keep keep keep
<mask> "crypto/tls" <mask> "crypto/x509" <mask> "fmt" <mask> "net" <mask> "net/http" <mask> "os" <mask> "sort" <mask> "strings" <mask> "time" <mask> </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove "net/http" </s> add </s> add "encoding" </s> add "sync/atomic" </s> remove "net/http" </s> add </s> remove "net/http" </s> add </s> remove "net/http" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/dnsforward/config.go
keep add keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtls" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/dnsproxy/proxy" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/errors" </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> remove "net/http" </s> add </s> add "sync/atomic" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> remove bolt "go.etcd.io/bbolt" </s> add "go.etcd.io/bbolt"
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/dnsforward/config.go
keep keep keep keep replace keep keep keep keep keep
<mask> // Called when the configuration is changed by HTTP request <mask> ConfigModified func() <mask> <mask> // Register an HTTP handler <mask> HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) <mask> <mask> // ResolveClients signals if the RDNS should resolve clients' addresses. <mask> ResolveClients bool <mask> <mask> // UsePrivateRDNS defines if the PTR requests for unknown addresses from </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove // Register an HTTP handler HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add // HTTPRegister is the function that registers handlers for the stats // endpoints. HTTPRegister aghhttp.RegisterFunc </s> remove // Called when the configuration is changed by HTTP request </s> add // ConfigModified will be called each time the configuration changed via web // interface. </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add HTTPRegister aghhttp.RegisterFunc </s> remove Filename string // database file name LimitDays uint32 // time limit (in days) UnitID unitIDCallback // user function to get the current unit ID. If nil, the current time hour is used. </s> add // UnitID is the function to generate the identifier for current unit. If // nil, the default function is used, see newUnitID. UnitID UnitIDGenFunc
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/dnsforward/config.go
keep keep keep keep replace keep keep keep keep keep
<mask> dnsProxy *proxy.Proxy // DNS proxy instance <mask> dnsFilter *filtering.DNSFilter // DNS filter instance <mask> dhcpServer dhcpd.ServerInterface // DHCP server instance (optional) <mask> queryLog querylog.QueryLog // Query log instance <mask> stats stats.Stats <mask> access *accessCtx <mask> <mask> // localDomainSuffix is the suffix used to detect internal hosts. It <mask> // must be a valid domain name plus dots on each side. <mask> localDomainSuffix string </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove stats stats.Stats // statistics module </s> add stats stats.Interface // statistics module </s> remove // It is still possible that the IP used to be in the runtime // clients list, but then the server was reloaded. So, check // the DNS server's blocked IP list. </s> add // It is still possible that the IP used to be in the runtime clients // list, but then the server was reloaded. So, check the DNS server's // blocked IP list. </s> remove Stats stats.Stats </s> add Stats stats.Interface </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> add // Domain is the domain name requested. </s> remove stats.Stats </s> add stats.Interface
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/dnsforward/dnsforward.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // DNSCreateParams are parameters to create a new server. <mask> type DNSCreateParams struct { <mask> DNSFilter *filtering.DNSFilter <mask> Stats stats.Stats <mask> QueryLog querylog.QueryLog <mask> DHCPServer dhcpd.ServerInterface <mask> PrivateNets netutil.SubnetSet <mask> Anonymizer *aghnet.IPMut <mask> LocalDomain string </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove stats stats.Stats </s> add stats stats.Interface </s> remove stats.Stats </s> add stats.Interface </s> remove Interval uint32 `yaml:"statistics_interval"` // time interval for statistics (in days) </s> add // Interval is the number of days for which the statistics are collected // before flushing to the database. Interval uint32 `yaml:"statistics_interval"` </s> remove // New - create object func New(conf Config) (Stats, error) { return createObject(conf) </s> add // LimitDays is the maximum number of days to collect statistics into the // current unit. LimitDays uint32 </s> remove stats stats.Stats // statistics module </s> add stats stats.Interface // statistics module </s> remove type unitIDCallback func() uint32 </s> add // UnitIDGenFunc is the signature of a function that generates a unique ID for // the statistics unit. type UnitIDGenFunc func() (id uint32)
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/dnsforward/dnsforward.go
keep keep keep keep replace keep keep keep keep keep
<mask> // testStats is a simple stats.Stats implementation for tests. <mask> type testStats struct { <mask> // Stats is embedded here simply to make testStats a stats.Stats without <mask> // actually implementing all methods. <mask> stats.Stats <mask> <mask> lastEntry stats.Entry <mask> } <mask> <mask> // Update implements the stats.Stats interface for *testStats. </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove Stats stats.Stats </s> add Stats stats.Interface </s> remove stats stats.Stats </s> add stats stats.Interface </s> remove // Close object. // This function is not thread safe // (can't be called in parallel with any other function of this interface). </s> add // Close stops the statistics collecting. </s> remove // New - create object func New(conf Config) (Stats, error) { return createObject(conf) </s> add // LimitDays is the maximum number of days to collect statistics into the // current unit. LimitDays uint32 </s> remove // Stats - main interface type Stats interface { </s> add // Interface is the statistics interface to be used by other packages. type Interface interface { // Start begins the statistics collecting. </s> remove stats stats.Stats // statistics module </s> add stats stats.Interface // statistics module
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/dnsforward/stats_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> "context" <mask> "fmt" <mask> "io/fs" <mask> "net" <mask> "net/http" <mask> "os" <mask> "runtime" <mask> "runtime/debug" <mask> "strings" <mask> "sync" </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove "net/http" </s> add </s> remove "net/http" </s> add </s> add "encoding" </s> add "sync/atomic" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> remove "net/http" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/filtering/filtering.go
keep keep keep add keep keep keep keep keep
<mask> "strings" <mask> "sync" <mask> "sync/atomic" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/cache" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> add "sync/atomic" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> remove "net/http" </s> add </s> add "encoding" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/filtering/filtering.go
keep keep keep keep replace keep keep keep keep keep
<mask> // Called when the configuration is changed by HTTP request <mask> ConfigModified func() `yaml:"-"` <mask> <mask> // Register an HTTP handler <mask> HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` <mask> <mask> // CustomResolver is the resolver used by DNSFilter. <mask> CustomResolver Resolver `yaml:"-"` <mask> } <mask> </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add HTTPRegister aghhttp.RegisterFunc </s> remove // Register an HTTP handler HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add // HTTPRegister is the function that registers handlers for the stats // endpoints. HTTPRegister aghhttp.RegisterFunc </s> remove // Called when the configuration is changed by HTTP request </s> add // ConfigModified will be called each time the configuration changed via web // interface. </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add HTTPRegister aghhttp.RegisterFunc </s> remove Filename string // database file name LimitDays uint32 // time limit (in days) UnitID unitIDCallback // user function to get the current unit ID. If nil, the current time hour is used. </s> add // UnitID is the function to generate the identifier for current unit. If // nil, the default function is used, see newUnitID. UnitID UnitIDGenFunc
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/filtering/filtering.go
keep keep keep add keep keep keep keep keep
<mask> package home <mask> <mask> import ( <mask> "bytes" <mask> "fmt" <mask> "net" <mask> "sort" <mask> "strings" <mask> "sync" </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove "net/http" </s> add </s> remove "net/http" </s> add </s> remove "net/http" </s> add </s> remove "net/http" </s> add </s> remove "net/http" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "sync/atomic"
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/home/clients.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> <mask> type runtimeClientJSON struct { <mask> WHOISInfo *RuntimeClientWHOISInfo `json:"whois_info"` <mask> <mask> Name string `json:"name"` <mask> Source string `json:"source"` <mask> IP net.IP `json:"ip"` <mask> } <mask> <mask> type clientListJSON struct { <mask> Clients []*clientJSON `json:"clients"` <mask> RuntimeClients []runtimeClientJSON `json:"auto_clients"` </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove // structure for storing data in file </s> add // unitDB is the structure for deserializing statistics data into the database. </s> remove Interval uint32 `yaml:"statistics_interval"` // time interval for statistics (in days) </s> add // Interval is the number of days for which the statistics are collected // before flushing to the database. Interval uint32 `yaml:"statistics_interval"` </s> remove Stats stats.Stats </s> add Stats stats.Interface </s> remove // Config - module configuration </s> add // Config is the configuration structure for the statistics collecting. </s> remove // top: domains map[string]uint64 // number of requests per domain blockedDomains map[string]uint64 // number of blocked requests per domain clients map[string]uint64 // number of requests per client </s> add old, s.curr = s.curr, with return old </s> remove rLast </s> add resultLast = RParental + 1
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/home/clientshttp.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> <mask> cj := runtimeClientJSON{ <mask> WHOISInfo: rc.WHOISInfo, <mask> <mask> Name: rc.Host, <mask> IP: ip, <mask> } <mask> <mask> cj.Source = "etc/hosts" <mask> switch rc.Source { <mask> case ClientSourceDHCP: <mask> cj.Source = "DHCP" <mask> case ClientSourceRDNS: <mask> cj.Source = "rDNS" <mask> case ClientSourceARP: <mask> cj.Source = "ARP" <mask> case ClientSourceWHOIS: <mask> cj.Source = "WHOIS" <mask> } <mask> <mask> data.RuntimeClients = append(data.RuntimeClients, cj) <mask> <mask> return true </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove if s.conf.limit == 0 { resp = statsResponse{ TimeUnits: "days", TopBlocked: []topAddrs{}, TopClients: []topAddrs{}, TopQueried: []topAddrs{}, BlockedFiltering: []uint64{}, DNSQueries: []uint64{}, ReplacedParental: []uint64{}, ReplacedSafebrowsing: []uint64{}, } } else { var ok bool resp, ok = s.getData() log.Debug("stats: prepared data in %v", time.Since(start)) if !ok { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't get statistics data") return } </s> add var ok bool resp, ok = s.getData() log.Debug("stats: prepared data in %v", time.Since(start)) if !ok { // Don't bring the message to the lower case since it's a part of UI // text for the moment. aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't get statistics data") return </s> remove // Atomically swap the currently active unit with a new value // Return old value func (s *statsCtx) swapUnit(new *unit) (u *unit) { s.mu.Lock() defer s.mu.Unlock() </s> add return err } </s> remove s.conf = &Config{} *s.conf = conf s.conf.limit = conf.LimitDays * 24 if conf.UnitID == nil { s.conf.UnitID = newUnitID </s> add if s.unitIDGen = newUnitID; conf.UnitID != nil { s.unitIDGen = conf.UnitID </s> remove func (s *statsCtx) loadUnitFromDB(tx *bolt.Tx, id uint32) *unitDB { </s> add func (s *StatsCtx) loadUnitFromDB(tx *bbolt.Tx, id uint32) *unitDB { </s> remove func convertTopSlice(a []countPair) []map[string]uint64 { m := []map[string]uint64{} </s> add func convertTopSlice(a []countPair) (m []map[string]uint64) { m = make([]map[string]uint64, 0, len(a)) </s> remove ent := map[string]uint64{} ent[it.Name] = it.Count m = append(m, ent) </s> add m = append(m, map[string]uint64{it.Name: it.Count})
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/home/clientshttp.go
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
<mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> e := json.NewEncoder(w).Encode(data) <mask> if e != nil { <mask> aghhttp.Error( <mask> r, <mask> w, <mask> http.StatusInternalServerError, <mask> "Failed to encode to json: %v", <mask> e, <mask> ) <mask> <mask> return <mask> } <mask> } <mask> </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove if s.conf.limit == 0 { resp = statsResponse{ TimeUnits: "days", TopBlocked: []topAddrs{}, TopClients: []topAddrs{}, TopQueried: []topAddrs{}, BlockedFiltering: []uint64{}, DNSQueries: []uint64{}, ReplacedParental: []uint64{}, ReplacedSafebrowsing: []uint64{}, } } else { var ok bool resp, ok = s.getData() log.Debug("stats: prepared data in %v", time.Since(start)) if !ok { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't get statistics data") return } </s> add var ok bool resp, ok = s.getData() log.Debug("stats: prepared data in %v", time.Since(start)) if !ok { // Don't bring the message to the lower case since it's a part of UI // text for the moment. aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't get statistics data") return </s> remove resp.IntervalDays = s.conf.limit / 24 </s> add resp.IntervalDays = s.limitHours / 24 </s> remove func (s *statsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) commitTxn(tx *bolt.Tx) { </s> add // commitTxn applies the changes made in tx to the database. func (s *StatsCtx) commitTxn(tx *bbolt.Tx) { </s> remove func serialize(u *unit) *unitDB { udb := unitDB{} udb.NTotal = u.nTotal udb.NResult = append(udb.NResult, u.nResult...) </s> add // serialize converts u to the *unitDB. It's safe for concurrent use. func (u *unit) serialize() (udb *unitDB) { u.mu.RLock() defer u.mu.RUnlock() </s> remove if s.db != nil { </s> add if db != nil {
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/home/clientshttp.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> // non-nil. <mask> func (clients *clientsContainer) findRuntime(ip net.IP, idStr string) (cj *clientJSON) { <mask> rc, ok := clients.FindRuntimeClient(ip) <mask> if !ok { <mask> // It is still possible that the IP used to be in the runtime <mask> // clients list, but then the server was reloaded. So, check <mask> // the DNS server's blocked IP list. <mask> // <mask> // See https://github.com/AdguardTeam/AdGuardHome/issues/2428. <mask> disallowed, rule := clients.dnsServer.IsBlockedClient(ip, idStr) <mask> cj = &clientJSON{ <mask> IDs: []string{idStr}, </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove stats stats.Stats </s> add stats stats.Interface </s> remove // Get IP addresses of the clients with the most number of requests </s> add // GetTopClientIP returns at most limit IP addresses corresponding to the // clients with the most number of requests. </s> remove // Update counters </s> add // Update collects the incoming statistics data. </s> remove // Stats - main interface type Stats interface { </s> add // Interface is the statistics interface to be used by other packages. type Interface interface { // Start begins the statistics collecting. </s> remove // WriteDiskConfig - write configuration </s> add // WriteDiskConfig puts the Interface's configuration to the dc. </s> remove TimeAvg uint32 // usec </s> add // TimeAvg is the average of processing times in milliseconds of all the // requests in the unit. TimeAvg uint32
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/home/clientshttp.go
keep keep keep keep replace keep keep keep keep keep
<mask> Context.mux.HandleFunc("/apple/dot.mobileconfig", postInstall(handleMobileConfigDoT)) <mask> RegisterAuthHandlers() <mask> } <mask> <mask> func httpRegister(method, url string, handler func(http.ResponseWriter, *http.Request)) { <mask> if method == "" { <mask> // "/dns-query" handler doesn't need auth, gzip and isn't restricted by 1 HTTP method <mask> Context.mux.HandleFunc(url, postInstall(handler)) <mask> return <mask> } </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove limit uint32 // maximum time we need to keep data for (in hours) } </s> add // Filename is the name of the database file. Filename string </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove // Register an HTTP handler HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add // HTTPRegister is the function that registers handlers for the stats // endpoints. HTTPRegister aghhttp.RegisterFunc </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add HTTPRegister aghhttp.RegisterFunc </s> remove // Called when the configuration is changed by HTTP request </s> add // ConfigModified will be called each time the configuration changed via web // interface.
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/home/control.go
keep keep keep keep replace keep keep keep keep keep
<mask> // Modules <mask> // -- <mask> <mask> clients clientsContainer // per-client-settings module <mask> stats stats.Stats // statistics module <mask> queryLog querylog.QueryLog // query log module <mask> dnsServer *dnsforward.Server // DNS module <mask> rdns *RDNS // rDNS module <mask> whois *WHOIS // WHOIS module <mask> dnsFilter *filtering.DNSFilter // DNS filtering module </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove stats stats.Stats </s> add stats stats.Interface </s> remove // DiskConfig - configuration settings that are stored on disk </s> add // DiskConfig is the configuration structure that is stored in file. </s> remove // Config - module configuration </s> add // Config is the configuration structure for the statistics collecting. </s> remove Interval uint32 `yaml:"statistics_interval"` // time interval for statistics (in days) </s> add // Interval is the number of days for which the statistics are collected // before flushing to the database. Interval uint32 `yaml:"statistics_interval"` </s> remove Filename string // database file name LimitDays uint32 // time limit (in days) UnitID unitIDCallback // user function to get the current unit ID. If nil, the current time hour is used. </s> add // UnitID is the function to generate the identifier for current unit. If // nil, the default function is used, see newUnitID. UnitID UnitIDGenFunc </s> remove // It is still possible that the IP used to be in the runtime // clients list, but then the server was reloaded. So, check // the DNS server's blocked IP list. </s> add // It is still possible that the IP used to be in the runtime clients // list, but then the server was reloaded. So, check the DNS server's // blocked IP list.
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/home/home.go
keep keep keep keep replace keep keep keep keep keep
<mask> package querylog <mask> <mask> import ( <mask> "net" <mask> "net/http" <mask> "path/filepath" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove "net/http" </s> add </s> remove "net/http" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "encoding" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> remove "net/http" </s> add </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/querylog/querylog.go
keep add keep keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/timeutil" <mask> "github.com/miekg/dns" </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove "net/http" </s> add </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "sync/atomic" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> remove bolt "go.etcd.io/bbolt" </s> add "go.etcd.io/bbolt"
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/querylog/querylog.go
keep keep keep keep replace keep keep keep keep keep
<mask> // example by HTTP requests. <mask> ConfigModified func() <mask> <mask> // HTTPRegister registers an HTTP handler. <mask> HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) <mask> <mask> // FindClient returns client information by their IDs. <mask> FindClient func(ids []string) (c *Client, err error) <mask> <mask> // BaseDir is the base directory for log files. </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove // Register an HTTP handler HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add // HTTPRegister is the function that registers handlers for the stats // endpoints. HTTPRegister aghhttp.RegisterFunc </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add HTTPRegister aghhttp.RegisterFunc </s> remove // Called when the configuration is changed by HTTP request </s> add // ConfigModified will be called each time the configuration changed via web // interface. </s> remove limit uint32 // maximum time we need to keep data for (in hours) } </s> add // Filename is the name of the database file. Filename string
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/querylog/querylog.go
keep keep keep keep replace keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep
<mask> ReplacedParental []uint64 `json:"replaced_parental"` <mask> } <mask> <mask> // handleStats is a handler for getting statistics. <mask> func (s *statsCtx) handleStats(w http.ResponseWriter, r *http.Request) { <mask> start := time.Now() <mask> <mask> var resp statsResponse <mask> if s.conf.limit == 0 { <mask> resp = statsResponse{ <mask> TimeUnits: "days", <mask> <mask> TopBlocked: []topAddrs{}, <mask> TopClients: []topAddrs{}, <mask> TopQueried: []topAddrs{}, <mask> <mask> BlockedFiltering: []uint64{}, <mask> DNSQueries: []uint64{}, <mask> ReplacedParental: []uint64{}, <mask> ReplacedSafebrowsing: []uint64{}, <mask> } <mask> } else { <mask> var ok bool <mask> resp, ok = s.getData() <mask> <mask> log.Debug("stats: prepared data in %v", time.Since(start)) <mask> <mask> if !ok { <mask> aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't get statistics data") <mask> <mask> return <mask> } <mask> } <mask> </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove func (s *statsCtx) getData() (statsResponse, bool) { limit := s.conf.limit </s> add func (s *StatsCtx) getData() (statsResponse, bool) { limit := atomic.LoadUint32(&s.limitHours) if limit == 0 { return statsResponse{ TimeUnits: "days", TopBlocked: []topAddrs{}, TopClients: []topAddrs{}, TopQueried: []topAddrs{}, BlockedFiltering: []uint64{}, DNSQueries: []uint64{}, ReplacedParental: []uint64{}, ReplacedSafebrowsing: []uint64{}, }, true } </s> remove resp.IntervalDays = s.conf.limit / 24 </s> add resp.IntervalDays = s.limitHours / 24 </s> remove func (s *statsCtx) handleStatsInfo(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsInfo(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) {
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/http.go
keep keep keep keep replace keep keep keep keep keep
<mask> IntervalDays uint32 `json:"interval"` <mask> } <mask> <mask> // Get configuration <mask> func (s *statsCtx) handleStatsInfo(w http.ResponseWriter, r *http.Request) { <mask> resp := config{} <mask> resp.IntervalDays = s.conf.limit / 24 <mask> <mask> data, err := json.Marshal(resp) <mask> if err != nil { </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove resp.IntervalDays = s.conf.limit / 24 </s> add resp.IntervalDays = s.limitHours / 24 </s> remove func (s *statsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) handleStats(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStats(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { </s> remove s.conf.ConfigModified() </s> add s.configModified() </s> remove func (s *statsCtx) WriteDiskConfig(dc *DiskConfig) { dc.Interval = s.conf.limit / 24 </s> add func (s *StatsCtx) WriteDiskConfig(dc *DiskConfig) { dc.Interval = atomic.LoadUint32(&s.limitHours) / 24
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/http.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // Get configuration <mask> func (s *statsCtx) handleStatsInfo(w http.ResponseWriter, r *http.Request) { <mask> resp := config{} <mask> resp.IntervalDays = s.conf.limit / 24 <mask> <mask> data, err := json.Marshal(resp) <mask> if err != nil { <mask> aghhttp.Error(r, w, http.StatusInternalServerError, "json encode: %s", err) <mask> </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove func (s *statsCtx) handleStatsInfo(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsInfo(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) handleStats(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStats(w http.ResponseWriter, r *http.Request) { </s> remove if s.conf.limit == 0 { resp = statsResponse{ TimeUnits: "days", TopBlocked: []topAddrs{}, TopClients: []topAddrs{}, TopQueried: []topAddrs{}, BlockedFiltering: []uint64{}, DNSQueries: []uint64{}, ReplacedParental: []uint64{}, ReplacedSafebrowsing: []uint64{}, } } else { var ok bool resp, ok = s.getData() log.Debug("stats: prepared data in %v", time.Since(start)) if !ok { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't get statistics data") return } </s> add var ok bool resp, ok = s.getData() log.Debug("stats: prepared data in %v", time.Since(start)) if !ok { // Don't bring the message to the lower case since it's a part of UI // text for the moment. aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't get statistics data") return </s> remove func (s *statsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { </s> remove aghhttp.Error( r, w, http.StatusInternalServerError, "Failed to encode to json: %v", e, ) </s> add aghhttp.Error(r, w, http.StatusInternalServerError, "failed to encode to json: %v", e)
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/http.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> } <mask> <mask> // Set configuration <mask> func (s *statsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { <mask> reqData := config{} <mask> err := json.NewDecoder(r.Body).Decode(&reqData) <mask> if err != nil { <mask> aghhttp.Error(r, w, http.StatusBadRequest, "json decode: %s", err) <mask> </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove resp.IntervalDays = s.conf.limit / 24 </s> add resp.IntervalDays = s.limitHours / 24 </s> remove func (s *statsCtx) handleStatsInfo(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsInfo(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) handleStats(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStats(w http.ResponseWriter, r *http.Request) { </s> remove log.Debug("tx.Commit: %s", err) </s> add log.Error("stats: committing a transaction: %s", err) </s> remove s.conf.ConfigModified() </s> add s.configModified()
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/http.go
keep keep keep replace keep keep keep replace keep keep
<mask> } <mask> <mask> s.setLimit(int(reqData.IntervalDays)) <mask> s.conf.ConfigModified() <mask> } <mask> <mask> // Reset data <mask> func (s *statsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { <mask> s.clear() <mask> } </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove func (s *statsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) handleStatsInfo(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsInfo(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) handleStats(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStats(w http.ResponseWriter, r *http.Request) { </s> remove if s.conf.limit == 0 { resp = statsResponse{ TimeUnits: "days", TopBlocked: []topAddrs{}, TopClients: []topAddrs{}, TopQueried: []topAddrs{}, BlockedFiltering: []uint64{}, DNSQueries: []uint64{}, ReplacedParental: []uint64{}, ReplacedSafebrowsing: []uint64{}, } } else { var ok bool resp, ok = s.getData() log.Debug("stats: prepared data in %v", time.Since(start)) if !ok { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't get statistics data") return } </s> add var ok bool resp, ok = s.getData() log.Debug("stats: prepared data in %v", time.Since(start)) if !ok { // Don't bring the message to the lower case since it's a part of UI // text for the moment. aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't get statistics data") return </s> remove func (s *statsCtx) initWeb() { if s.conf.HTTPRegister == nil { </s> add func (s *StatsCtx) initWeb() { if s.httpRegister == nil {
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/http.go
keep keep replace replace keep keep keep replace replace replace replace
<mask> <mask> // Register web handlers <mask> func (s *statsCtx) initWeb() { <mask> if s.conf.HTTPRegister == nil { <mask> return <mask> } <mask> <mask> s.conf.HTTPRegister(http.MethodGet, "/control/stats", s.handleStats) <mask> s.conf.HTTPRegister(http.MethodPost, "/control/stats_reset", s.handleStatsReset) <mask> s.conf.HTTPRegister(http.MethodPost, "/control/stats_config", s.handleStatsConfig) <mask> s.conf.HTTPRegister(http.MethodGet, "/control/stats_info", s.handleStatsInfo) </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove func (s *statsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { </s> add func (s *StatsCtx) handleStatsReset(w http.ResponseWriter, r *http.Request) { </s> remove func (s *statsCtx) GetTopClientsIP(maxCount uint) []net.IP { if s.conf.limit == 0 { </s> add func (s *StatsCtx) GetTopClientsIP(maxCount uint) []net.IP { if !s.isEnabled() { </s> remove func (s *statsCtx) loadUnitFromDB(tx *bolt.Tx, id uint32) *unitDB { </s> add func (s *StatsCtx) loadUnitFromDB(tx *bbolt.Tx, id uint32) *unitDB { </s> remove func (s *statsCtx) Update(e Entry) { if s.conf.limit == 0 { </s> add func (s *StatsCtx) Update(e Entry) { if !s.isEnabled() { </s> remove units, _ := s.loadUnits(s.conf.limit) </s> add units, _ := s.loadUnits(atomic.LoadUint32(&s.limitHours))
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/http.go
keep keep keep keep replace keep keep replace
<mask> package stats <mask> <mask> import ( <mask> "net" <mask> "net/http" <mask> ) <mask> <mask> type unitIDCallback func() uint32 </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove "net/http" </s> add </s> add "encoding" </s> remove "net/http" </s> add </s> remove // DiskConfig - configuration settings that are stored on disk </s> add // DiskConfig is the configuration structure that is stored in file. </s> remove "net/http" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/stats.go
keep keep keep keep replace keep replace
<mask> ) <mask> <mask> type unitIDCallback func() uint32 <mask> <mask> // DiskConfig - configuration settings that are stored on disk <mask> type DiskConfig struct { <mask> Interval uint32 `yaml:"statistics_interval"` // time interval for statistics (in days) </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove type unitIDCallback func() uint32 </s> add // UnitIDGenFunc is the signature of a function that generates a unique ID for // the statistics unit. type UnitIDGenFunc func() (id uint32) </s> remove "net/http" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> remove // Config - module configuration </s> add // Config is the configuration structure for the statistics collecting. </s> remove Filename string // database file name LimitDays uint32 // time limit (in days) UnitID unitIDCallback // user function to get the current unit ID. If nil, the current time hour is used. </s> add // UnitID is the function to generate the identifier for current unit. If // nil, the default function is used, see newUnitID. UnitID UnitIDGenFunc </s> remove // New - create object func New(conf Config) (Stats, error) { return createObject(conf) </s> add // LimitDays is the maximum number of days to collect statistics into the // current unit. LimitDays uint32
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/stats.go
keep keep keep replace keep replace replace replace keep keep
<mask> Interval uint32 `yaml:"statistics_interval"` // time interval for statistics (in days) <mask> } <mask> <mask> // Config - module configuration <mask> type Config struct { <mask> Filename string // database file name <mask> LimitDays uint32 // time limit (in days) <mask> UnitID unitIDCallback // user function to get the current unit ID. If nil, the current time hour is used. <mask> <mask> // Called when the configuration is changed by HTTP request </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove // Called when the configuration is changed by HTTP request </s> add // ConfigModified will be called each time the configuration changed via web // interface. </s> remove Interval uint32 `yaml:"statistics_interval"` // time interval for statistics (in days) </s> add // Interval is the number of days for which the statistics are collected // before flushing to the database. Interval uint32 `yaml:"statistics_interval"` </s> remove // DiskConfig - configuration settings that are stored on disk </s> add // DiskConfig is the configuration structure that is stored in file. </s> remove type unitIDCallback func() uint32 </s> add // UnitIDGenFunc is the signature of a function that generates a unique ID for // the statistics unit. type UnitIDGenFunc func() (id uint32) </s> remove // Register an HTTP handler HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add // HTTPRegister is the function that registers handlers for the stats // endpoints. HTTPRegister aghhttp.RegisterFunc
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/stats.go
keep replace keep keep keep keep keep keep keep keep replace replace keep keep keep keep
<mask> <mask> // Called when the configuration is changed by HTTP request <mask> ConfigModified func() <mask> <mask> // Register an HTTP handler <mask> HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) <mask> <mask> // Called when the configuration is changed by HTTP request <mask> ConfigModified func() <mask> <mask> // Register an HTTP handler <mask> HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) <mask> <mask> limit uint32 // maximum time we need to keep data for (in hours) <mask> } <mask> </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add HTTPRegister aghhttp.RegisterFunc </s> remove limit uint32 // maximum time we need to keep data for (in hours) } </s> add // Filename is the name of the database file. Filename string </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add HTTPRegister aghhttp.RegisterFunc
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/stats.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> <mask> // Register an HTTP handler <mask> HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) <mask> <mask> limit uint32 // maximum time we need to keep data for (in hours) <mask> } <mask> <mask> // New - create object <mask> func New(conf Config) (Stats, error) { <mask> return createObject(conf) <mask> } </s> Pull request: 4358 fix stats Merge in DNS/adguard-home from 4358-fix-stats to master Updates #4358. Updates #4342. Squashed commit of the following: commit 5683cb304688ea639e5ba7f219a7bf12370211a4 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 18:20:54 2022 +0300 stats: rm races test commit 63dd67650ed64eaf9685b955a4fdf3c0067a7f8c Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 17:13:36 2022 +0300 stats: try to imp test commit 59a0f249fc00566872db62e362c87bc0c201b333 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 16:38:57 2022 +0300 stats: fix nil ptr deref commit 7fc3ff18a34a1d0e0fec3ca83a33f499ac752572 Author: Eugene Burkov <[email protected]> Date: Thu Apr 7 16:02:51 2022 +0300 stats: fix races finally, imp tests commit c63f5f4e7929819fe79b3a1e392f6b91cd630846 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:56:49 2022 +0300 aghhttp: add register func commit 61adc7f0e95279c1b7f4a0c0af5ab387ee461411 Merge: edbdb2d4 9b3adac1 Author: Eugene Burkov <[email protected]> Date: Thu Aug 4 00:36:01 2022 +0300 Merge branch 'master' into 4358-fix-stats commit edbdb2d4c6a06dcbf8107a28c4c3a61ba394e907 Merge: a91e4d7a a481ff4c Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 21:00:42 2022 +0300 Merge branch 'master' into 4358-fix-stats commit a91e4d7af13591eeef45cb7980d1ebc1650a5cb7 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:46:19 2022 +0300 stats: imp code, docs commit c5f3814c5c1a734ca8ff6726cc9ffc1177a055cf Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:16:13 2022 +0300 all: log changes commit 5e6caafc771dddc4c6be07c34658de359106fbe5 Merge: 091ba756 eb8e8166 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:09:10 2022 +0300 Merge branch 'master' into 4358-fix-stats commit 091ba75618d3689b9c04f05431283417c8cc52f9 Author: Eugene Burkov <[email protected]> Date: Wed Aug 3 18:07:39 2022 +0300 stats: imp docs, code commit f2b2de77ce5f0448d6df9232a614a3710f1e2e8a Author: Eugene Burkov <[email protected]> Date: Tue Aug 2 17:09:30 2022 +0300 all: refactor stats & add mutexes commit b3f11c455ceaa3738ec20eefc46f866ff36ed046 Author: Eugene Burkov <[email protected]> Date: Wed Apr 27 15:30:09 2022 +0300 WIP </s> remove // Register an HTTP handler HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add // HTTPRegister is the function that registers handlers for the stats // endpoints. HTTPRegister aghhttp.RegisterFunc </s> remove // New - create object func New(conf Config) (Stats, error) { return createObject(conf) </s> add // LimitDays is the maximum number of days to collect statistics into the // current unit. LimitDays uint32 </s> remove // Called when the configuration is changed by HTTP request </s> add // ConfigModified will be called each time the configuration changed via web // interface. </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) `yaml:"-"` </s> add HTTPRegister aghhttp.RegisterFunc `yaml:"-"` </s> remove HTTPRegister func(string, string, func(http.ResponseWriter, *http.Request)) </s> add HTTPRegister aghhttp.RegisterFunc
https://github.com/AdguardTeam/AdGuardHome/commit/4293cf5945a9331fd8ce1eb33a88865c6b8713cc
internal/stats/stats.go