docstring_tokens
stringlengths 18
16.9k
| code_tokens
stringlengths 75
1.81M
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|
keep keep keep keep replace keep keep keep keep keep | <mask> "use_adguard_browsing_sec_hint": "AdGuard Home akan mengecek jika domain diblacklist oleh layanan web keamanan penjelajahan. Akan menggunakan lookup API yang ramah privasi untuk melakukan cek: hanya awalan singkat hash SHA256 dari nama domain yang dikirim ke server.",
<mask> "use_adguard_parental": "Gunakan layanan web kontrol orang tua AdGuard",
<mask> "use_adguard_parental_hint": "AdGuard Home akan mengecek jika domain mengandung materi dewasa. Akan menggunakan API yang ramah privasi yang sama sebagai layanan web keamanan penjelajahan.",
<mask> "enforce_safe_search": "Paksa penelusuran aman",
<mask> "enforce_save_search_hint": "AdGuard Home dapat memaksa penelusuran aman pada mesin pencari berikut: Google, Youtube, Bing, dan Yandex.",
<mask> "no_servers_specified": "Sever tidak disebutkan",
<mask> "general_settings": "Pengaturan umum",
<mask> "dns_settings": "Pengaturan DNS",
<mask> "encryption_settings": "Pengaturan enkripsi",
<mask> "dhcp_settings": "Pengaturan DHCP",
</s> - client: allow add ip-v6 to exceptions </s> remove "enforce_save_search_hint": "AdGuard Home kan veilig zoeken forceren voor de volgende zoekmachines: Google, Youtube, Bing, en Yandex.",
</s> add </s> remove "example_regex_meaning": "blokir akses ke domain yang cocok dengan ekspresi reguler yang ditentukan",
</s> add </s> remove "form_error_ip_format": "Format IPv4 tidak valid",
</s> add </s> remove "example_regex_meaning": "blokkeer de toegang tot de domeinen die overeenkomen met de opgegeven reguliere expressie",
</s> add </s> remove "form_error_ip_format": "Ongeldig IPv4 formaat",
</s> add </s> add return <Trans>form_error_ip4_format</Trans>;
}
return false;
};
export const ipv6 = (value) => {
if (value && !new RegExp(R_IPV6).test(value)) {
return <Trans>form_error_ip6_format</Trans>;
}
return false;
};
export const ip = (value) => {
if (value && !new RegExp(R_IPV4).test(value) && !new RegExp(R_IPV6).test(value)) { | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/__locales/id.json |
keep keep keep keep replace keep keep keep keep keep | <mask> "example_meaning_host_block": "AdGuard Home sekarang akan mengembalikan alamat 127.0.0.1 untuk domain example.org (namun tidak subdomainnya)",
<mask> "example_comment": "! Komentar di sini",
<mask> "example_comment_meaning": "hanya sebuah komentar",
<mask> "example_comment_hash": "Juga sebuah komentar",
<mask> "example_regex_meaning": "blokir akses ke domain yang cocok dengan ekspresi reguler yang ditentukan",
<mask> "example_upstream_regular": "DNS reguler (melalui UDP)",
<mask> "example_upstream_dot": "terenkripsi <a href='https://en.wikipedia.org/wiki/DNS_over_TLS' target='_blank'>DNS-over-TLS</a>",
<mask> "example_upstream_doh": "terenkripsi <a href='https://en.wikipedia.org/wiki/DNS_over_HTTPS' target='_blank'>DNS-over-HTTPS</a>",
<mask> "example_upstream_sdns": "anda bisa menggunakan <a href='https://dnscrypt.info/stamps/' target='_blank'>Stempel DNS</a> untuk <a href='https://dnscrypt.info/' target='_blank'>DNSCrypt</a> atau pengarah <a href='https://en.wikipedia.org/wiki/DNS_over_HTTPS' target='_blank'>DNS-over-HTTPS</a>",
<mask> "example_upstream_tcp": "DNS reguler (melalui TCP)",
</s> - client: allow add ip-v6 to exceptions </s> remove "example_regex_meaning": "blokkeer de toegang tot de domeinen die overeenkomen met de opgegeven reguliere expressie",
</s> add </s> add "example_regex_meaning": "blocca l'accesso ai domini che corrispondono alla specifica espressione regolare", </s> remove "enforce_save_search_hint": "AdGuard Home dapat memaksa penelusuran aman pada mesin pencari berikut: Google, Youtube, Bing, dan Yandex.",
</s> add </s> remove "form_error_ip_format": "Format IPv4 tidak valid",
</s> add </s> remove "enforce_save_search_hint": "AdGuard Home kan veilig zoeken forceren voor de volgende zoekmachines: Google, Youtube, Bing, en Yandex.",
</s> add </s> add "encryption_certificate_path": "Percorso di certificato",
"encryption_private_key_path": "Percorso della chiave privata",
"encryption_certificates_source_path": "Definisci un percorso alle file dei certificati",
"encryption_certificates_source_content": "Incolla i contenuti di certificato",
"encryption_key_source_path": "Imposta un file chiave privata",
"encryption_key_source_content": "Incolla i contenuti della chiave privata", | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/__locales/id.json |
keep keep keep keep replace keep keep keep keep keep | <mask> "dhcp_static_leases": "Leases DHCP statici",
<mask> "dhcp_leases_not_found": "Nessun lease DHCP trovato",
<mask> "dhcp_config_saved": "Configurazione server DHCP salvata",
<mask> "form_error_required": "Campo richiesto",
<mask> "form_error_ip_format": "Formato IPv4 non valido",
<mask> "form_error_mac_format": "Formato MAC non valido",
<mask> "form_error_positive": "Deve essere maggiore di 0",
<mask> "dhcp_form_gateway_input": "IP Gateway",
<mask> "dhcp_form_subnet_input": "Subnet mask",
<mask> "dhcp_form_range_title": "Range indirizzi IP",
</s> - client: allow add ip-v6 to exceptions </s> remove "form_error_ip_format": "Format IPv4 tidak valid",
</s> add </s> remove "form_error_ip_format": "Invalid IPv4 format",
</s> add "form_error_ip4_format": "Invalid IPv4 format",
"form_error_ip6_format": "Invalid IPv6 format",
"form_error_ip_format": "Invalid IP format", </s> remove "form_error_ip_format": "Ongeldig IPv4 formaat",
</s> add </s> add "encryption_certificate_path": "Percorso di certificato",
"encryption_private_key_path": "Percorso della chiave privata",
"encryption_certificates_source_path": "Definisci un percorso alle file dei certificati",
"encryption_certificates_source_content": "Incolla i contenuti di certificato",
"encryption_key_source_path": "Imposta un file chiave privata",
"encryption_key_source_content": "Incolla i contenuti della chiave privata", </s> remove "example_regex_meaning": "blokir akses ke domain yang cocok dengan ekspresi reguler yang ditentukan",
</s> add </s> add return <Trans>form_error_ip4_format</Trans>;
}
return false;
};
export const ipv6 = (value) => {
if (value && !new RegExp(R_IPV6).test(value)) {
return <Trans>form_error_ip6_format</Trans>;
}
return false;
};
export const ip = (value) => {
if (value && !new RegExp(R_IPV4).test(value) && !new RegExp(R_IPV6).test(value)) { | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/__locales/it.json |
keep add keep keep keep keep | <mask> "example_comment_meaning": "un commento",
<mask> "example_comment_hash": "# Un altro commento",
<mask> "example_upstream_regular": "DNS regolari (via UDP)",
<mask> "example_upstream_dot": "<a href='https://en.wikipedia.org/wiki/DNS_over_TLS' target='_blank'>DNS-over-TLS</a> criptato",
<mask> "example_upstream_doh": "<a href='https://en.wikipedia.org/wiki/DNS_over_HTTPS' target='_blank'>DNS-over-HTTPS</a> criptato",
<mask> "example_upstream_sdns": "puoi usare <a href='https://dnscrypt.info/stamps/' target='_blank'>DNS Stamps</a> per <a href='https://dnscrypt.info/' target='_blank'>DNSCrypt</a> oppure dei resolver con <a href='https://en.wikipedia.org/wiki/DNS_over_HTTPS' target='_blank'>DNS-over-HTTPS</a>",
</s> - client: allow add ip-v6 to exceptions </s> remove "example_regex_meaning": "blokkeer de toegang tot de domeinen die overeenkomen met de opgegeven reguliere expressie",
</s> add </s> remove "example_regex_meaning": "blokir akses ke domain yang cocok dengan ekspresi reguler yang ditentukan",
</s> add </s> add "encryption_certificate_path": "Percorso di certificato",
"encryption_private_key_path": "Percorso della chiave privata",
"encryption_certificates_source_path": "Definisci un percorso alle file dei certificati",
"encryption_certificates_source_content": "Incolla i contenuti di certificato",
"encryption_key_source_path": "Imposta un file chiave privata",
"encryption_key_source_content": "Incolla i contenuti della chiave privata", </s> remove "enforce_save_search_hint": "AdGuard Home kan veilig zoeken forceren voor de volgende zoekmachines: Google, Youtube, Bing, en Yandex.",
</s> add </s> add return <Trans>form_error_ip4_format</Trans>;
}
return false;
};
export const ipv6 = (value) => {
if (value && !new RegExp(R_IPV6).test(value)) {
return <Trans>form_error_ip6_format</Trans>;
}
return false;
};
export const ip = (value) => {
if (value && !new RegExp(R_IPV4).test(value) && !new RegExp(R_IPV6).test(value)) { </s> remove validate={[ipv4, required]}
</s> add validate={[ip, required]} | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/__locales/it.json |
keep keep add keep keep keep keep | <mask> "blocked_service": "Servizio bloccato",
<mask> "block_all": "Blocca tutto",
<mask> "unblock_all": "Sblocca tutto",
<mask> "stats_params": "Configurazione delle statistiche",
<mask> "config_successfully_saved": "Configurazione salvata correttamente",
<mask> "interval_24_hour": "24 ore",
<mask> "interval_days": "{{count}} giorni",
</s> - client: allow add ip-v6 to exceptions </s> remove "form_error_ip_format": "Formato IPv4 non valido",
</s> add </s> add return <Trans>form_error_ip4_format</Trans>;
}
return false;
};
export const ipv6 = (value) => {
if (value && !new RegExp(R_IPV6).test(value)) {
return <Trans>form_error_ip6_format</Trans>;
}
return false;
};
export const ip = (value) => {
if (value && !new RegExp(R_IPV4).test(value) && !new RegExp(R_IPV6).test(value)) { </s> remove validate={[ipv4, required]}
</s> add validate={[ip, required]} </s> remove import { renderField, renderRadioField, renderSelectField, renderServiceField, ipv4, mac, required } from '../../../helpers/form';
</s> add import { renderField, renderRadioField, renderSelectField, renderServiceField, ip, mac, required } from '../../../helpers/form'; </s> remove "example_regex_meaning": "blokkeer de toegang tot de domeinen die overeenkomen met de opgegeven reguliere expressie",
</s> add </s> remove "enforce_save_search_hint": "AdGuard Home kan veilig zoeken forceren voor de volgende zoekmachines: Google, Youtube, Bing, en Yandex.",
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/__locales/it.json |
keep keep keep keep replace keep keep keep keep keep | <mask> "dhcp_leases": "DHCP lease overzicht",
<mask> "dhcp_leases_not_found": "Geen DHCP lease gevonden",
<mask> "dhcp_config_saved": "DHCP server configuratie opgeslagen",
<mask> "form_error_required": "Vereist veld",
<mask> "form_error_ip_format": "Ongeldig IPv4 formaat",
<mask> "form_error_mac_format": "Ongeldig MAC formaat.",
<mask> "form_error_positive": "Moet groter zijn dan 0",
<mask> "dhcp_form_gateway_input": "Gateway IP",
<mask> "dhcp_form_subnet_input": "Subnet mask",
<mask> "dhcp_form_range_title": "Bereik van IP adressen",
</s> - client: allow add ip-v6 to exceptions </s> remove "form_error_ip_format": "Invalid IPv4 format",
</s> add "form_error_ip4_format": "Invalid IPv4 format",
"form_error_ip6_format": "Invalid IPv6 format",
"form_error_ip_format": "Invalid IP format", </s> remove "form_error_ip_format": "Format IPv4 tidak valid",
</s> add </s> remove "form_error_ip_format": "Formato IPv4 non valido",
</s> add </s> remove "enforce_save_search_hint": "AdGuard Home kan veilig zoeken forceren voor de volgende zoekmachines: Google, Youtube, Bing, en Yandex.",
</s> add </s> remove "enforce_save_search_hint": "AdGuard Home dapat memaksa penelusuran aman pada mesin pencari berikut: Google, Youtube, Bing, dan Yandex.",
</s> add </s> add return <Trans>form_error_ip4_format</Trans>;
}
return false;
};
export const ipv6 = (value) => {
if (value && !new RegExp(R_IPV6).test(value)) {
return <Trans>form_error_ip6_format</Trans>;
}
return false;
};
export const ip = (value) => {
if (value && !new RegExp(R_IPV4).test(value) && !new RegExp(R_IPV6).test(value)) { | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/__locales/nl.json |
keep keep keep keep replace keep keep keep keep keep | <mask> "use_adguard_browsing_sec_hint": "AdGuard Home controleert of het domein in de blokkeerlijst voorkomt dmv Browsing Security web service. Dit gebeurt dmv een privacy vriendelijk API verzoek:een korte prefix van de domein naam met SHA256 hash wordt verzonden naar de server.",
<mask> "use_adguard_parental": "Gebruik AdGuard Ouderlijk toezicht web service",
<mask> "use_adguard_parental_hint": "AdGuard Home controleert of het domein 18+ content bevat. Dit gebeurt dmv dezelfde privacy vriendelijke API als de Browsing Security web service.",
<mask> "enforce_safe_search": "Forceer Veilig Zoeken",
<mask> "enforce_save_search_hint": "AdGuard Home kan veilig zoeken forceren voor de volgende zoekmachines: Google, Youtube, Bing, en Yandex.",
<mask> "no_servers_specified": "Geen servers gespecificeerd",
<mask> "general_settings": "Generieke instellingen",
<mask> "dns_settings": "DNS Instellingen",
<mask> "encryption_settings": "Encryptie Instellingen",
<mask> "dhcp_settings": "DHCP Instellingen",
</s> - client: allow add ip-v6 to exceptions </s> remove "enforce_save_search_hint": "AdGuard Home dapat memaksa penelusuran aman pada mesin pencari berikut: Google, Youtube, Bing, dan Yandex.",
</s> add </s> remove "example_regex_meaning": "blokkeer de toegang tot de domeinen die overeenkomen met de opgegeven reguliere expressie",
</s> add </s> remove "example_regex_meaning": "blokir akses ke domain yang cocok dengan ekspresi reguler yang ditentukan",
</s> add </s> remove "form_error_ip_format": "Ongeldig IPv4 formaat",
</s> add </s> remove "form_error_ip_format": "Invalid IPv4 format",
</s> add "form_error_ip4_format": "Invalid IPv4 format",
"form_error_ip6_format": "Invalid IPv6 format",
"form_error_ip_format": "Invalid IP format", </s> remove "form_error_ip_format": "Format IPv4 tidak valid",
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/__locales/nl.json |
keep keep keep keep replace keep keep keep keep keep | <mask> "example_meaning_host_block": "AdGuard Home zal nu het adres 127.0.0.1 voor het domein example.org retourneren (maar niet de subdomeinen).",
<mask> "example_comment": "! Hier komt een opmerking",
<mask> "example_comment_meaning": "zomaar een opmerking",
<mask> "example_comment_hash": "# Nog een opmerking",
<mask> "example_regex_meaning": "blokkeer de toegang tot de domeinen die overeenkomen met de opgegeven reguliere expressie",
<mask> "example_upstream_regular": "standaard DNS (over UDP)",
<mask> "example_upstream_dot": "versleutelde<a href='https://en.wikipedia.org/wiki/DNS_over_TLS' target='_blank'>DNS-over-TLS</a>",
<mask> "example_upstream_doh": "versleutelde<a href='https://en.wikipedia.org/wiki/DNS_over_HTTPS' target='_blank'>DNS-over-HTTPS</a>",
<mask> "example_upstream_sdns": "je kunt <a href='https://dnscrypt.info/stamps/' target='_blank'>DNS Stamps</a> voor <a href='https://dnscrypt.info/' target='_blank'>DNSCrypt</a> of <a href='https://en.wikipedia.org/wiki/DNS_over_HTTPS' target='_blank'>DNS-over-HTTPS</a> resolvers",
<mask> "example_upstream_tcp": "standaard DNS (over TCP)",
</s> - client: allow add ip-v6 to exceptions </s> remove "example_regex_meaning": "blokir akses ke domain yang cocok dengan ekspresi reguler yang ditentukan",
</s> add </s> add "example_regex_meaning": "blocca l'accesso ai domini che corrispondono alla specifica espressione regolare", </s> remove "enforce_save_search_hint": "AdGuard Home kan veilig zoeken forceren voor de volgende zoekmachines: Google, Youtube, Bing, en Yandex.",
</s> add </s> remove "enforce_save_search_hint": "AdGuard Home dapat memaksa penelusuran aman pada mesin pencari berikut: Google, Youtube, Bing, dan Yandex.",
</s> add </s> remove "form_error_ip_format": "Invalid IPv4 format",
</s> add "form_error_ip4_format": "Invalid IPv4 format",
"form_error_ip6_format": "Invalid IPv6 format",
"form_error_ip_format": "Invalid IP format", </s> add return <Trans>form_error_ip4_format</Trans>;
}
return false;
};
export const ipv6 = (value) => {
if (value && !new RegExp(R_IPV6).test(value)) {
return <Trans>form_error_ip6_format</Trans>;
}
return false;
};
export const ip = (value) => {
if (value && !new RegExp(R_IPV4).test(value) && !new RegExp(R_IPV6).test(value)) { | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/__locales/nl.json |
keep keep keep keep replace keep keep keep keep keep | <mask> import flow from 'lodash/flow';
<mask>
<mask> import Tabs from '../../ui/Tabs';
<mask> import { toggleAllServices } from '../../../helpers/helpers';
<mask> import { renderField, renderRadioField, renderSelectField, renderServiceField, ipv4, mac, required } from '../../../helpers/form';
<mask> import { CLIENT_ID, SERVICES } from '../../../helpers/constants';
<mask> import './Service.css';
<mask>
<mask> const settingsCheckboxes = [
<mask> {
</s> - client: allow add ip-v6 to exceptions </s> add return <Trans>form_error_ip4_format</Trans>;
}
return false;
};
export const ipv6 = (value) => {
if (value && !new RegExp(R_IPV6).test(value)) {
return <Trans>form_error_ip6_format</Trans>;
}
return false;
};
export const ip = (value) => {
if (value && !new RegExp(R_IPV4).test(value) && !new RegExp(R_IPV6).test(value)) { </s> add "of_table_footer_text": "of", </s> remove validate={[ipv4, required]}
</s> add validate={[ip, required]} </s> remove "example_regex_meaning": "blokkeer de toegang tot de domeinen die overeenkomen met de opgegeven reguliere expressie",
</s> add </s> remove "enforce_save_search_hint": "AdGuard Home kan veilig zoeken forceren voor de volgende zoekmachines: Google, Youtube, Bing, en Yandex.",
</s> add </s> remove "form_error_ip_format": "Ongeldig IPv4 formaat",
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/components/Settings/Clients/Form.js |
keep keep keep keep replace keep keep keep keep keep | <mask> component={renderField}
<mask> type="text"
<mask> className="form-control"
<mask> placeholder={t('form_enter_ip')}
<mask> validate={[ipv4, required]}
<mask> />
<mask> </div>
<mask> )}
<mask> {clientIdentifier === CLIENT_ID.MAC && (
<mask> <div className="form__group">
</s> - client: allow add ip-v6 to exceptions </s> add return <Trans>form_error_ip4_format</Trans>;
}
return false;
};
export const ipv6 = (value) => {
if (value && !new RegExp(R_IPV6).test(value)) {
return <Trans>form_error_ip6_format</Trans>;
}
return false;
};
export const ip = (value) => {
if (value && !new RegExp(R_IPV4).test(value) && !new RegExp(R_IPV6).test(value)) { </s> remove import { renderField, renderRadioField, renderSelectField, renderServiceField, ipv4, mac, required } from '../../../helpers/form';
</s> add import { renderField, renderRadioField, renderSelectField, renderServiceField, ip, mac, required } from '../../../helpers/form'; </s> remove "example_regex_meaning": "blokkeer de toegang tot de domeinen die overeenkomen met de opgegeven reguliere expressie",
</s> add </s> remove "enforce_save_search_hint": "AdGuard Home kan veilig zoeken forceren voor de volgende zoekmachines: Google, Youtube, Bing, en Yandex.",
</s> add </s> remove "form_error_ip_format": "Ongeldig IPv4 formaat",
</s> add </s> add "encryption_certificate_path": "Percorso di certificato",
"encryption_private_key_path": "Percorso della chiave privata",
"encryption_certificates_source_path": "Definisci un percorso alle file dei certificati",
"encryption_certificates_source_content": "Incolla i contenuti di certificato",
"encryption_key_source_path": "Imposta un file chiave privata",
"encryption_key_source_content": "Incolla i contenuti della chiave privata", | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/components/Settings/Clients/Form.js |
keep add keep keep keep keep | <mask> export const ipv4 = (value) => {
<mask> if (value && !new RegExp(R_IPV4).test(value)) {
<mask> return <Trans>form_error_ip_format</Trans>;
<mask> }
<mask> return false;
<mask> };
</s> - client: allow add ip-v6 to exceptions </s> remove import { renderField, renderRadioField, renderSelectField, renderServiceField, ipv4, mac, required } from '../../../helpers/form';
</s> add import { renderField, renderRadioField, renderSelectField, renderServiceField, ip, mac, required } from '../../../helpers/form'; </s> remove validate={[ipv4, required]}
</s> add validate={[ip, required]} </s> remove "example_regex_meaning": "blokkeer de toegang tot de domeinen die overeenkomen met de opgegeven reguliere expressie",
</s> add </s> remove "enforce_save_search_hint": "AdGuard Home kan veilig zoeken forceren voor de volgende zoekmachines: Google, Youtube, Bing, en Yandex.",
</s> add </s> remove "form_error_ip_format": "Ongeldig IPv4 formaat",
</s> add </s> add "encryption_certificate_path": "Percorso di certificato",
"encryption_private_key_path": "Percorso della chiave privata",
"encryption_certificates_source_path": "Definisci un percorso alle file dei certificati",
"encryption_certificates_source_content": "Incolla i contenuti di certificato",
"encryption_key_source_path": "Imposta un file chiave privata",
"encryption_key_source_content": "Incolla i contenuti della chiave privata", | https://github.com/AdguardTeam/AdGuardHome/commit/49e800727b2e866fa1f9d429bd1c0c17ce8466b3 | client/src/helpers/form.js |
keep keep add keep keep keep keep | <mask> "github.com/AdguardTeam/golibs/stringutil"
<mask> "github.com/AdguardTeam/urlfilter"
<mask> "github.com/AdguardTeam/urlfilter/filterlist"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
<mask> // DefaultHostsPaths returns the slice of paths default for the operating system
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove // is intended to use within fs.FS so the initial slash is omitted.
</s> add // is intended to be used within fs.FS so the initial slash is omitted. </s> add "github.com/AdguardTeam/golibs/stringutil" </s> remove // Updates is the channel for receiving updated hosts. The receivable map's
// values has a type of slice of strings.
</s> add // updates is the channel for receiving updated hosts. </s> remove // Upd returns the channel into which the updates are sent.
</s> add // Upd returns the channel into which the updates are sent. The receivable
// map's values are guaranteed to be of type of *stringutil.Set. </s> add // last is the set of hosts that was cached within last detected change.
last *netutil.IPMap </s> remove // database.
</s> add // database. err is always nil. | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> )
<mask>
<mask> // DefaultHostsPaths returns the slice of paths default for the operating system
<mask> // to files and directories which are containing the hosts database. The result
<mask> // is intended to use within fs.FS so the initial slash is omitted.
<mask> func DefaultHostsPaths() (paths []string) {
<mask> return defaultHostsPaths()
<mask> }
<mask>
<mask> // hostsContainerPref is a prefix for logging and wrapping errors in
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> add "github.com/AdguardTeam/urlfilter/rules" </s> remove // Updates is the channel for receiving updated hosts. The receivable map's
// values has a type of slice of strings.
</s> add // updates is the channel for receiving updated hosts. </s> add // last is the set of hosts that was cached within last detected change.
last *netutil.IPMap </s> remove // parseHostsFile is a aghtest.FileWalker for parsing the files with hosts
// syntax. It never signs to stop the walking.
</s> add func (hc *HostsContainer) newHostsParser() (hp *hostsParser) {
return &hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(hc.last.Len()),
}
}
// parseFile is a aghos.FileWalker for parsing the files with hosts syntax. It
// never signs to stop walking and never returns any additional patterns. </s> remove // Upd returns the channel into which the updates are sent.
</s> add // Upd returns the channel into which the updates are sent. The receivable
// map's values are guaranteed to be of type of *stringutil.Set. </s> remove // database.
</s> add // database. err is always nil. | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> rulesStrg *filterlist.RuleStorage
<mask> // engine serves rulesStrg.
<mask> engine *urlfilter.DNSEngine
<mask>
<mask> // Updates is the channel for receiving updated hosts. The receivable map's
<mask> // values has a type of slice of strings.
<mask> updates chan *netutil.IPMap
<mask>
<mask> // fsys is the working file system to read hosts files from.
<mask> fsys fs.FS
<mask>
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> add // last is the set of hosts that was cached within last detected change.
last *netutil.IPMap </s> remove // Upd returns the channel into which the updates are sent.
</s> add // Upd returns the channel into which the updates are sent. The receivable
// map's values are guaranteed to be of type of *stringutil.Set. </s> remove // is intended to use within fs.FS so the initial slash is omitted.
</s> add // is intended to be used within fs.FS so the initial slash is omitted. </s> remove // parseHostsFile is a aghtest.FileWalker for parsing the files with hosts
// syntax. It never signs to stop the walking.
</s> add func (hc *HostsContainer) newHostsParser() (hp *hostsParser) {
return &hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(hc.last.Len()),
}
}
// parseFile is a aghos.FileWalker for parsing the files with hosts syntax. It
// never signs to stop walking and never returns any additional patterns. </s> add "github.com/AdguardTeam/urlfilter/rules" </s> add case <-ch:
ch <- upd
log.Debug("%s: replaced the last update", hostsContainerPref)
case ch <- upd:
// The previous update was just read and the next one pushed. Go on. | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep add keep keep keep keep | <mask> // updates is the channel for receiving updated hosts.
<mask> updates chan *netutil.IPMap
<mask>
<mask> // fsys is the working file system to read hosts files from.
<mask> fsys fs.FS
<mask>
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove // Updates is the channel for receiving updated hosts. The receivable map's
// values has a type of slice of strings.
</s> add // updates is the channel for receiving updated hosts. </s> remove // parseHostsFile is a aghtest.FileWalker for parsing the files with hosts
// syntax. It never signs to stop the walking.
</s> add func (hc *HostsContainer) newHostsParser() (hp *hostsParser) {
return &hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(hc.last.Len()),
}
}
// parseFile is a aghos.FileWalker for parsing the files with hosts syntax. It
// never signs to stop walking and never returns any additional patterns. </s> remove // is intended to use within fs.FS so the initial slash is omitted.
</s> add // is intended to be used within fs.FS so the initial slash is omitted. </s> remove // Upd returns the channel into which the updates are sent.
</s> add // Upd returns the channel into which the updates are sent. The receivable
// map's values are guaranteed to be of type of *stringutil.Set. </s> remove log.Debug("%s: closing hosts container", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPref) </s> remove func (hp hostsParser) parseHostsFile(
</s> add func (hp *hostsParser) parseFile( | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep add keep keep keep keep keep | <mask> engLock: &sync.RWMutex{},
<mask> updates: make(chan *netutil.IPMap, 1),
<mask> fsys: fsys,
<mask> w: w,
<mask> patterns: patterns,
<mask> }
<mask>
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove eventsCh := make(chan struct{}, 1)
</s> add // event is a convenient alias for an empty struct{} to emit test events.
type event = struct{}
eventsCh := make(chan event, 1) </s> remove checkRefresh := func(t *testing.T, wantHosts []string) {
</s> add checkRefresh := func(t *testing.T, wantHosts *stringutil.Set) { </s> remove OnEvents: func() (e <-chan struct{}) { return eventsCh },
</s> add OnEvents: func() (e <-chan event) { return eventsCh }, </s> remove case res.Reason == filtering.RewrittenRule:
</s> add case res.Reason.In(filtering.RewrittenRule, filtering.RewrittenAutoHosts): </s> remove checkRefresh(t, []string{knownHost})
</s> add checkRefresh(t, stringutil.NewSet(knownHost)) </s> remove for _, name := range names {
ok = clients.addHostLocked(ip, name, ClientSourceHostsFile)
if ok {
</s> add names.Range(func(name string) (cont bool) {
if clients.addHostLocked(ip, name, ClientSourceHostsFile) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep replace keep keep keep keep replace keep keep keep keep | <mask> defer hc.engLock.RUnlock()
<mask>
<mask> return hc.engine.MatchRequest(req)
<mask> }
<mask>
<mask> // Close implements the io.Closer interface for *HostsContainer.
<mask> func (hc *HostsContainer) Close() (err error) {
<mask> log.Debug("%s: closing hosts container", hostsContainerPref)
<mask>
<mask> return errors.Annotate(hc.w.Close(), "%s: closing: %w", hostsContainerPref)
<mask> }
<mask>
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove // Upd returns the channel into which the updates are sent.
</s> add // Upd returns the channel into which the updates are sent. The receivable
// map's values are guaranteed to be of type of *stringutil.Set. </s> remove hp := hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(0),
</s> add hp := hc.newHostsParser()
if _, err = aghos.FileWalker(hp.parseFile).Walk(hc.fsys, hc.patterns...); err != nil {
return fmt.Errorf("refreshing : %w", err) </s> remove // refresh gets the data from specified files and propagates the updates.
</s> add // refresh gets the data from specified files and propagates the updates if
// needed. </s> remove _, err = aghos.FileWalker(hp.parseHostsFile).Walk(hc.fsys, hc.patterns...)
if err != nil {
return fmt.Errorf("updating: %w", err)
}
</s> add if hp.equalSet(hc.last) {
log.Debug("%s: no updates detected", hostsContainerPref) </s> remove log.Debug("%s: the buffer is full", hostsContainerPref)
</s> add log.Debug("%s: the channel is broken", hostsContainerPref) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> return errors.Annotate(hc.w.Close(), "%s: closing: %w", hostsContainerPref)
<mask> }
<mask>
<mask> // Upd returns the channel into which the updates are sent.
<mask> func (hc *HostsContainer) Upd() (updates <-chan *netutil.IPMap) {
<mask> return hc.updates
<mask> }
<mask>
<mask> // pathsToPatterns converts paths into patterns compatible with fs.Glob.
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove log.Debug("%s: closing hosts container", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPref) </s> remove // parseHostsFile is a aghtest.FileWalker for parsing the files with hosts
// syntax. It never signs to stop the walking.
</s> add func (hc *HostsContainer) newHostsParser() (hp *hostsParser) {
return &hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(hc.last.Len()),
}
}
// parseFile is a aghos.FileWalker for parsing the files with hosts syntax. It
// never signs to stop walking and never returns any additional patterns. </s> remove // refresh gets the data from specified files and propagates the updates.
</s> add // refresh gets the data from specified files and propagates the updates if
// needed. </s> remove hp := hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(0),
</s> add hp := hc.newHostsParser()
if _, err = aghos.FileWalker(hp.parseFile).Walk(hc.fsys, hc.patterns...); err != nil {
return fmt.Errorf("refreshing : %w", err) </s> remove // is intended to use within fs.FS so the initial slash is omitted.
</s> add // is intended to be used within fs.FS so the initial slash is omitted. </s> remove case ch <- hp.table:
</s> add case ch <- upd: | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep replace replace keep keep replace | <mask> }
<mask>
<mask> // parseHostsFile is a aghtest.FileWalker for parsing the files with hosts
<mask> // syntax. It never signs to stop the walking.
<mask> //
<mask> // See man hosts(5).
<mask> func (hp hostsParser) parseHostsFile(
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove // is intended to use within fs.FS so the initial slash is omitted.
</s> add // is intended to be used within fs.FS so the initial slash is omitted. </s> remove // Updates is the channel for receiving updated hosts. The receivable map's
// values has a type of slice of strings.
</s> add // updates is the channel for receiving updated hosts. </s> add //
// TODO(e.burkov): There is no need for AutoHosts-related fields any more
// since the hosts container now uses $dnsrewrite rules. These fields are
// only used in query log to decode old format. </s> add // last is the set of hosts that was cached within last detected change.
last *netutil.IPMap </s> remove log.Debug("%s: the buffer is full", hostsContainerPref)
</s> add log.Debug("%s: the channel is broken", hostsContainerPref) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return nil, true, s.Err()
<mask> }
<mask>
<mask> // parseLine parses the line having the hosts syntax ignoring invalid ones.
<mask> func (hp hostsParser) parseLine(line string) (ip net.IP, hosts []string) {
<mask> line = strings.TrimSpace(line)
<mask> fields := strings.Fields(line)
<mask> if len(fields) < 2 {
<mask> return nil, nil
<mask> }
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove func (hp hostsParser) addPair(ip net.IP, host string) {
</s> add func (hp *hostsParser) addPair(ip net.IP, host string) { </s> remove func (hp hostsParser) add(ip net.IP, host string) (added bool) {
</s> add func (hp *hostsParser) add(ip net.IP, host string) (added bool) { </s> remove case res.Reason == filtering.RewrittenRule:
</s> add case res.Reason.In(filtering.RewrittenRule, filtering.RewrittenAutoHosts): </s> remove hp.table.Set(ip, append(hosts, host))
</s> add </s> remove hosts, _ := v.([]string)
if ok && stringutil.InSlice(hosts, host) {
</s> add hosts, _ := v.(*stringutil.Set)
switch {
case ok && hosts.Has(host): </s> remove func (hp hostsParser) newStrg() (s *filterlist.RuleStorage, err error) {
</s> add func (hp *hostsParser) newStrg() (s *filterlist.RuleStorage, err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep replace keep replace replace | <mask>
<mask> // add returns true if the pair of ip and host wasn't added to the hp before.
<mask> func (hp hostsParser) add(ip net.IP, host string) (added bool) {
<mask> v, ok := hp.table.Get(ip)
<mask> hosts, _ := v.([]string)
<mask> if ok && stringutil.InSlice(hosts, host) {
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove hp.table.Set(ip, append(hosts, host))
</s> add </s> remove func (hp hostsParser) addPair(ip net.IP, host string) {
</s> add func (hp *hostsParser) addPair(ip net.IP, host string) { </s> remove names, ok := v.([]string)
</s> add names, ok := v.(*stringutil.Set) </s> remove for _, name := range names {
ok = clients.addHostLocked(ip, name, ClientSourceHostsFile)
if ok {
</s> add names.Range(func(name string) (cont bool) {
if clients.addHostLocked(ip, name, ClientSourceHostsFile) { </s> add case hosts == nil:
hosts = stringutil.NewSet(host)
hp.table.Set(ip, hosts)
default:
hosts.Add(host) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep add keep keep keep keep | <mask> hosts, _ := v.(*stringutil.Set)
<mask> switch {
<mask> case ok && hosts.Has(host):
<mask> return false
<mask> }
<mask>
<mask> return true
<mask> }
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove hosts, _ := v.([]string)
if ok && stringutil.InSlice(hosts, host) {
</s> add hosts, _ := v.(*stringutil.Set)
switch {
case ok && hosts.Has(host): </s> remove func (hp hostsParser) add(ip net.IP, host string) (added bool) {
</s> add func (hp *hostsParser) add(ip net.IP, host string) (added bool) { </s> remove hp.table.Set(ip, append(hosts, host))
</s> add </s> remove var hosts []string
hosts, ok = v.([]string)
</s> add var hosts *stringutil.Set
hosts, ok = v.(*stringutil.Set) </s> remove }
</s> add return true
}) </s> remove for _, name := range names {
ok = clients.addHostLocked(ip, name, ClientSourceHostsFile)
if ok {
</s> add names.Range(func(name string) (cont bool) {
if clients.addHostLocked(ip, name, ClientSourceHostsFile) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep replace replace keep keep keep keep replace keep | <mask> }
<mask>
<mask> hp.table.Set(ip, append(hosts, host))
<mask>
<mask> return true
<mask> }
<mask>
<mask> // addPair puts the pair of ip and host to the rules builder if needed.
<mask> func (hp hostsParser) addPair(ip net.IP, host string) {
<mask> arpa, err := netutil.IPToReversedAddr(ip)
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove hosts, _ := v.([]string)
if ok && stringutil.InSlice(hosts, host) {
</s> add hosts, _ := v.(*stringutil.Set)
switch {
case ok && hosts.Has(host): </s> remove func (hp hostsParser) add(ip net.IP, host string) (added bool) {
</s> add func (hp *hostsParser) add(ip net.IP, host string) (added bool) { </s> remove func (hp hostsParser) parseLine(line string) (ip net.IP, hosts []string) {
</s> add func (hp *hostsParser) parseLine(line string) (ip net.IP, hosts []string) { </s> remove // database.
</s> add // database. err is always nil. </s> remove func (hp hostsParser) newStrg() (s *filterlist.RuleStorage, err error) {
</s> add func (hp *hostsParser) newStrg() (s *filterlist.RuleStorage, err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep keep replace replace replace keep replace keep keep keep | <mask> // Assume the validation of the IP address is performed already.
<mask> qtype = "A"
<mask> }
<mask>
<mask> stringutil.WriteToBuilder(
<mask> hp.rules,
<mask> "||",
<mask> host,
<mask> "^$dnsrewrite=NOERROR;",
<mask> qtype,
<mask> ";",
<mask> ip.String(),
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove ";",
ip.String(),
"\n",
"||",
</s> add sc,
ipStr,
nl,
}, {
// PTR.
rules.MaskStartURL, </s> remove "^$dnsrewrite=NOERROR;PTR;",
dns.Fqdn(host),
"\n",
)
</s> add rules.MaskSeparator,
rewriteSuccessPTR,
fqdn,
nl,
}} {
stringutil.WriteToBuilder(hp.rules, ruleData...)
} </s> remove return Result{}, nil
</s> add return res, nil </s> remove // database.
</s> add // database. err is always nil. </s> remove // TODO(e.burkov): Wait for urlfilter update to pass net.IP.
</s> add // TODO(e.burkov): Wait for urlfilter update to pass net.IP. | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep replace replace replace replace keep replace replace replace replace keep | <mask> qtype,
<mask> ";",
<mask> ip.String(),
<mask> "\n",
<mask> "||",
<mask> arpa,
<mask> "^$dnsrewrite=NOERROR;PTR;",
<mask> dns.Fqdn(host),
<mask> "\n",
<mask> )
<mask>
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove "^$dnsrewrite=NOERROR;",
</s> add rules.MaskSeparator,
rewriteSuccess, </s> remove stringutil.WriteToBuilder(
hp.rules,
"||",
</s> add const (
nl = "\n"
sc = ";"
rewriteSuccess = "$dnsrewrite=NOERROR" + sc
rewriteSuccessPTR = rewriteSuccess + "PTR" + sc
)
ipStr := ip.String()
fqdn := dns.Fqdn(host)
for _, ruleData := range [...][]string{{
// A/AAAA.
rules.MaskStartURL, </s> remove return Result{}, nil
</s> add return res, nil </s> remove func (hp hostsParser) addPair(ip net.IP, host string) {
</s> add func (hp *hostsParser) addPair(ip net.IP, host string) { </s> remove // TODO(e.burkov): Wait for urlfilter update to pass net.IP.
</s> add // TODO(e.burkov): Wait for urlfilter update to pass net.IP. | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> log.Debug("%s: added ip-host pair %q/%q", hostsContainerPref, ip, host)
<mask> }
<mask>
<mask> // sendUpd tries to send the parsed data to the ch.
<mask> func (hp hostsParser) sendUpd(ch chan *netutil.IPMap) {
<mask> log.Debug("%s: sending upd", hostsContainerPref)
<mask> select {
<mask> case ch <- hp.table:
<mask> // Updates are delivered. Go on.
<mask> default:
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove case ch <- hp.table:
</s> add case ch <- upd: </s> add upd := hp.table </s> remove "^$dnsrewrite=NOERROR;PTR;",
dns.Fqdn(host),
"\n",
)
</s> add rules.MaskSeparator,
rewriteSuccessPTR,
fqdn,
nl,
}} {
stringutil.WriteToBuilder(hp.rules, ruleData...)
} </s> remove log.Debug("%s: the buffer is full", hostsContainerPref)
</s> add log.Debug("%s: the channel is broken", hostsContainerPref) </s> add case <-ch:
ch <- upd
log.Debug("%s: replaced the last update", hostsContainerPref)
case ch <- upd:
// The previous update was just read and the next one pushed. Go on. </s> remove func (hp hostsParser) add(ip net.IP, host string) (added bool) {
</s> add func (hp *hostsParser) add(ip net.IP, host string) (added bool) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep add keep keep keep keep keep | <mask> // sendUpd tries to send the parsed data to the ch.
<mask> func (hp *hostsParser) sendUpd(ch chan *netutil.IPMap) {
<mask> log.Debug("%s: sending upd", hostsContainerPref)
<mask> select {
<mask> case ch <- upd:
<mask> // Updates are delivered. Go on.
<mask> case <-ch:
<mask> ch <- upd
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove case ch <- hp.table:
</s> add case ch <- upd: </s> remove func (hp hostsParser) sendUpd(ch chan *netutil.IPMap) {
</s> add func (hp *hostsParser) sendUpd(ch chan *netutil.IPMap) { </s> add case <-ch:
ch <- upd
log.Debug("%s: replaced the last update", hostsContainerPref)
case ch <- upd:
// The previous update was just read and the next one pushed. Go on. </s> remove log.Debug("%s: the buffer is full", hostsContainerPref)
</s> add log.Debug("%s: the channel is broken", hostsContainerPref) </s> remove "^$dnsrewrite=NOERROR;PTR;",
dns.Fqdn(host),
"\n",
)
</s> add rules.MaskSeparator,
rewriteSuccessPTR,
fqdn,
nl,
}} {
stringutil.WriteToBuilder(hp.rules, ruleData...)
} </s> remove // Upd returns the channel into which the updates are sent.
</s> add // Upd returns the channel into which the updates are sent. The receivable
// map's values are guaranteed to be of type of *stringutil.Set. | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // sendUpd tries to send the parsed data to the ch.
<mask> func (hp hostsParser) sendUpd(ch chan *netutil.IPMap) {
<mask> log.Debug("%s: sending upd", hostsContainerPref)
<mask> select {
<mask> case ch <- hp.table:
<mask> // Updates are delivered. Go on.
<mask> default:
<mask> log.Debug("%s: the buffer is full", hostsContainerPref)
<mask> }
<mask> }
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove func (hp hostsParser) sendUpd(ch chan *netutil.IPMap) {
</s> add func (hp *hostsParser) sendUpd(ch chan *netutil.IPMap) { </s> add upd := hp.table </s> remove log.Debug("%s: the buffer is full", hostsContainerPref)
</s> add log.Debug("%s: the channel is broken", hostsContainerPref) </s> add case <-ch:
ch <- upd
log.Debug("%s: replaced the last update", hostsContainerPref)
case ch <- upd:
// The previous update was just read and the next one pushed. Go on. </s> remove "^$dnsrewrite=NOERROR;PTR;",
dns.Fqdn(host),
"\n",
)
</s> add rules.MaskSeparator,
rewriteSuccessPTR,
fqdn,
nl,
}} {
stringutil.WriteToBuilder(hp.rules, ruleData...)
} </s> remove log.Debug("%s: closing hosts container", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPref) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep add keep keep keep keep keep | <mask> case ch <- upd:
<mask> // Updates are delivered. Go on.
<mask> default:
<mask> log.Debug("%s: the channel is broken", hostsContainerPref)
<mask> }
<mask> }
<mask>
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove log.Debug("%s: the buffer is full", hostsContainerPref)
</s> add log.Debug("%s: the channel is broken", hostsContainerPref) </s> remove case ch <- hp.table:
</s> add case ch <- upd: </s> add upd := hp.table </s> remove func (hp hostsParser) sendUpd(ch chan *netutil.IPMap) {
</s> add func (hp *hostsParser) sendUpd(ch chan *netutil.IPMap) { </s> remove log.Debug("%s: closing hosts container", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPref) </s> remove // Upd returns the channel into which the updates are sent.
</s> add // Upd returns the channel into which the updates are sent. The receivable
// map's values are guaranteed to be of type of *stringutil.Set. | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep replace keep keep keep keep replace keep | <mask> case ch <- hp.table:
<mask> // Updates are delivered. Go on.
<mask> default:
<mask> log.Debug("%s: the buffer is full", hostsContainerPref)
<mask> }
<mask> }
<mask>
<mask> // newStrg creates a new rules storage from parsed data.
<mask> func (hp hostsParser) newStrg() (s *filterlist.RuleStorage, err error) {
<mask> return filterlist.NewRuleStorage([]filterlist.RuleList{&filterlist.StringRuleList{
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove ID: 1,
</s> add ID: -1, </s> remove case ch <- hp.table:
</s> add case ch <- upd: </s> remove func (hp hostsParser) sendUpd(ch chan *netutil.IPMap) {
</s> add func (hp *hostsParser) sendUpd(ch chan *netutil.IPMap) { </s> add case <-ch:
ch <- upd
log.Debug("%s: replaced the last update", hostsContainerPref)
case ch <- upd:
// The previous update was just read and the next one pushed. Go on. </s> add upd := hp.table | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> // newStrg creates a new rules storage from parsed data.
<mask> func (hp hostsParser) newStrg() (s *filterlist.RuleStorage, err error) {
<mask> return filterlist.NewRuleStorage([]filterlist.RuleList{&filterlist.StringRuleList{
<mask> ID: 1,
<mask> RulesText: hp.rules.String(),
<mask> IgnoreCosmetic: true,
<mask> }})
<mask> }
<mask>
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove func (hp hostsParser) newStrg() (s *filterlist.RuleStorage, err error) {
</s> add func (hp *hostsParser) newStrg() (s *filterlist.RuleStorage, err error) { </s> remove log.Debug("%s: the buffer is full", hostsContainerPref)
</s> add log.Debug("%s: the channel is broken", hostsContainerPref) </s> remove // refresh gets the data from specified files and propagates the updates.
</s> add // refresh gets the data from specified files and propagates the updates if
// needed. </s> remove func (hp hostsParser) addPair(ip net.IP, host string) {
</s> add func (hp *hostsParser) addPair(ip net.IP, host string) { </s> remove // parseHostsFile is a aghtest.FileWalker for parsing the files with hosts
// syntax. It never signs to stop the walking.
</s> add func (hc *HostsContainer) newHostsParser() (hp *hostsParser) {
return &hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(hc.last.Len()),
}
}
// parseFile is a aghos.FileWalker for parsing the files with hosts syntax. It
// never signs to stop walking and never returns any additional patterns. </s> remove func (hp hostsParser) parseHostsFile(
</s> add func (hp *hostsParser) parseFile( | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep replace keep keep keep replace replace replace keep | <mask> }})
<mask> }
<mask>
<mask> // refresh gets the data from specified files and propagates the updates.
<mask> func (hc *HostsContainer) refresh() (err error) {
<mask> log.Debug("%s: refreshing", hostsContainerPref)
<mask>
<mask> hp := hostsParser{
<mask> rules: &strings.Builder{},
<mask> table: netutil.NewIPMap(0),
<mask> }
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove // parseHostsFile is a aghtest.FileWalker for parsing the files with hosts
// syntax. It never signs to stop the walking.
</s> add func (hc *HostsContainer) newHostsParser() (hp *hostsParser) {
return &hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(hc.last.Len()),
}
}
// parseFile is a aghos.FileWalker for parsing the files with hosts syntax. It
// never signs to stop walking and never returns any additional patterns. </s> remove _, err = aghos.FileWalker(hp.parseHostsFile).Walk(hc.fsys, hc.patterns...)
if err != nil {
return fmt.Errorf("updating: %w", err)
}
</s> add if hp.equalSet(hc.last) {
log.Debug("%s: no updates detected", hostsContainerPref) </s> remove log.Debug("%s: closing hosts container", hostsContainerPref)
</s> add log.Debug("%s: closing", hostsContainerPref) </s> remove return hc.engine.MatchRequest(req)
</s> add res, ok = hc.engine.MatchRequest(req)
return res, ok </s> remove log.Debug("%s: the buffer is full", hostsContainerPref)
</s> add log.Debug("%s: the channel is broken", hostsContainerPref) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep keep keep replace replace replace replace keep keep keep keep keep | <mask> rules: &strings.Builder{},
<mask> table: netutil.NewIPMap(0),
<mask> }
<mask>
<mask> _, err = aghos.FileWalker(hp.parseHostsFile).Walk(hc.fsys, hc.patterns...)
<mask> if err != nil {
<mask> return fmt.Errorf("updating: %w", err)
<mask> }
<mask>
<mask> defer hp.sendUpd(hc.updates)
<mask>
<mask> var rulesStrg *filterlist.RuleStorage
<mask> if rulesStrg, err = hp.newStrg(); err != nil {
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> add hc.last = hp.table.ShallowClone()
</s> remove hp := hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(0),
</s> add hp := hc.newHostsParser()
if _, err = aghos.FileWalker(hp.parseFile).Walk(hc.fsys, hc.patterns...); err != nil {
return fmt.Errorf("refreshing : %w", err) </s> add return nil
} </s> remove case res.Reason == filtering.RewrittenRule:
</s> add case res.Reason.In(filtering.RewrittenRule, filtering.RewrittenAutoHosts): </s> remove func (hp hostsParser) addPair(ip net.IP, host string) {
</s> add func (hp *hostsParser) addPair(ip net.IP, host string) { </s> remove return Result{}, nil
</s> add return res, nil | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep add keep keep keep keep keep keep | <mask> log.Debug("%s: no updates detected", hostsContainerPref)
<mask>
<mask> defer hp.sendUpd(hc.updates)
<mask>
<mask> hc.last = hp.table.ShallowClone()
<mask>
<mask> var rulesStrg *filterlist.RuleStorage
<mask> if rulesStrg, err = hp.newStrg(); err != nil {
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove _, err = aghos.FileWalker(hp.parseHostsFile).Walk(hc.fsys, hc.patterns...)
if err != nil {
return fmt.Errorf("updating: %w", err)
}
</s> add if hp.equalSet(hc.last) {
log.Debug("%s: no updates detected", hostsContainerPref) </s> add hc.last = hp.table.ShallowClone()
</s> remove hp := hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(0),
</s> add hp := hc.newHostsParser()
if _, err = aghos.FileWalker(hp.parseFile).Walk(hc.fsys, hc.patterns...); err != nil {
return fmt.Errorf("refreshing : %w", err) </s> remove case res.Reason == filtering.RewrittenRule:
</s> add case res.Reason.In(filtering.RewrittenRule, filtering.RewrittenAutoHosts): </s> remove func (hp hostsParser) addPair(ip net.IP, host string) {
</s> add func (hp *hostsParser) addPair(ip net.IP, host string) { </s> remove return hc.engine.MatchRequest(req)
</s> add res, ok = hc.engine.MatchRequest(req)
return res, ok | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep add keep keep keep keep keep keep | <mask> defer hp.sendUpd(hc.updates)
<mask>
<mask> var rulesStrg *filterlist.RuleStorage
<mask> if rulesStrg, err = hp.newStrg(); err != nil {
<mask> return fmt.Errorf("initializing rules storage: %w", err)
<mask> }
<mask>
<mask> hc.resetEng(rulesStrg)
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove _, err = aghos.FileWalker(hp.parseHostsFile).Walk(hc.fsys, hc.patterns...)
if err != nil {
return fmt.Errorf("updating: %w", err)
}
</s> add if hp.equalSet(hc.last) {
log.Debug("%s: no updates detected", hostsContainerPref) </s> add return nil
} </s> remove hp := hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(0),
</s> add hp := hc.newHostsParser()
if _, err = aghos.FileWalker(hp.parseFile).Walk(hc.fsys, hc.patterns...); err != nil {
return fmt.Errorf("refreshing : %w", err) </s> remove case res.Reason == filtering.RewrittenRule:
</s> add case res.Reason.In(filtering.RewrittenRule, filtering.RewrittenAutoHosts): </s> remove func (hp hostsParser) addPair(ip net.IP, host string) {
</s> add func (hp *hostsParser) addPair(ip net.IP, host string) { </s> remove return Result{}, nil
</s> add return res, nil | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer.go |
keep keep add keep keep keep keep | <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> "github.com/AdguardTeam/urlfilter"
<mask> "github.com/miekg/dns"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> add "github.com/AdguardTeam/urlfilter/rules" </s> add return nil
} </s> remove hp := hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(0),
</s> add hp := hc.newHostsParser()
if _, err = aghos.FileWalker(hp.parseFile).Walk(hc.fsys, hc.patterns...); err != nil {
return fmt.Errorf("refreshing : %w", err) </s> remove // refresh gets the data from specified files and propagates the updates.
</s> add // refresh gets the data from specified files and propagates the updates if
// needed. </s> remove ID: 1,
</s> add ID: -1, </s> remove func (hp hostsParser) newStrg() (s *filterlist.RuleStorage, err error) {
</s> add func (hp *hostsParser) newStrg() (s *filterlist.RuleStorage, err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep replace keep keep keep replace keep keep | <mask>
<mask> eventsCh := make(chan struct{}, 1)
<mask> t.Cleanup(func() { close(eventsCh) })
<mask>
<mask> w := &aghtest.FSWatcher{
<mask> OnEvents: func() (e <-chan struct{}) { return eventsCh },
<mask> OnAdd: func(name string) (err error) {
<mask> assert.Equal(t, dirname, name)
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove strings.Join([]string{ip4.String(), hostname4, hostname4a}, sp) + nl +
strings.Join([]string{ip6.String(), hostname6}, sp) + nl +
strings.Join([]string{"256.256.256.256", "fakebroadcast"}, sp) + nl,
</s> add ip4.String() + " " + hostname4 + " " + hostname4a + nl +
ip6.String() + " " + hostname6 + nl +
`256.256.256.256 fakebroadcast` + nl, </s> remove checkRefresh(t, []string{knownHost, knownAlias})
</s> add checkRefresh(t, stringutil.NewSet(knownHost, knownAlias))
})
eventsCh <- event{}
t.Run("no_changes_refresh", func(t *testing.T) {
assert.Empty(t, hc.Upd()) </s> remove
eventsCh <- struct{}{}
</s> add eventsCh <- event{} </s> remove checkRefresh := func(t *testing.T, wantHosts []string) {
</s> add checkRefresh := func(t *testing.T, wantHosts *stringutil.Set) { </s> remove assert.Equal(t, wantHosts, hosts)
</s> add assert.True(t, hosts.Equal(wantHosts)) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> hc, err := NewHostsContainer(testFS, w, dirname)
<mask> require.NoError(t, err)
<mask> t.Cleanup(func() { require.ErrorIs(t, hc.Close(), closeCalled) })
<mask>
<mask> checkRefresh := func(t *testing.T, wantHosts []string) {
<mask> upd, ok := <-hc.Upd()
<mask> require.True(t, ok)
<mask> require.NotNil(t, upd)
<mask>
<mask> assert.Equal(t, 1, upd.Len())
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove assert.Equal(t, wantHosts, hosts)
</s> add assert.True(t, hosts.Equal(wantHosts)) </s> remove require.Len(t, hosts, len(wantHosts))
</s> add </s> remove var hosts []string
hosts, ok = v.([]string)
</s> add var hosts *stringutil.Set
hosts, ok = v.(*stringutil.Set) </s> remove OnEvents: func() (e <-chan struct{}) { return eventsCh },
</s> add OnEvents: func() (e <-chan event) { return eventsCh }, </s> remove checkRefresh(t, []string{knownHost})
</s> add checkRefresh(t, stringutil.NewSet(knownHost)) </s> remove hp := hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(0),
</s> add hp := hc.newHostsParser()
if _, err = aghos.FileWalker(hp.parseFile).Walk(hc.fsys, hc.patterns...); err != nil {
return fmt.Errorf("refreshing : %w", err) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> v, ok := upd.Get(knownIP)
<mask> require.True(t, ok)
<mask>
<mask> var hosts []string
<mask> hosts, ok = v.([]string)
<mask> require.True(t, ok)
<mask> require.Len(t, hosts, len(wantHosts))
<mask>
<mask> assert.Equal(t, wantHosts, hosts)
<mask> }
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove require.Len(t, hosts, len(wantHosts))
</s> add </s> remove assert.Equal(t, wantHosts, hosts)
</s> add assert.True(t, hosts.Equal(wantHosts)) </s> remove checkRefresh := func(t *testing.T, wantHosts []string) {
</s> add checkRefresh := func(t *testing.T, wantHosts *stringutil.Set) { </s> add case hosts == nil:
hosts = stringutil.NewSet(host)
hp.table.Set(ip, hosts)
default:
hosts.Add(host) </s> remove hosts, _ := v.([]string)
if ok && stringutil.InSlice(hosts, host) {
</s> add hosts, _ := v.(*stringutil.Set)
switch {
case ok && hosts.Has(host): </s> remove func (hp hostsParser) add(ip net.IP, host string) (added bool) {
</s> add func (hp *hostsParser) add(ip net.IP, host string) (added bool) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace keep replace | <mask>
<mask> var hosts []string
<mask> hosts, ok = v.([]string)
<mask> require.True(t, ok)
<mask> require.Len(t, hosts, len(wantHosts))
<mask>
<mask> assert.Equal(t, wantHosts, hosts)
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove var hosts []string
hosts, ok = v.([]string)
</s> add var hosts *stringutil.Set
hosts, ok = v.(*stringutil.Set) </s> add case hosts == nil:
hosts = stringutil.NewSet(host)
hp.table.Set(ip, hosts)
default:
hosts.Add(host) </s> remove hosts, _ := v.([]string)
if ok && stringutil.InSlice(hosts, host) {
</s> add hosts, _ := v.(*stringutil.Set)
switch {
case ok && hosts.Has(host): </s> remove checkRefresh(t, []string{knownHost})
</s> add checkRefresh(t, stringutil.NewSet(knownHost)) </s> remove checkRefresh := func(t *testing.T, wantHosts []string) {
</s> add checkRefresh := func(t *testing.T, wantHosts *stringutil.Set) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> assert.Equal(t, wantHosts, hosts)
<mask> }
<mask>
<mask> t.Run("initial_refresh", func(t *testing.T) {
<mask> checkRefresh(t, []string{knownHost})
<mask> })
<mask>
<mask> testFS[p2] = &fstest.MapFile{
<mask> Data: []byte(strings.Join([]string{knownIP.String(), knownAlias}, sp) + nl),
<mask> }
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove
eventsCh <- struct{}{}
</s> add eventsCh <- event{} </s> remove assert.Equal(t, wantHosts, hosts)
</s> add assert.True(t, hosts.Equal(wantHosts)) </s> remove require.Len(t, hosts, len(wantHosts))
</s> add </s> remove checkRefresh(t, []string{knownHost, knownAlias})
</s> add checkRefresh(t, stringutil.NewSet(knownHost, knownAlias))
})
eventsCh <- event{}
t.Run("no_changes_refresh", func(t *testing.T) {
assert.Empty(t, hc.Upd()) </s> remove eventsCh := make(chan struct{}, 1)
</s> add // event is a convenient alias for an empty struct{} to emit test events.
type event = struct{}
eventsCh := make(chan event, 1) </s> remove var hosts []string
hosts, ok = v.([]string)
</s> add var hosts *stringutil.Set
hosts, ok = v.(*stringutil.Set) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> testFS[p2] = &fstest.MapFile{
<mask> Data: []byte(strings.Join([]string{knownIP.String(), knownAlias}, sp) + nl),
<mask> }
<mask>
<mask> eventsCh <- struct{}{}
<mask>
<mask> t.Run("second_refresh", func(t *testing.T) {
<mask> checkRefresh(t, []string{knownHost, knownAlias})
<mask> })
<mask> }
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove checkRefresh(t, []string{knownHost})
</s> add checkRefresh(t, stringutil.NewSet(knownHost)) </s> remove checkRefresh(t, []string{knownHost, knownAlias})
</s> add checkRefresh(t, stringutil.NewSet(knownHost, knownAlias))
})
eventsCh <- event{}
t.Run("no_changes_refresh", func(t *testing.T) {
assert.Empty(t, hc.Upd()) </s> remove eventsCh := make(chan struct{}, 1)
</s> add // event is a convenient alias for an empty struct{} to emit test events.
type event = struct{}
eventsCh := make(chan event, 1) </s> remove assert.Equal(t, wantHosts, hosts)
</s> add assert.True(t, hosts.Equal(wantHosts)) </s> remove strings.Join([]string{ip4.String(), hostname4, hostname4a}, sp) + nl +
strings.Join([]string{ip6.String(), hostname6}, sp) + nl +
strings.Join([]string{"256.256.256.256", "fakebroadcast"}, sp) + nl,
</s> add ip4.String() + " " + hostname4 + " " + hostname4a + nl +
ip6.String() + " " + hostname6 + nl +
`256.256.256.256 fakebroadcast` + nl, </s> remove require.Len(t, hosts, len(wantHosts))
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> eventsCh <- struct{}{}
<mask>
<mask> t.Run("second_refresh", func(t *testing.T) {
<mask> checkRefresh(t, []string{knownHost, knownAlias})
<mask> })
<mask> }
<mask>
<mask> func TestHostsContainer_MatchRequest(t *testing.T) {
<mask> var (
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove
eventsCh <- struct{}{}
</s> add eventsCh <- event{} </s> remove checkRefresh(t, []string{knownHost})
</s> add checkRefresh(t, stringutil.NewSet(knownHost)) </s> remove assert.Equal(t, wantHosts, hosts)
</s> add assert.True(t, hosts.Equal(wantHosts)) </s> remove 0, 0, 0, 0,
</s> add 128, 0, 0, 0, </s> remove require.Len(t, hosts, len(wantHosts))
</s> add </s> remove OnEvents: func() (e <-chan struct{}) { return eventsCh },
</s> add OnEvents: func() (e <-chan event) { return eventsCh }, | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func TestHostsContainer_MatchRequest(t *testing.T) {
<mask> var (
<mask> ip4 = net.IP{127, 0, 0, 1}
<mask> ip6 = net.IP{
<mask> 0, 0, 0, 0,
<mask> 0, 0, 0, 0,
<mask> 0, 0, 0, 0,
<mask> 0, 0, 0, 1,
<mask> }
<mask>
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove checkRefresh(t, []string{knownHost, knownAlias})
</s> add checkRefresh(t, stringutil.NewSet(knownHost, knownAlias))
})
eventsCh <- event{}
t.Run("no_changes_refresh", func(t *testing.T) {
assert.Empty(t, hc.Upd()) </s> remove require.Len(t, hosts, len(wantHosts))
</s> add </s> remove checkRefresh(t, []string{knownHost})
</s> add checkRefresh(t, stringutil.NewSet(knownHost)) </s> remove
eventsCh <- struct{}{}
</s> add eventsCh <- event{} </s> remove assert.Equal(t, wantHosts, hosts)
</s> add assert.True(t, hosts.Equal(wantHosts)) </s> remove func (hp hostsParser) newStrg() (s *filterlist.RuleStorage, err error) {
</s> add func (hp *hostsParser) newStrg() (s *filterlist.RuleStorage, err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace replace replace keep keep keep keep keep | <mask> const filename = "file1"
<mask>
<mask> gsfs := fstest.MapFS{
<mask> filename: &fstest.MapFile{Data: []byte(
<mask> strings.Join([]string{ip4.String(), hostname4, hostname4a}, sp) + nl +
<mask> strings.Join([]string{ip6.String(), hostname6}, sp) + nl +
<mask> strings.Join([]string{"256.256.256.256", "fakebroadcast"}, sp) + nl,
<mask> )},
<mask> }
<mask>
<mask> hc, err := NewHostsContainer(gsfs, &aghtest.FSWatcher{
<mask> OnEvents: func() (e <-chan struct{}) { panic("not implemented") },
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove eventsCh := make(chan struct{}, 1)
</s> add // event is a convenient alias for an empty struct{} to emit test events.
type event = struct{}
eventsCh := make(chan event, 1) </s> remove OnEvents: func() (e <-chan struct{}) { return eventsCh },
</s> add OnEvents: func() (e <-chan event) { return eventsCh }, </s> remove stringutil.WriteToBuilder(
hp.rules,
"||",
</s> add const (
nl = "\n"
sc = ";"
rewriteSuccess = "$dnsrewrite=NOERROR" + sc
rewriteSuccessPTR = rewriteSuccess + "PTR" + sc
)
ipStr := ip.String()
fqdn := dns.Fqdn(host)
for _, ruleData := range [...][]string{{
// A/AAAA.
rules.MaskStartURL, </s> remove name: "existing_one",
host: knownHost,
wantRules: "",
ip: knownIP,
</s> add name: "existing_one",
host: knownHost,
wantRules: "||" + knownHost + "^$dnsrewrite=NOERROR;A;1.2.3.4\n" +
"||4.3.2.1.in-addr.arpa^$dnsrewrite=NOERROR;PTR;host1.\n",
ip: knownIP, </s> remove checkRefresh(t, []string{knownHost})
</s> add checkRefresh(t, stringutil.NewSet(knownHost)) </s> remove
eventsCh <- struct{}{}
</s> add eventsCh <- event{} | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep add keep keep keep keep keep keep | <mask> Hostname: hostname4,
<mask> DNSType: dns.TypeA,
<mask> },
<mask> }, {
<mask> name: "aaaa",
<mask> want: []interface{}{ip6},
<mask> req: urlfilter.DNSRequest{
<mask> Hostname: hostname6,
<mask> DNSType: dns.TypeAAAA,
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove // TODO(e.burkov): Wait for urlfilter update to pass net.IP.
</s> add // TODO(e.burkov): Wait for urlfilter update to pass net.IP. </s> remove name: "existing_one",
host: knownHost,
wantRules: "",
ip: knownIP,
</s> add name: "existing_one",
host: knownHost,
wantRules: "||" + knownHost + "^$dnsrewrite=NOERROR;A;1.2.3.4\n" +
"||4.3.2.1.in-addr.arpa^$dnsrewrite=NOERROR;PTR;host1.\n",
ip: knownIP, </s> remove OnEvents: func() (e <-chan struct{}) { return eventsCh },
</s> add OnEvents: func() (e <-chan event) { return eventsCh }, </s> remove return Result{}, nil
</s> add return res, nil </s> remove return Result{}, nil
</s> add return res, nil </s> remove eventsCh := make(chan struct{}, 1)
</s> add // event is a convenient alias for an empty struct{} to emit test events.
type event = struct{}
eventsCh := make(chan event, 1) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> const knownHost = "host1"
<mask>
<mask> ipToHost := netutil.NewIPMap(0)
<mask> ipToHost.Set(knownIP, []string{knownHost})
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> host string
<mask> wantRules string
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove case res.Reason == filtering.RewrittenAutoHosts && len(res.ReverseHosts) != 0:
resp := s.makeResponse(req)
hdr := dns.RR_Header{
Name: q.Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
}
for _, h := range res.ReverseHosts {
ptr := &dns.PTR{
Hdr: hdr,
Ptr: h,
}
resp.Answer = append(resp.Answer, ptr)
}
d.Res = resp
case res.Reason.In(filtering.Rewritten, filtering.RewrittenAutoHosts):
</s> add case res.Reason == filtering.Rewritten: </s> remove name: "existing_one",
host: knownHost,
wantRules: "",
ip: knownIP,
</s> add name: "existing_one",
host: knownHost,
wantRules: "||" + knownHost + "^$dnsrewrite=NOERROR;A;1.2.3.4\n" +
"||4.3.2.1.in-addr.arpa^$dnsrewrite=NOERROR;PTR;host1.\n",
ip: knownIP, </s> remove func (hp hostsParser) addPair(ip net.IP, host string) {
</s> add func (hp *hostsParser) addPair(ip net.IP, host string) { </s> remove func (hp hostsParser) add(ip net.IP, host string) (added bool) {
</s> add func (hp *hostsParser) add(ip net.IP, host string) (added bool) { </s> remove names, ok := v.([]string)
</s> add names, ok := v.(*stringutil.Set) </s> remove assert.Equal(t, wantHosts, hosts)
</s> add assert.True(t, hosts.Equal(wantHosts)) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace replace replace replace keep keep keep keep keep | <mask> wantRules: "||host2^$dnsrewrite=NOERROR;A;1.2.3.4\n" +
<mask> "||4.3.2.1.in-addr.arpa^$dnsrewrite=NOERROR;PTR;host2.\n",
<mask> ip: knownIP,
<mask> }, {
<mask> name: "existing_one",
<mask> host: knownHost,
<mask> wantRules: "",
<mask> ip: knownIP,
<mask> }, {
<mask> name: "new_ip",
<mask> host: knownHost,
<mask> wantRules: "||" + knownHost + "^$dnsrewrite=NOERROR;A;1.2.3.5\n" +
<mask> "||5.3.2.1.in-addr.arpa^$dnsrewrite=NOERROR;PTR;" + knownHost + ".\n",
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove strings.Join([]string{ip4.String(), hostname4, hostname4a}, sp) + nl +
strings.Join([]string{ip6.String(), hostname6}, sp) + nl +
strings.Join([]string{"256.256.256.256", "fakebroadcast"}, sp) + nl,
</s> add ip4.String() + " " + hostname4 + " " + hostname4a + nl +
ip6.String() + " " + hostname6 + nl +
`256.256.256.256 fakebroadcast` + nl, </s> add }, {
name: "a_for_aaaa",
want: []interface{}{
ip4.To16(),
},
req: urlfilter.DNSRequest{
Hostname: hostname4,
DNSType: dns.TypeAAAA,
}, </s> remove stringutil.WriteToBuilder(
hp.rules,
"||",
</s> add const (
nl = "\n"
sc = ";"
rewriteSuccess = "$dnsrewrite=NOERROR" + sc
rewriteSuccessPTR = rewriteSuccess + "PTR" + sc
)
ipStr := ip.String()
fqdn := dns.Fqdn(host)
for _, ruleData := range [...][]string{{
// A/AAAA.
rules.MaskStartURL, </s> remove eventsCh := make(chan struct{}, 1)
</s> add // event is a convenient alias for an empty struct{} to emit test events.
type event = struct{}
eventsCh := make(chan event, 1) </s> remove checkRefresh(t, []string{knownHost})
</s> add checkRefresh(t, stringutil.NewSet(knownHost)) </s> remove
eventsCh <- struct{}{}
</s> add eventsCh <- event{} | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/aghnet/hostscontainer_test.go |
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep | <mask> // Resolve the new canonical name, not the original host name. The
<mask> // original question is readded in processFilteringAfterResponse.
<mask> ctx.origQuestion = q
<mask> req.Question[0].Name = dns.Fqdn(res.CanonName)
<mask> case res.Reason == filtering.RewrittenAutoHosts && len(res.ReverseHosts) != 0:
<mask> resp := s.makeResponse(req)
<mask> hdr := dns.RR_Header{
<mask> Name: q.Name,
<mask> Rrtype: dns.TypePTR,
<mask> Ttl: s.conf.BlockedResponseTTL,
<mask> Class: dns.ClassINET,
<mask> }
<mask> for _, h := range res.ReverseHosts {
<mask> ptr := &dns.PTR{
<mask> Hdr: hdr,
<mask> Ptr: h,
<mask> }
<mask>
<mask> resp.Answer = append(resp.Answer, ptr)
<mask> }
<mask>
<mask> d.Res = resp
<mask> case res.Reason.In(filtering.Rewritten, filtering.RewrittenAutoHosts):
<mask> resp := s.makeResponse(req)
<mask>
<mask> name := host
<mask> if len(res.CanonName) != 0 {
<mask> resp.Answer = append(resp.Answer, s.genAnswerCNAME(req, res.CanonName))
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove case res.Reason == filtering.RewrittenRule:
</s> add case res.Reason.In(filtering.RewrittenRule, filtering.RewrittenAutoHosts): </s> remove dnsr := dnsres.DNSRewrites()
if len(dnsr) == 0 {
return Result{}, nil
}
var ips []net.IP
var revHosts []string
for _, nr := range dnsr {
if nr.DNSRewrite == nil {
continue
}
switch val := nr.DNSRewrite.Value.(type) {
case net.IP:
ips = append(ips, val)
case string:
revHosts = append(revHosts, val)
}
</s> add if dnsr := dnsres.DNSRewrites(); len(dnsr) > 0 {
// Check DNS rewrites first, because the API there is a bit awkward.
res = d.processDNSRewrites(dnsr)
res.Reason = RewrittenAutoHosts
// TODO(e.burkov): Put real hosts-syntax rules.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/3846.
res.Rules = nil </s> remove for _, name := range names {
ok = clients.addHostLocked(ip, name, ClientSourceHostsFile)
if ok {
</s> add names.Range(func(name string) (cont bool) {
if clients.addHostLocked(ip, name, ClientSourceHostsFile) { </s> remove names, ok := v.([]string)
</s> add names, ok := v.(*stringutil.Set) </s> remove hosts, _ := v.([]string)
if ok && stringutil.InSlice(hosts, host) {
</s> add hosts, _ := v.(*stringutil.Set)
switch {
case ok && hosts.Has(host): </s> add case hosts == nil:
hosts = stringutil.NewSet(host)
hp.table.Set(ip, hosts)
default:
hosts.Add(host) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/dnsforward/filter.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask> }
<mask>
<mask> d.Res = resp
<mask> case res.Reason == filtering.RewrittenRule:
<mask> if err = s.filterDNSRewrite(req, res, d); err != nil {
<mask> return nil, err
<mask> }
<mask> }
<mask>
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove case res.Reason == filtering.RewrittenAutoHosts && len(res.ReverseHosts) != 0:
resp := s.makeResponse(req)
hdr := dns.RR_Header{
Name: q.Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
}
for _, h := range res.ReverseHosts {
ptr := &dns.PTR{
Hdr: hdr,
Ptr: h,
}
resp.Answer = append(resp.Answer, ptr)
}
d.Res = resp
case res.Reason.In(filtering.Rewritten, filtering.RewrittenAutoHosts):
</s> add case res.Reason == filtering.Rewritten: </s> remove _, err = aghos.FileWalker(hp.parseHostsFile).Walk(hc.fsys, hc.patterns...)
if err != nil {
return fmt.Errorf("updating: %w", err)
}
</s> add if hp.equalSet(hc.last) {
log.Debug("%s: no updates detected", hostsContainerPref) </s> add return nil
} </s> add hc.last = hp.table.ShallowClone()
</s> remove return Result{}, nil
</s> add return res, nil </s> remove dnsr := dnsres.DNSRewrites()
if len(dnsr) == 0 {
return Result{}, nil
}
var ips []net.IP
var revHosts []string
for _, nr := range dnsr {
if nr.DNSRewrite == nil {
continue
}
switch val := nr.DNSRewrite.Value.(type) {
case net.IP:
ips = append(ips, val)
case string:
revHosts = append(revHosts, val)
}
</s> add if dnsr := dnsres.DNSRewrites(); len(dnsr) > 0 {
// Check DNS rewrites first, because the API there is a bit awkward.
res = d.processDNSRewrites(dnsr)
res.Reason = RewrittenAutoHosts
// TODO(e.burkov): Put real hosts-syntax rules.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/3846.
res.Rules = nil | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/dnsforward/filter.go |
keep keep keep keep replace keep replace replace replace replace keep keep | <mask> type DNSRewriteResultResponse map[rules.RRType][]rules.RRValue
<mask>
<mask> // processDNSRewrites processes DNS rewrite rules in dnsr. It returns an empty
<mask> // result if dnsr is empty. Otherwise, the result will have either CanonName or
<mask> // DNSRewriteResult set.
<mask> func (d *DNSFilter) processDNSRewrites(dnsr []*rules.NetworkRule) (res Result) {
<mask> if len(dnsr) == 0 {
<mask> return Result{}
<mask> }
<mask>
<mask> var rules []*ResultRule
<mask> dnsrr := &DNSRewriteResult{
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove dnsr := dnsres.DNSRewrites()
if len(dnsr) == 0 {
return Result{}, nil
}
var ips []net.IP
var revHosts []string
for _, nr := range dnsr {
if nr.DNSRewrite == nil {
continue
}
switch val := nr.DNSRewrite.Value.(type) {
case net.IP:
ips = append(ips, val)
case string:
revHosts = append(revHosts, val)
}
</s> add if dnsr := dnsres.DNSRewrites(); len(dnsr) > 0 {
// Check DNS rewrites first, because the API there is a bit awkward.
res = d.processDNSRewrites(dnsr)
res.Reason = RewrittenAutoHosts
// TODO(e.burkov): Put real hosts-syntax rules.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/3846.
res.Rules = nil </s> remove // NewCNAME rules have a higher priority than
// the other rules.
</s> add // NewCNAME rules have a higher priority than the other rules. </s> add //
// TODO(e.burkov): There is no need for AutoHosts-related fields any more
// since the hosts container now uses $dnsrewrite rules. These fields are
// only used in query log to decode old format. </s> remove // RcodeRefused and other such codes have higher
// priority. Return immediately.
</s> add // RcodeRefused and other such codes have higher priority. Return
// immediately. </s> remove return Result{}, nil
</s> add return res, nil | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/filtering/dnsrewrite.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> for _, nr := range dnsr {
<mask> dr := nr.DNSRewrite
<mask> if dr.NewCNAME != "" {
<mask> // NewCNAME rules have a higher priority than
<mask> // the other rules.
<mask> rules = []*ResultRule{{
<mask> FilterListID: int64(nr.GetFilterListID()),
<mask> Text: nr.RuleText,
<mask> }}
<mask>
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove // RcodeRefused and other such codes have higher
// priority. Return immediately.
</s> add // RcodeRefused and other such codes have higher priority. Return
// immediately. </s> remove dnsr := dnsres.DNSRewrites()
if len(dnsr) == 0 {
return Result{}, nil
}
var ips []net.IP
var revHosts []string
for _, nr := range dnsr {
if nr.DNSRewrite == nil {
continue
}
switch val := nr.DNSRewrite.Value.(type) {
case net.IP:
ips = append(ips, val)
case string:
revHosts = append(revHosts, val)
}
</s> add if dnsr := dnsres.DNSRewrites(); len(dnsr) > 0 {
// Check DNS rewrites first, because the API there is a bit awkward.
res = d.processDNSRewrites(dnsr)
res.Reason = RewrittenAutoHosts
// TODO(e.burkov): Put real hosts-syntax rules.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/3846.
res.Rules = nil </s> remove if len(dnsr) == 0 {
return Result{}
}
</s> add </s> remove // DNSRewriteResult set.
</s> add // DNSRewriteResult set. dnsr is expected to be non-empty. </s> remove case res.Reason == filtering.RewrittenAutoHosts && len(res.ReverseHosts) != 0:
resp := s.makeResponse(req)
hdr := dns.RR_Header{
Name: q.Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
}
for _, h := range res.ReverseHosts {
ptr := &dns.PTR{
Hdr: hdr,
Ptr: h,
}
resp.Answer = append(resp.Answer, ptr)
}
d.Res = resp
case res.Reason.In(filtering.Rewritten, filtering.RewrittenAutoHosts):
</s> add case res.Reason == filtering.Rewritten: </s> remove func (hp hostsParser) addPair(ip net.IP, host string) {
</s> add func (hp *hostsParser) addPair(ip net.IP, host string) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/filtering/dnsrewrite.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> FilterListID: int64(nr.GetFilterListID()),
<mask> Text: nr.RuleText,
<mask> })
<mask> default:
<mask> // RcodeRefused and other such codes have higher
<mask> // priority. Return immediately.
<mask> rules = []*ResultRule{{
<mask> FilterListID: int64(nr.GetFilterListID()),
<mask> Text: nr.RuleText,
<mask> }}
<mask> dnsrr = &DNSRewriteResult{
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove // NewCNAME rules have a higher priority than
// the other rules.
</s> add // NewCNAME rules have a higher priority than the other rules. </s> remove if len(dnsr) == 0 {
return Result{}
}
</s> add </s> remove // DNSRewriteResult set.
</s> add // DNSRewriteResult set. dnsr is expected to be non-empty. </s> remove log.Debug("%s: the buffer is full", hostsContainerPref)
</s> add log.Debug("%s: the channel is broken", hostsContainerPref) </s> add case <-ch:
ch <- upd
log.Debug("%s: replaced the last update", hostsContainerPref)
case ch <- upd:
// The previous update was just read and the next one pushed. Go on. </s> remove hp.table.Set(ip, append(hosts, host))
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/filtering/dnsrewrite.go |
keep keep add keep keep keep keep | <mask>
<mask> // ReverseHosts is the reverse lookup rewrite result. It is empty unless
<mask> // Reason is set to RewrittenAutoHosts.
<mask> ReverseHosts []string `json:",omitempty"`
<mask>
<mask> // IPList is the lookup rewrite result. It is empty unless Reason is set to
<mask> // RewrittenAutoHosts or Rewritten.
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove // DNSRewriteResult set.
</s> add // DNSRewriteResult set. dnsr is expected to be non-empty. </s> remove if len(dnsr) == 0 {
return Result{}
}
</s> add </s> add // last is the set of hosts that was cached within last detected change.
last *netutil.IPMap </s> remove // parseHostsFile is a aghtest.FileWalker for parsing the files with hosts
// syntax. It never signs to stop the walking.
</s> add func (hc *HostsContainer) newHostsParser() (hp *hostsParser) {
return &hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(hc.last.Len()),
}
}
// parseFile is a aghos.FileWalker for parsing the files with hosts syntax. It
// never signs to stop walking and never returns any additional patterns. </s> remove // is intended to use within fs.FS so the initial slash is omitted.
</s> add // is intended to be used within fs.FS so the initial slash is omitted. </s> remove func (hp hostsParser) parseHostsFile(
</s> add func (hp *hostsParser) parseFile( | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/filtering/filtering.go |
keep keep keep keep replace keep keep keep keep keep | <mask> return Result{}, nil
<mask> }
<mask>
<mask> // matchSysHosts tries to match the host against the operating system's hosts
<mask> // database.
<mask> func (d *DNSFilter) matchSysHosts(
<mask> host string,
<mask> qtype uint16,
<mask> setts *Settings,
<mask> ) (res Result, err error) {
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove return Result{}, nil
</s> add return res, nil </s> remove func (hp hostsParser) addPair(ip net.IP, host string) {
</s> add func (hp *hostsParser) addPair(ip net.IP, host string) { </s> remove // DNSRewriteResult set.
</s> add // DNSRewriteResult set. dnsr is expected to be non-empty. </s> remove if len(dnsr) == 0 {
return Result{}
}
</s> add </s> remove // is intended to use within fs.FS so the initial slash is omitted.
</s> add // is intended to be used within fs.FS so the initial slash is omitted. </s> remove func (hp hostsParser) add(ip net.IP, host string) (added bool) {
</s> add func (hp *hostsParser) add(ip net.IP, host string) (added bool) { | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/filtering/filtering.go |
keep keep keep keep replace keep keep keep keep keep | <mask> qtype uint16,
<mask> setts *Settings,
<mask> ) (res Result, err error) {
<mask> if !setts.FilteringEnabled || d.EtcHosts == nil {
<mask> return Result{}, nil
<mask> }
<mask>
<mask> dnsres, _ := d.EtcHosts.MatchRequest(urlfilter.DNSRequest{
<mask> Hostname: host,
<mask> SortedClientTags: setts.ClientTags,
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove // database.
</s> add // database. err is always nil. </s> remove // TODO(e.burkov): Wait for urlfilter update to pass net.IP.
</s> add // TODO(e.burkov): Wait for urlfilter update to pass net.IP. </s> remove return Result{}, nil
</s> add return res, nil </s> remove dnsr := dnsres.DNSRewrites()
if len(dnsr) == 0 {
return Result{}, nil
}
var ips []net.IP
var revHosts []string
for _, nr := range dnsr {
if nr.DNSRewrite == nil {
continue
}
switch val := nr.DNSRewrite.Value.(type) {
case net.IP:
ips = append(ips, val)
case string:
revHosts = append(revHosts, val)
}
</s> add if dnsr := dnsres.DNSRewrites(); len(dnsr) > 0 {
// Check DNS rewrites first, because the API there is a bit awkward.
res = d.processDNSRewrites(dnsr)
res.Reason = RewrittenAutoHosts
// TODO(e.burkov): Put real hosts-syntax rules.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/3846.
res.Rules = nil </s> remove case res.Reason == filtering.RewrittenRule:
</s> add case res.Reason.In(filtering.RewrittenRule, filtering.RewrittenAutoHosts): </s> remove _, err = aghos.FileWalker(hp.parseHostsFile).Walk(hc.fsys, hc.patterns...)
if err != nil {
return fmt.Errorf("updating: %w", err)
}
</s> add if hp.equalSet(hc.last) {
log.Debug("%s: no updates detected", hostsContainerPref) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/filtering/filtering.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> dnsres, _ := d.EtcHosts.MatchRequest(urlfilter.DNSRequest{
<mask> Hostname: host,
<mask> SortedClientTags: setts.ClientTags,
<mask> // TODO(e.burkov): Wait for urlfilter update to pass net.IP.
<mask> ClientIP: setts.ClientIP.String(),
<mask> ClientName: setts.ClientName,
<mask> DNSType: qtype,
<mask> })
<mask> if dnsres == nil {
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove return Result{}, nil
</s> add return res, nil </s> remove return Result{}, nil
</s> add return res, nil </s> remove dnsr := dnsres.DNSRewrites()
if len(dnsr) == 0 {
return Result{}, nil
}
var ips []net.IP
var revHosts []string
for _, nr := range dnsr {
if nr.DNSRewrite == nil {
continue
}
switch val := nr.DNSRewrite.Value.(type) {
case net.IP:
ips = append(ips, val)
case string:
revHosts = append(revHosts, val)
}
</s> add if dnsr := dnsres.DNSRewrites(); len(dnsr) > 0 {
// Check DNS rewrites first, because the API there is a bit awkward.
res = d.processDNSRewrites(dnsr)
res.Reason = RewrittenAutoHosts
// TODO(e.burkov): Put real hosts-syntax rules.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/3846.
res.Rules = nil </s> add }, {
name: "a_for_aaaa",
want: []interface{}{
ip4.To16(),
},
req: urlfilter.DNSRequest{
Hostname: hostname4,
DNSType: dns.TypeAAAA,
}, </s> remove ";",
ip.String(),
"\n",
"||",
</s> add sc,
ipStr,
nl,
}, {
// PTR.
rules.MaskStartURL, </s> remove hosts, _ := v.([]string)
if ok && stringutil.InSlice(hosts, host) {
</s> add hosts, _ := v.(*stringutil.Set)
switch {
case ok && hosts.Has(host): | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/filtering/filtering.go |
keep keep keep replace keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep | <mask> DNSType: qtype,
<mask> })
<mask> if dnsres == nil {
<mask> return Result{}, nil
<mask> }
<mask>
<mask> dnsr := dnsres.DNSRewrites()
<mask> if len(dnsr) == 0 {
<mask> return Result{}, nil
<mask> }
<mask>
<mask> var ips []net.IP
<mask> var revHosts []string
<mask> for _, nr := range dnsr {
<mask> if nr.DNSRewrite == nil {
<mask> continue
<mask> }
<mask>
<mask> switch val := nr.DNSRewrite.Value.(type) {
<mask> case net.IP:
<mask> ips = append(ips, val)
<mask> case string:
<mask> revHosts = append(revHosts, val)
<mask> }
<mask> }
<mask>
<mask> return Result{
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove return Result{}, nil
</s> add return res, nil </s> remove case res.Reason == filtering.RewrittenRule:
</s> add case res.Reason.In(filtering.RewrittenRule, filtering.RewrittenAutoHosts): </s> remove return Result{
Reason: RewrittenAutoHosts,
IPList: ips,
ReverseHosts: revHosts,
}, nil
</s> add return res, nil </s> remove if len(dnsr) == 0 {
return Result{}
}
</s> add </s> add case hosts == nil:
hosts = stringutil.NewSet(host)
hp.table.Set(ip, hosts)
default:
hosts.Add(host) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/filtering/filtering.go |
keep keep keep keep replace replace replace replace replace keep keep keep keep keep | <mask> revHosts = append(revHosts, val)
<mask> }
<mask> }
<mask>
<mask> return Result{
<mask> Reason: RewrittenAutoHosts,
<mask> IPList: ips,
<mask> ReverseHosts: revHosts,
<mask> }, nil
<mask> }
<mask>
<mask> // Process rewrites table
<mask> // . Find CNAME for a domain name (exact match or by wildcard)
<mask> // . if found and CNAME equals to domain name - this is an exception; exit
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove dnsr := dnsres.DNSRewrites()
if len(dnsr) == 0 {
return Result{}, nil
}
var ips []net.IP
var revHosts []string
for _, nr := range dnsr {
if nr.DNSRewrite == nil {
continue
}
switch val := nr.DNSRewrite.Value.(type) {
case net.IP:
ips = append(ips, val)
case string:
revHosts = append(revHosts, val)
}
</s> add if dnsr := dnsres.DNSRewrites(); len(dnsr) > 0 {
// Check DNS rewrites first, because the API there is a bit awkward.
res = d.processDNSRewrites(dnsr)
res.Reason = RewrittenAutoHosts
// TODO(e.burkov): Put real hosts-syntax rules.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/3846.
res.Rules = nil </s> remove // parseHostsFile is a aghtest.FileWalker for parsing the files with hosts
// syntax. It never signs to stop the walking.
</s> add func (hc *HostsContainer) newHostsParser() (hp *hostsParser) {
return &hostsParser{
rules: &strings.Builder{},
table: netutil.NewIPMap(hc.last.Len()),
}
}
// parseFile is a aghos.FileWalker for parsing the files with hosts syntax. It
// never signs to stop walking and never returns any additional patterns. </s> remove // DNSRewriteResult set.
</s> add // DNSRewriteResult set. dnsr is expected to be non-empty. </s> remove if len(dnsr) == 0 {
return Result{}
}
</s> add </s> remove // database.
</s> add // database. err is always nil. </s> remove eventsCh := make(chan struct{}, 1)
</s> add // event is a convenient alias for an empty struct{} to emit test events.
type event = struct{}
eventsCh := make(chan event, 1) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/filtering/filtering.go |
keep keep keep keep replace keep keep keep keep replace replace replace keep keep | <mask> clients.rmHostsBySrc(ClientSourceHostsFile)
<mask>
<mask> n := 0
<mask> hosts.Range(func(ip net.IP, v interface{}) (cont bool) {
<mask> names, ok := v.([]string)
<mask> if !ok {
<mask> log.Error("dns: bad type %T in ipToRC for %s", v, ip)
<mask> }
<mask>
<mask> for _, name := range names {
<mask> ok = clients.addHostLocked(ip, name, ClientSourceHostsFile)
<mask> if ok {
<mask> n++
<mask> }
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove }
</s> add return true
}) </s> remove func (hp hostsParser) add(ip net.IP, host string) (added bool) {
</s> add func (hp *hostsParser) add(ip net.IP, host string) (added bool) { </s> remove hosts, _ := v.([]string)
if ok && stringutil.InSlice(hosts, host) {
</s> add hosts, _ := v.(*stringutil.Set)
switch {
case ok && hosts.Has(host): </s> remove case res.Reason == filtering.RewrittenAutoHosts && len(res.ReverseHosts) != 0:
resp := s.makeResponse(req)
hdr := dns.RR_Header{
Name: q.Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
}
for _, h := range res.ReverseHosts {
ptr := &dns.PTR{
Hdr: hdr,
Ptr: h,
}
resp.Answer = append(resp.Answer, ptr)
}
d.Res = resp
case res.Reason.In(filtering.Rewritten, filtering.RewrittenAutoHosts):
</s> add case res.Reason == filtering.Rewritten: </s> remove dnsr := dnsres.DNSRewrites()
if len(dnsr) == 0 {
return Result{}, nil
}
var ips []net.IP
var revHosts []string
for _, nr := range dnsr {
if nr.DNSRewrite == nil {
continue
}
switch val := nr.DNSRewrite.Value.(type) {
case net.IP:
ips = append(ips, val)
case string:
revHosts = append(revHosts, val)
}
</s> add if dnsr := dnsres.DNSRewrites(); len(dnsr) > 0 {
// Check DNS rewrites first, because the API there is a bit awkward.
res = d.processDNSRewrites(dnsr)
res.Reason = RewrittenAutoHosts
// TODO(e.burkov): Put real hosts-syntax rules.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/3846.
res.Rules = nil | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/home/clients.go |
keep keep keep keep replace keep keep keep keep keep | <mask> ok = clients.addHostLocked(ip, name, ClientSourceHostsFile)
<mask> if ok {
<mask> n++
<mask> }
<mask> }
<mask>
<mask> return true
<mask> })
<mask>
<mask> log.Debug("clients: added %d client aliases from system hosts-file", n)
</s> Pull request: 3815 fix hosts container rewrites
Merge in DNS/adguard-home from 3815-weird-rewrites to master
Updates #3815.
Squashed commit of the following:
commit d217db9f5632a3fba5a37fc6ac7b90b8d97fe1cf
Merge: 006b67b9 9c8e0875
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 16:08:41 2021 +0300
Merge branch 'master' into 3815-weird-rewrites
commit 006b67b93199f3818396ad782d90aba32da74092
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 15:49:50 2021 +0300
filtering: fix doc
commit 7ffafcedc7275b007977a539bd63ab20a758eecc
Author: Eugene Burkov <[email protected]>
Date: Tue Nov 16 14:17:41 2021 +0300
all: imp hosts container more
commit b60deddec988762c61060cabad1340a37b154dbb
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 19:06:16 2021 +0300
all: log changes
commit 37c76f478e0db90b3840a931d79465eefeea7945
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 18:14:21 2021 +0300
aghnet: imp hosts container
commit 187251c364f6d23ba7166906b5394a0299657b76
Author: Eugene Burkov <[email protected]>
Date: Sun Nov 14 16:16:41 2021 +0300
all: merge hosts container more </s> remove for _, name := range names {
ok = clients.addHostLocked(ip, name, ClientSourceHostsFile)
if ok {
</s> add names.Range(func(name string) (cont bool) {
if clients.addHostLocked(ip, name, ClientSourceHostsFile) { </s> remove hosts, _ := v.([]string)
if ok && stringutil.InSlice(hosts, host) {
</s> add hosts, _ := v.(*stringutil.Set)
switch {
case ok && hosts.Has(host): </s> remove func (hp hostsParser) add(ip net.IP, host string) (added bool) {
</s> add func (hp *hostsParser) add(ip net.IP, host string) (added bool) { </s> add case hosts == nil:
hosts = stringutil.NewSet(host)
hp.table.Set(ip, hosts)
default:
hosts.Add(host) </s> remove hp.table.Set(ip, append(hosts, host))
</s> add </s> remove assert.Equal(t, wantHosts, hosts)
</s> add assert.True(t, hosts.Equal(wantHosts)) | https://github.com/AdguardTeam/AdGuardHome/commit/4a4b4715ca3b028c3efc9169f949f9a65bf5364c | internal/home/clients.go |
keep keep keep add keep keep keep keep keep keep | <mask> "sync"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/dnsproxy/upstream"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/joomcode/errorx"
<mask> "github.com/miekg/dns"
<mask> )
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> remove gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477
</s> add </s> add go.etcd.io/bbolt v1.3.3 // indirect </s> add stats stats.Stats | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | dnsforward/dnsforward.go |
keep keep add keep keep keep keep | <mask> dnsProxy *proxy.Proxy // DNS proxy instance
<mask> dnsFilter *dnsfilter.Dnsfilter // DNS filter instance
<mask> queryLog *queryLog // Query log instance
<mask>
<mask> AllowedClients map[string]bool // IP addresses of whitelist clients
<mask> DisallowedClients map[string]bool // IP addresses of clients that should be blocked
<mask> AllowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove func NewServer(baseDir string) *Server {
</s> add func NewServer(baseDir string, stats stats.Stats) *Server { </s> add go.etcd.io/bbolt v1.3.3 // indirect </s> add // Get stats configuration </s> add stats stats.Stats </s> add github.com/etcd-io/bbolt v1.3.3 </s> add // Set stats configuration | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | dnsforward/dnsforward.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> // NewServer creates a new instance of the dnsforward.Server
<mask> // baseDir is the base directory for query logs
<mask> // Note: this function must be called only once
<mask> func NewServer(baseDir string) *Server {
<mask> s := &Server{
<mask> queryLog: newQueryLog(baseDir),
<mask> }
<mask>
<mask> log.Printf("Start DNS server periodic jobs")
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add s.stats = stats </s> add stats stats.Stats </s> remove s := NewServer(createDataDir(t))
</s> add s := NewServer(createDataDir(t), nil) </s> add stats stats.Stats </s> add // Get stats configuration </s> add // Set stats configuration | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | dnsforward/dnsforward.go |
keep keep add keep keep keep keep keep | <mask> s := &Server{
<mask> queryLog: newQueryLog(baseDir),
<mask> }
<mask>
<mask> log.Printf("Start DNS server periodic jobs")
<mask> go s.queryLog.periodicQueryLogRotate()
<mask> return s
<mask> }
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove func NewServer(baseDir string) *Server {
</s> add func NewServer(baseDir string, stats stats.Stats) *Server { </s> remove s := NewServer(createDataDir(t))
</s> add s := NewServer(createDataDir(t), nil) </s> add config.stats.Close()
</s> add // Set stats configuration </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> add stats stats.Stats | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | dnsforward/dnsforward.go |
keep keep add keep keep keep keep keep | <mask> shouldLog = false
<mask> }
<mask>
<mask> if s.conf.QueryLogEnabled && shouldLog {
<mask> upstreamAddr := ""
<mask> if d.Upstream != nil {
<mask> upstreamAddr = d.Upstream.Address()
<mask> }
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove elapsed := time.Since(start)
</s> add </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> add // Set stats configuration </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> remove s := NewServer(createDataDir(t))
</s> add s := NewServer(createDataDir(t), nil) | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | dnsforward/dnsforward.go |
keep keep keep keep replace keep keep keep keep keep | <mask> shouldLog = false
<mask> }
<mask>
<mask> if s.conf.QueryLogEnabled && shouldLog {
<mask> elapsed := time.Since(start)
<mask> upstreamAddr := ""
<mask> if d.Upstream != nil {
<mask> upstreamAddr = d.Upstream.Address()
<mask> }
<mask> _ = s.queryLog.logRequest(msg, d.Res, res, elapsed, d.Addr, upstreamAddr)
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add elapsed := time.Since(start) </s> add s.updateStats(d, elapsed, *res)
</s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) </s> remove s := NewServer(createDataDir(t))
</s> add s := NewServer(createDataDir(t), nil) </s> add // Set stats configuration | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | dnsforward/dnsforward.go |
keep keep keep add keep keep keep keep | <mask> }
<mask> _ = s.queryLog.logRequest(msg, d.Res, res, elapsed, d.Addr, upstreamAddr)
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
<mask> func (s *Server) updateStats(d *proxy.DNSContext, elapsed time.Duration, res dnsfilter.Result) {
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove elapsed := time.Since(start)
</s> add </s> add elapsed := time.Since(start) </s> add config.stats.Close()
</s> add // Set stats configuration </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | dnsforward/dnsforward.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask> }
<mask>
<mask> func createTestServer(t *testing.T) *Server {
<mask> s := NewServer(createDataDir(t))
<mask> s.conf.UDPListenAddr = &net.UDPAddr{Port: 0}
<mask> s.conf.TCPListenAddr = &net.TCPAddr{Port: 0}
<mask>
<mask> s.conf.QueryLogEnabled = true
<mask> s.conf.FilteringConfig.FilteringEnabled = true
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add elapsed := time.Since(start) </s> remove elapsed := time.Since(start)
</s> add </s> add s.stats = stats </s> remove func NewServer(baseDir string) *Server {
</s> add func NewServer(baseDir string, stats stats.Stats) *Server { </s> add // Get stats configuration </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | dnsforward/dnsforward_test.go |
keep keep keep add keep keep keep keep | <mask> github.com/AdguardTeam/dnsproxy v0.19.1
<mask> github.com/AdguardTeam/golibs v0.2.1
<mask> github.com/AdguardTeam/urlfilter v0.5.0
<mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833
<mask> github.com/etcd-io/bbolt v1.3.3
<mask> github.com/go-test/deep v1.0.1
<mask> github.com/gobuffalo/packr v1.19.0
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add github.com/etcd-io/bbolt v1.3.3 </s> add github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= </s> add go.etcd.io/bbolt v1.3.3 // indirect </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) </s> add stats stats.Stats </s> remove func NewServer(baseDir string) *Server {
</s> add func NewServer(baseDir string, stats stats.Stats) *Server { | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | go.mod |
keep keep keep add keep keep keep keep keep | <mask> github.com/AdguardTeam/urlfilter v0.5.0
<mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf
<mask> github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833
<mask> github.com/go-test/deep v1.0.1
<mask> github.com/gobuffalo/packr v1.19.0
<mask> github.com/joomcode/errorx v0.8.0
<mask> github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect
<mask> github.com/kardianos/service v0.0.0-20181115005516-4c239ee84e7b
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf </s> add github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= </s> add go.etcd.io/bbolt v1.3.3 // indirect </s> add stats stats.Stats </s> remove func NewServer(baseDir string) *Server {
</s> add func NewServer(baseDir string, stats stats.Stats) *Server { </s> add // Get stats configuration | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | go.mod |
keep keep keep add keep keep keep keep | <mask> github.com/krolaw/dhcp4 v0.0.0-20180925202202-7cead472c414
<mask> github.com/miekg/dns v1.1.8
<mask> github.com/sparrc/go-ping v0.0.0-20181106165434-ef3ab45e41b0
<mask> github.com/stretchr/testify v1.4.0
<mask> golang.org/x/net v0.0.0-20190620200207-3b0461eec859
<mask> golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0
<mask> gopkg.in/yaml.v2 v2.2.2
<mask> )
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477
</s> add </s> add go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> remove gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477 h1:5xUJw+lg4zao9W4HIDzlFbMYgSgtvNVHh00MEHvbGpQ=
gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477/go.mod h1:QDV1vrFSrowdoOba0UM8VJPUZONT7dnfdLsM+GG53Z8=
</s> add </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | go.mod |
keep keep keep keep replace keep keep | <mask> github.com/sparrc/go-ping v0.0.0-20181106165434-ef3ab45e41b0
<mask> github.com/stretchr/testify v1.4.0
<mask> golang.org/x/net v0.0.0-20190620200207-3b0461eec859
<mask> golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0
<mask> gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477
<mask> gopkg.in/yaml.v2 v2.2.2
<mask> )
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add go.etcd.io/bbolt v1.3.3 // indirect </s> remove gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477 h1:5xUJw+lg4zao9W4HIDzlFbMYgSgtvNVHh00MEHvbGpQ=
gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477/go.mod h1:QDV1vrFSrowdoOba0UM8VJPUZONT7dnfdLsM+GG53Z8=
</s> add </s> add go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | go.mod |
keep keep add keep keep keep keep keep | <mask> github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
<mask> github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
<mask> github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
<mask> github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
<mask> github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
<mask> github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg=
<mask> github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
<mask> github.com/gobuffalo/envy v1.6.7 h1:XMZGuFqTupAXhZTriQ+qO38QvNOSU/0rl3hEPCFci/4=
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf </s> add github.com/etcd-io/bbolt v1.3.3 </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) </s> add stats stats.Stats </s> remove func NewServer(baseDir string) *Server {
</s> add func NewServer(baseDir string, stats stats.Stats) *Server { </s> add s.stats = stats | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | go.sum |
keep keep add keep keep keep keep keep keep | <mask> github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
<mask> github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
<mask> github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
<mask> golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0=
<mask> golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
<mask> golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
<mask> golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
<mask> golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 h1:58fnuSXlxZmFdJyvtTFVmVhcMLU6v5fEb/ok4wyqtNU=
<mask> golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477
</s> add </s> add go.etcd.io/bbolt v1.3.3 // indirect </s> add config.stats.Close()
</s> add stats stats.Stats </s> remove func NewServer(baseDir string) *Server {
</s> add func NewServer(baseDir string, stats stats.Stats) *Server { </s> add s.stats = stats | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | go.sum |
keep keep keep keep replace replace keep keep keep | <mask> golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
<mask> golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
<mask> golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
<mask> golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
<mask> gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477 h1:5xUJw+lg4zao9W4HIDzlFbMYgSgtvNVHh00MEHvbGpQ=
<mask> gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477/go.mod h1:QDV1vrFSrowdoOba0UM8VJPUZONT7dnfdLsM+GG53Z8=
<mask> gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
<mask> gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
<mask> gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477
</s> add </s> add go.etcd.io/bbolt v1.3.3 // indirect </s> add config.stats.Close()
</s> add stats stats.Stats </s> remove func NewServer(baseDir string) *Server {
</s> add func NewServer(baseDir string, stats stats.Stats) *Server { </s> add s.stats = stats | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | go.sum |
keep keep keep add keep keep keep keep keep keep | <mask>
<mask> "github.com/AdguardTeam/AdGuardHome/dhcpd"
<mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter"
<mask> "github.com/AdguardTeam/AdGuardHome/dnsforward"
<mask> "github.com/AdguardTeam/golibs/file"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> yaml "gopkg.in/yaml.v2"
<mask> )
<mask>
<mask> const (
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> remove gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477
</s> add </s> add go.etcd.io/bbolt v1.3.3 // indirect </s> add stats stats.Stats | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/config.go |
keep add keep keep keep keep keep | <mask> transport *http.Transport
<mask> client *http.Client
<mask>
<mask> // cached version.json to avoid hammering github.io for each page reload
<mask> versionCheckJSON []byte
<mask> versionCheckLastTime time.Time
<mask>
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove func NewServer(baseDir string) *Server {
</s> add func NewServer(baseDir string, stats stats.Stats) *Server { </s> add stats stats.Stats </s> add go.etcd.io/bbolt v1.3.3 // indirect </s> add // Get stats configuration </s> add github.com/etcd-io/bbolt v1.3.3 </s> add // Set stats configuration | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/config.go |
keep keep add keep keep keep keep keep | <mask> "encoding/json"
<mask> "net/http"
<mask>
<mask> "github.com/AdguardTeam/golibs/log"
<mask> )
<mask>
<mask> type statsConfig struct {
<mask> Interval uint `json:"interval"`
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> remove gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477
</s> add </s> add go.etcd.io/bbolt v1.3.3 // indirect | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/control_stats.go |
keep add keep keep keep keep keep | <mask> }
<mask>
<mask> func handleStatsInfo(w http.ResponseWriter, r *http.Request) {
<mask> resp := statsConfig{}
<mask> resp.Interval = config.DNS.StatsInterval
<mask>
<mask> jsonVal, err := json.Marshal(resp)
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> add // Set stats configuration </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> remove s := NewServer(createDataDir(t))
</s> add s := NewServer(createDataDir(t), nil) </s> add elapsed := time.Since(start) </s> remove elapsed := time.Since(start)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/control_stats.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> Interval uint `json:"interval"`
<mask> }
<mask>
<mask> func handleStatsInfo(w http.ResponseWriter, r *http.Request) {
<mask> log.Tracef("%s %v", r.Method, r.URL)
<mask>
<mask> resp := statsConfig{}
<mask> resp.Interval = config.DNS.StatsInterval
<mask>
<mask> jsonVal, err := json.Marshal(resp)
<mask> if err != nil {
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add // Get stats configuration </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> add // Set stats configuration </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) </s> add elapsed := time.Since(start) | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/control_stats.go |
keep add keep keep keep keep keep keep | <mask> }
<mask>
<mask> func handleStatsConfig(w http.ResponseWriter, r *http.Request) {
<mask> reqData := statsConfig{}
<mask> err := json.NewDecoder(r.Body).Decode(&reqData)
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "json decode: %s", err)
<mask> return
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> add // Get stats configuration </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) </s> add elapsed := time.Since(start) </s> remove elapsed := time.Since(start)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/control_stats.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> }
<mask> }
<mask>
<mask> func handleStatsConfig(w http.ResponseWriter, r *http.Request) {
<mask> log.Tracef("%s %v", r.Method, r.URL)
<mask>
<mask> reqData := statsConfig{}
<mask> err := json.NewDecoder(r.Body).Decode(&reqData)
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "json decode: %s", err)
<mask> return
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add // Set stats configuration </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> add // Get stats configuration </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) </s> add elapsed := time.Since(start) </s> remove elapsed := time.Since(start)
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/control_stats.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> config.DNS.StatsInterval = reqData.Interval
<mask>
<mask> httpUpdateConfigReloadDNSReturnOK(w, r)
<mask> }
<mask>
<mask> func checkStatsInterval(i uint) bool {
<mask> return i == 1 || i == 7 || i == 30 || i == 90
<mask> }
</s> + statistics: store in separate file
+ GET /control/stats handler </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) </s> add // Get stats configuration </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> add s.updateStats(d, elapsed, *res)
</s> add s.stats = stats </s> add config.stats.Close()
| https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/control_stats.go |
keep add keep keep keep keep keep | <mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter"
<mask> "github.com/AdguardTeam/AdGuardHome/dnsforward"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/dnsproxy/upstream"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/joomcode/errorx"
<mask> "github.com/miekg/dns"
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add "github.com/AdguardTeam/AdGuardHome/stats" </s> add go.etcd.io/bbolt v1.3.3 // indirect </s> add stats stats.Stats </s> remove func NewServer(baseDir string) *Server {
</s> add func NewServer(baseDir string, stats stats.Stats) *Server { | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> if err != nil {
<mask> log.Fatalf("Cannot create DNS data dir at %s: %s", baseDir, err)
<mask> }
<mask>
<mask> config.dnsServer = dnsforward.NewServer(baseDir)
<mask>
<mask> initRDNS()
<mask> }
<mask>
<mask> func isRunning() bool {
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add // Set stats configuration </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> add elapsed := time.Since(start) </s> remove elapsed := time.Since(start)
</s> add </s> add // Get stats configuration | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/dns.go |
keep keep add keep keep | <mask> return errorx.Decorate(err, "Couldn't stop forwarding DNS server")
<mask> }
<mask>
<mask> return nil
<mask> }
</s> + statistics: store in separate file
+ GET /control/stats handler </s> add s.stats = stats </s> add s.updateStats(d, elapsed, *res)
</s> add // Set stats configuration </s> remove log.Tracef("%s %v", r.Method, r.URL)
</s> add </s> remove config.dnsServer = dnsforward.NewServer(baseDir)
</s> add config.stats = stats.New("./data/stats.db", int(config.DNS.StatsInterval), nil)
if config.stats == nil {
log.Fatal("config.stats == nil")
}
config.dnsServer = dnsforward.NewServer(baseDir, config.stats) </s> remove httpUpdateConfigReloadDNSReturnOK(w, r)
</s> add // RegisterStatsHandlers - register handlers
func RegisterStatsHandlers() {
httpRegister(http.MethodGet, "/control/stats", handleStats)
httpRegister(http.MethodPost, "/control/stats_reset", handleStatsReset)
httpRegister(http.MethodPost, "/control/stats_config", handleStatsConfig)
httpRegister(http.MethodGet, "/control/stats_info", handleStatsInfo) | https://github.com/AdguardTeam/AdGuardHome/commit/4a58266ba37a0c34ff9b0d22a1c4f5442cef2d4b | home/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> // These aliases are provided for convenience.
<mask> type (
<mask> yarr = []any
<mask> yobj = map[any]any
<mask> )
<mask>
<mask> // Performs necessary upgrade operations if needed
<mask> func upgradeConfig() error {
<mask> // read a config file into an interface map, so we can manipulate values without losing any
</s> Pull request: 4846-migration-fix
Updates #4846.
Squashed commit of the following:
commit 22e2e89e5390c7b1486fb69064c55da40fc5c7e7
Author: Ainar Garipov <[email protected]>
Date: Thu Aug 18 16:25:07 2022 +0300
home: fix yaml object type </s> remove case map[any]any:
</s> add case yobj: </s> remove return fmt.Errorf("dns configuration is not a map")
</s> add return fmt.Errorf("unexpected type of dns: %T", dnsConfig) | https://github.com/AdguardTeam/AdGuardHome/commit/4a7b4d03a1d81062bb6e708b51c42e64ee23618a | internal/home/upgrade.go |
keep keep keep replace keep keep keep keep replace keep keep keep | <mask> newDNSConfig := make(yobj)
<mask>
<mask> switch v := dnsConfig.(type) {
<mask> case map[any]any:
<mask> for k, v := range v {
<mask> newDNSConfig[fmt.Sprint(k)] = v
<mask> }
<mask> default:
<mask> return fmt.Errorf("dns configuration is not a map")
<mask> }
<mask>
<mask> // Replace bootstrap_dns value filed with new array contains old bootstrap_dns inside
</s> Pull request: 4846-migration-fix
Updates #4846.
Squashed commit of the following:
commit 22e2e89e5390c7b1486fb69064c55da40fc5c7e7
Author: Ainar Garipov <[email protected]>
Date: Thu Aug 18 16:25:07 2022 +0300
home: fix yaml object type </s> remove yobj = map[any]any
</s> add yobj = map[string]any | https://github.com/AdguardTeam/AdGuardHome/commit/4a7b4d03a1d81062bb6e708b51c42e64ee23618a | internal/home/upgrade.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> go 1.16
<mask>
<mask> require (
<mask> github.com/AdguardTeam/dnsproxy v0.38.0
<mask> github.com/AdguardTeam/golibs v0.8.0
<mask> github.com/AdguardTeam/urlfilter v0.14.6
<mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/ameshkov/dnscrypt/v2 v2.1.3
<mask> github.com/digineo/go-ipset/v2 v2.2.1
</s> Pull request #1237: all: upd dnsproxy
Updates #3315.
Squashed commit of the following:
commit f91b979b4b9eb8141e7320a54992786a699aa437
Author: Ainar Garipov <[email protected]>
Date: Tue Jul 6 13:48:29 2021 +0300
all: upd dnsproxy </s> remove github.com/AdguardTeam/golibs v0.4.4/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
</s> add </s> remove github.com/AdguardTeam/dnsproxy v0.38.0 h1:7GyyNJOieIVOgdnhu47exqWjHPQro7wQhqzvQjaZt6M=
github.com/AdguardTeam/dnsproxy v0.38.0/go.mod h1:xMfevPAwpK1ULoLO0CARg/OiUsPH92kfyliXhPTc62M=
</s> add github.com/AdguardTeam/dnsproxy v0.38.2 h1:QHxvShAm4GwH0PyRN60xf18+5nAzmbvhPoEvhfVycSA=
github.com/AdguardTeam/dnsproxy v0.38.2/go.mod h1:aNXKNdTyKfgAG2OS712SYSaGIM9AasZsZxfiY4YiR/0= | https://github.com/AdguardTeam/AdGuardHome/commit/4b5a66ee617cc364c26a3d4293ae4dba378c3f26 | go.mod |
keep keep keep keep replace replace keep keep replace keep keep keep keep | <mask> dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
<mask> git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
<mask> github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf h1:gc042VRSIRSUzZ+Px6xQCRWNJZTaPkomisDfUZmoFNk=
<mask> github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI=
<mask> github.com/AdguardTeam/dnsproxy v0.38.0 h1:7GyyNJOieIVOgdnhu47exqWjHPQro7wQhqzvQjaZt6M=
<mask> github.com/AdguardTeam/dnsproxy v0.38.0/go.mod h1:xMfevPAwpK1ULoLO0CARg/OiUsPH92kfyliXhPTc62M=
<mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.4.4/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.8.0 h1:rHo+yIgT2fivFG0yW2Cwk/DPc2+t/Aw6QvzPpiIFre0=
<mask> github.com/AdguardTeam/golibs v0.8.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU=
<mask> github.com/AdguardTeam/urlfilter v0.14.6 h1:emqoKZElooHACYehRBYENeKVN1a/rspxiqTIMYLuoIo=
</s> Pull request #1237: all: upd dnsproxy
Updates #3315.
Squashed commit of the following:
commit f91b979b4b9eb8141e7320a54992786a699aa437
Author: Ainar Garipov <[email protected]>
Date: Tue Jul 6 13:48:29 2021 +0300
all: upd dnsproxy </s> remove github.com/AdguardTeam/dnsproxy v0.38.0
</s> add github.com/AdguardTeam/dnsproxy v0.38.2 | https://github.com/AdguardTeam/AdGuardHome/commit/4b5a66ee617cc364c26a3d4293ae4dba378c3f26 | go.sum |
keep add keep keep keep keep keep keep | <mask>
<mask> // To transfer information between modules
<mask> type dnsContext struct {
<mask> proxyCtx *proxy.DNSContext
<mask>
<mask> // setts are the filtering settings for the client.
<mask> setts *filtering.Settings
<mask>
</s> Pull request 1727: 4299-querylog-ignore
Merge in DNS/adguard-home from 4299-querylog-ignore to master
Squashed commit of the following:
commit 06f32fef860d63dc2af9aad8d4251918c5babd00
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 17:14:26 2023 +0300
add debug msg
commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:30:06 2023 +0300
add line break
commit a96fe712b6e5c6a190a92b2f83ed031a85658e58
Merge: d1035219 b8d55eaf
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:12:32 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit d1035219e15e5b5639b2fc39e0b17cfc05904722
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:11:03 2023 +0300
fix docs
commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 15:30:16 2023 +0300
fix issue link
commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 14:34:11 2023 +0300
all: add issues links
commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 13:11:58 2023 +0300
all: add log message
commit a40a0c87937abb778e4e632a5403543371b6d2e0
Merge: 87fd71ba b31bab59
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:16:08 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:13:44 2023 +0300
all: add todo
commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c
Author: Stanislav Chzhen <[email protected]>
Date: Mon Feb 6 13:27:24 2023 +0300
all: add changelog
commit 8d227b684794e306e314d8cb848fe354d4578607
Author: Stanislav Chzhen <[email protected]>
Date: Fri Feb 3 16:06:43 2023 +0300
all: querylog ignore </s> add // Ignored is the list of host names, which are should not be written
// to log.
Ignored *stringutil.Set </s> remove DNS dnsConfig `yaml:"dns"`
TLS tlsConfigSettings `yaml:"tls"`
</s> add DNS dnsConfig `yaml:"dns"`
TLS tlsConfigSettings `yaml:"tls"`
QueryLog queryLogConfig `yaml:"querylog"` </s> add // ShouldLog returns true if request for the host should be logged.
ShouldLog(host string, qType, qClass uint16) bool </s> add // ShouldLog implements the [querylog.QueryLog] interface for *testQueryLog.
func (l *testQueryLog) ShouldLog(string, uint16, uint16) bool {
return true
}
</s> remove const currentSchemaVersion = 14
</s> add const currentSchemaVersion = 15 </s> remove // QueryLogEnabled defines if the query log is enabled.
QueryLogEnabled bool `yaml:"querylog_enabled"`
// QueryLogFileEnabled defines, if the query log is written to the file.
QueryLogFileEnabled bool `yaml:"querylog_file_enabled"`
// QueryLogInterval is the interval for query log's files rotation.
QueryLogInterval timeutil.Duration `yaml:"querylog_interval"`
// QueryLogMemSize is the number of entries kept in memory before they are
// flushed to disk.
QueryLogMemSize uint32 `yaml:"querylog_size_memory"`
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3 | internal/dnsforward/dns.go |
keep keep add keep keep keep keep keep | <mask>
<mask> shouldLog := true
<mask> msg := pctx.Req
<mask>
<mask> // don't log ANY request if refuseAny is enabled
<mask> if q.Qtype == dns.TypeANY && s.conf.RefuseAny {
<mask> shouldLog = false
<mask> }
</s> Pull request 1727: 4299-querylog-ignore
Merge in DNS/adguard-home from 4299-querylog-ignore to master
Squashed commit of the following:
commit 06f32fef860d63dc2af9aad8d4251918c5babd00
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 17:14:26 2023 +0300
add debug msg
commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:30:06 2023 +0300
add line break
commit a96fe712b6e5c6a190a92b2f83ed031a85658e58
Merge: d1035219 b8d55eaf
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:12:32 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit d1035219e15e5b5639b2fc39e0b17cfc05904722
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:11:03 2023 +0300
fix docs
commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 15:30:16 2023 +0300
fix issue link
commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 14:34:11 2023 +0300
all: add issues links
commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 13:11:58 2023 +0300
all: add log message
commit a40a0c87937abb778e4e632a5403543371b6d2e0
Merge: 87fd71ba b31bab59
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:16:08 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:13:44 2023 +0300
all: add todo
commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c
Author: Stanislav Chzhen <[email protected]>
Date: Mon Feb 6 13:27:24 2023 +0300
all: add changelog
commit 8d227b684794e306e314d8cb848fe354d4578607
Author: Stanislav Chzhen <[email protected]>
Date: Fri Feb 3 16:06:43 2023 +0300
all: querylog ignore </s> remove if len(msg.Question) >= 1 && msg.Question[0].Qtype == dns.TypeANY && s.conf.RefuseAny {
</s> add if q.Qtype == dns.TypeANY && s.conf.RefuseAny { </s> remove if shouldLog && s.queryLog != nil {
</s> add if shouldLog &&
s.queryLog != nil &&
s.queryLog.ShouldLog(host, q.Qtype, q.Qclass) { </s> add } else {
log.Debug("request for %s from %s ignored; not logging", host, ip) </s> add // ShouldLog returns true if request for the host should be logged.
func (l *queryLog) ShouldLog(host string, _, _ uint16) bool {
return !l.isIgnored(host)
}
// isIgnored returns true if the host is in the Ignored list.
func (l *queryLog) isIgnored(host string) bool {
return l.conf.Ignored.Has(host)
} </s> add upgradeSchema14to15, </s> add // ShouldLog returns true if request for the host should be logged.
ShouldLog(host string, qType, qClass uint16) bool | https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3 | internal/dnsforward/stats.go |
keep keep keep keep replace keep keep keep keep keep | <mask> shouldLog := true
<mask> msg := pctx.Req
<mask>
<mask> // don't log ANY request if refuseAny is enabled
<mask> if len(msg.Question) >= 1 && msg.Question[0].Qtype == dns.TypeANY && s.conf.RefuseAny {
<mask> shouldLog = false
<mask> }
<mask>
<mask> ip, _ := netutil.IPAndPortFromAddr(pctx.Addr)
<mask> ip = slices.Clone(ip)
</s> Pull request 1727: 4299-querylog-ignore
Merge in DNS/adguard-home from 4299-querylog-ignore to master
Squashed commit of the following:
commit 06f32fef860d63dc2af9aad8d4251918c5babd00
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 17:14:26 2023 +0300
add debug msg
commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:30:06 2023 +0300
add line break
commit a96fe712b6e5c6a190a92b2f83ed031a85658e58
Merge: d1035219 b8d55eaf
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:12:32 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit d1035219e15e5b5639b2fc39e0b17cfc05904722
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:11:03 2023 +0300
fix docs
commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 15:30:16 2023 +0300
fix issue link
commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 14:34:11 2023 +0300
all: add issues links
commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 13:11:58 2023 +0300
all: add log message
commit a40a0c87937abb778e4e632a5403543371b6d2e0
Merge: 87fd71ba b31bab59
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:16:08 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:13:44 2023 +0300
all: add todo
commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c
Author: Stanislav Chzhen <[email protected]>
Date: Mon Feb 6 13:27:24 2023 +0300
all: add changelog
commit 8d227b684794e306e314d8cb848fe354d4578607
Author: Stanislav Chzhen <[email protected]>
Date: Fri Feb 3 16:06:43 2023 +0300
all: querylog ignore </s> add q := msg.Question[0]
host := strings.ToLower(strings.TrimSuffix(q.Name, ".")) </s> remove if shouldLog && s.queryLog != nil {
</s> add if shouldLog &&
s.queryLog != nil &&
s.queryLog.ShouldLog(host, q.Qtype, q.Qclass) { </s> add } else {
log.Debug("request for %s from %s ignored; not logging", host, ip) </s> add // ShouldLog returns true if request for the host should be logged.
func (l *queryLog) ShouldLog(host string, _, _ uint16) bool {
return !l.isIgnored(host)
}
// isIgnored returns true if the host is in the Ignored list.
func (l *queryLog) isIgnored(host string) bool {
return l.conf.Ignored.Has(host)
} </s> add upgradeSchema14to15, </s> add RotationIvl: config.QueryLog.Interval.Duration,
MemSize: config.QueryLog.MemSize,
Enabled: config.QueryLog.Enabled,
FileEnabled: config.QueryLog.FileEnabled,
Ignored: stringutil.NewSet(),
}
for _, v := range config.QueryLog.Ignored {
host := strings.ToLower(strings.TrimSuffix(v, "."))
if conf.Ignored.Has(host) {
return fmt.Errorf("duplicate ignored host %s", host)
}
conf.Ignored.Add(host) | https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3 | internal/dnsforward/stats.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> // Synchronize access to s.queryLog and s.stats so they won't be suddenly
<mask> // uninitialized while in use. This can happen after proxy server has been
<mask> // stopped, but its workers haven't yet exited.
<mask> if shouldLog && s.queryLog != nil {
<mask> s.logQuery(dctx, pctx, elapsed, ip)
<mask> }
<mask>
<mask> if s.stats != nil {
<mask> s.updateStats(dctx, elapsed, *dctx.result, ip)
</s> Pull request 1727: 4299-querylog-ignore
Merge in DNS/adguard-home from 4299-querylog-ignore to master
Squashed commit of the following:
commit 06f32fef860d63dc2af9aad8d4251918c5babd00
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 17:14:26 2023 +0300
add debug msg
commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:30:06 2023 +0300
add line break
commit a96fe712b6e5c6a190a92b2f83ed031a85658e58
Merge: d1035219 b8d55eaf
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:12:32 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit d1035219e15e5b5639b2fc39e0b17cfc05904722
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:11:03 2023 +0300
fix docs
commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 15:30:16 2023 +0300
fix issue link
commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 14:34:11 2023 +0300
all: add issues links
commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 13:11:58 2023 +0300
all: add log message
commit a40a0c87937abb778e4e632a5403543371b6d2e0
Merge: 87fd71ba b31bab59
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:16:08 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:13:44 2023 +0300
all: add todo
commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c
Author: Stanislav Chzhen <[email protected]>
Date: Mon Feb 6 13:27:24 2023 +0300
all: add changelog
commit 8d227b684794e306e314d8cb848fe354d4578607
Author: Stanislav Chzhen <[email protected]>
Date: Fri Feb 3 16:06:43 2023 +0300
all: querylog ignore </s> add } else {
log.Debug("request for %s from %s ignored; not logging", host, ip) </s> remove config.DNS.QueryLogEnabled = dc.Enabled
config.DNS.QueryLogFileEnabled = dc.FileEnabled
config.DNS.QueryLogInterval = timeutil.Duration{Duration: dc.RotationIvl}
config.DNS.QueryLogMemSize = dc.MemSize
</s> add </s> remove // QueryLogEnabled defines if the query log is enabled.
QueryLogEnabled bool `yaml:"querylog_enabled"`
// QueryLogFileEnabled defines, if the query log is written to the file.
QueryLogFileEnabled bool `yaml:"querylog_file_enabled"`
// QueryLogInterval is the interval for query log's files rotation.
QueryLogInterval timeutil.Duration `yaml:"querylog_interval"`
// QueryLogMemSize is the number of entries kept in memory before they are
// flushed to disk.
QueryLogMemSize uint32 `yaml:"querylog_size_memory"`
</s> add </s> remove if len(msg.Question) >= 1 && msg.Question[0].Qtype == dns.TypeANY && s.conf.RefuseAny {
</s> add if q.Qtype == dns.TypeANY && s.conf.RefuseAny { </s> add if l.isIgnored(e.QHost) {
return nil, ts, nil
}
</s> add q := msg.Question[0]
host := strings.ToLower(strings.TrimSuffix(q.Name, ".")) | https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3 | internal/dnsforward/stats.go |
keep keep keep add keep keep keep keep keep | <mask> if shouldLog &&
<mask> s.queryLog != nil &&
<mask> s.queryLog.ShouldLog(host, q.Qtype, q.Qclass) {
<mask> s.logQuery(dctx, pctx, elapsed, ip)
<mask> }
<mask>
<mask> if s.stats != nil {
<mask> s.updateStats(dctx, elapsed, *dctx.result, ip)
<mask> }
</s> Pull request 1727: 4299-querylog-ignore
Merge in DNS/adguard-home from 4299-querylog-ignore to master
Squashed commit of the following:
commit 06f32fef860d63dc2af9aad8d4251918c5babd00
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 17:14:26 2023 +0300
add debug msg
commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:30:06 2023 +0300
add line break
commit a96fe712b6e5c6a190a92b2f83ed031a85658e58
Merge: d1035219 b8d55eaf
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:12:32 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit d1035219e15e5b5639b2fc39e0b17cfc05904722
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:11:03 2023 +0300
fix docs
commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 15:30:16 2023 +0300
fix issue link
commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 14:34:11 2023 +0300
all: add issues links
commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 13:11:58 2023 +0300
all: add log message
commit a40a0c87937abb778e4e632a5403543371b6d2e0
Merge: 87fd71ba b31bab59
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:16:08 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:13:44 2023 +0300
all: add todo
commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c
Author: Stanislav Chzhen <[email protected]>
Date: Mon Feb 6 13:27:24 2023 +0300
all: add changelog
commit 8d227b684794e306e314d8cb848fe354d4578607
Author: Stanislav Chzhen <[email protected]>
Date: Fri Feb 3 16:06:43 2023 +0300
all: querylog ignore </s> remove if shouldLog && s.queryLog != nil {
</s> add if shouldLog &&
s.queryLog != nil &&
s.queryLog.ShouldLog(host, q.Qtype, q.Qclass) { </s> remove config.DNS.QueryLogEnabled = dc.Enabled
config.DNS.QueryLogFileEnabled = dc.FileEnabled
config.DNS.QueryLogInterval = timeutil.Duration{Duration: dc.RotationIvl}
config.DNS.QueryLogMemSize = dc.MemSize
</s> add </s> remove if len(msg.Question) >= 1 && msg.Question[0].Qtype == dns.TypeANY && s.conf.RefuseAny {
</s> add if q.Qtype == dns.TypeANY && s.conf.RefuseAny { </s> add if l.isIgnored(e.QHost) {
return nil, ts, nil
}
</s> add q := msg.Question[0]
host := strings.ToLower(strings.TrimSuffix(q.Name, ".")) </s> add config.QueryLog.Enabled = dc.Enabled
config.QueryLog.FileEnabled = dc.FileEnabled
config.QueryLog.Interval = timeutil.Duration{Duration: dc.RotationIvl}
config.QueryLog.MemSize = dc.MemSize
config.QueryLog.Ignored = dc.Ignored.Values()
sort.Strings(config.QueryLog.Ignored) | https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3 | internal/dnsforward/stats.go |
keep replace keep keep keep keep keep keep keep keep replace | <mask>
<mask> // testQueryLog is a simple querylog.QueryLog implementation for tests.
<mask> type testQueryLog struct {
<mask> // QueryLog is embedded here simply to make testQueryLog
<mask> // a querylog.QueryLog without actually implementing all methods.
<mask> querylog.QueryLog
<mask>
<mask> // testQueryLog is a simple querylog.QueryLog implementation for tests.
<mask> type testQueryLog struct {
<mask> // QueryLog is embedded here simply to make testQueryLog
<mask> // a querylog.QueryLog without actually implementing all methods.
</s> Pull request 1727: 4299-querylog-ignore
Merge in DNS/adguard-home from 4299-querylog-ignore to master
Squashed commit of the following:
commit 06f32fef860d63dc2af9aad8d4251918c5babd00
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 17:14:26 2023 +0300
add debug msg
commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:30:06 2023 +0300
add line break
commit a96fe712b6e5c6a190a92b2f83ed031a85658e58
Merge: d1035219 b8d55eaf
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:12:32 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit d1035219e15e5b5639b2fc39e0b17cfc05904722
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:11:03 2023 +0300
fix docs
commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 15:30:16 2023 +0300
fix issue link
commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 14:34:11 2023 +0300
all: add issues links
commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 13:11:58 2023 +0300
all: add log message
commit a40a0c87937abb778e4e632a5403543371b6d2e0
Merge: 87fd71ba b31bab59
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:16:08 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:13:44 2023 +0300
all: add todo
commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c
Author: Stanislav Chzhen <[email protected]>
Date: Mon Feb 6 13:27:24 2023 +0300
all: add changelog
commit 8d227b684794e306e314d8cb848fe354d4578607
Author: Stanislav Chzhen <[email protected]>
Date: Fri Feb 3 16:06:43 2023 +0300
all: querylog ignore </s> add // ShouldLog implements the [querylog.QueryLog] interface for *testQueryLog.
func (l *testQueryLog) ShouldLog(string, uint16, uint16) bool {
return true
}
</s> remove // Add implements the querylog.QueryLog interface for *testQueryLog.
</s> add // Add implements the [querylog.QueryLog] interface for *testQueryLog. </s> remove DNS dnsConfig `yaml:"dns"`
TLS tlsConfigSettings `yaml:"tls"`
</s> add DNS dnsConfig `yaml:"dns"`
TLS tlsConfigSettings `yaml:"tls"`
QueryLog queryLogConfig `yaml:"querylog"` </s> add // Ignored is the list of host names, which are should not be written
// to log.
Ignored *stringutil.Set </s> add QueryLog: queryLogConfig{
Enabled: true,
FileEnabled: true,
Interval: timeutil.Duration{Duration: 90 * timeutil.Day},
MemSize: 1000,
Ignored: []string{},
}, | https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3 | internal/dnsforward/stats_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> lastParams *querylog.AddParams
<mask> }
<mask>
<mask> // Add implements the querylog.QueryLog interface for *testQueryLog.
<mask> func (l *testQueryLog) Add(p *querylog.AddParams) {
<mask> l.lastParams = p
<mask> }
<mask>
<mask> // testStats is a simple stats.Stats implementation for tests.
</s> Pull request 1727: 4299-querylog-ignore
Merge in DNS/adguard-home from 4299-querylog-ignore to master
Squashed commit of the following:
commit 06f32fef860d63dc2af9aad8d4251918c5babd00
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 17:14:26 2023 +0300
add debug msg
commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:30:06 2023 +0300
add line break
commit a96fe712b6e5c6a190a92b2f83ed031a85658e58
Merge: d1035219 b8d55eaf
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:12:32 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit d1035219e15e5b5639b2fc39e0b17cfc05904722
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:11:03 2023 +0300
fix docs
commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 15:30:16 2023 +0300
fix issue link
commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 14:34:11 2023 +0300
all: add issues links
commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 13:11:58 2023 +0300
all: add log message
commit a40a0c87937abb778e4e632a5403543371b6d2e0
Merge: 87fd71ba b31bab59
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:16:08 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:13:44 2023 +0300
all: add todo
commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c
Author: Stanislav Chzhen <[email protected]>
Date: Mon Feb 6 13:27:24 2023 +0300
all: add changelog
commit 8d227b684794e306e314d8cb848fe354d4578607
Author: Stanislav Chzhen <[email protected]>
Date: Fri Feb 3 16:06:43 2023 +0300
all: querylog ignore </s> add // ShouldLog implements the [querylog.QueryLog] interface for *testQueryLog.
func (l *testQueryLog) ShouldLog(string, uint16, uint16) bool {
return true
}
</s> remove // a querylog.QueryLog without actually implementing all methods.
</s> add // a [querylog.QueryLog] without actually implementing all methods. </s> remove // testQueryLog is a simple querylog.QueryLog implementation for tests.
</s> add // testQueryLog is a simple [querylog.QueryLog] implementation for tests. </s> add // ShouldLog returns true if request for the host should be logged.
func (l *queryLog) ShouldLog(host string, _, _ uint16) bool {
return !l.isIgnored(host)
}
// isIgnored returns true if the host is in the Ignored list.
func (l *queryLog) isIgnored(host string) bool {
return l.conf.Ignored.Has(host)
} </s> add //
// TODO(s.chzhen): Add lowercased, non-FQDN version of the hostname from the
// question of the request. </s> add // Ignored is the list of host names, which are should not be written
// to log.
Ignored *stringutil.Set | https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3 | internal/dnsforward/stats_test.go |
keep keep add keep keep keep keep keep keep | <mask> l.lastParams = p
<mask> }
<mask>
<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.Interface
<mask>
</s> Pull request 1727: 4299-querylog-ignore
Merge in DNS/adguard-home from 4299-querylog-ignore to master
Squashed commit of the following:
commit 06f32fef860d63dc2af9aad8d4251918c5babd00
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 17:14:26 2023 +0300
add debug msg
commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:30:06 2023 +0300
add line break
commit a96fe712b6e5c6a190a92b2f83ed031a85658e58
Merge: d1035219 b8d55eaf
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:12:32 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit d1035219e15e5b5639b2fc39e0b17cfc05904722
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:11:03 2023 +0300
fix docs
commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 15:30:16 2023 +0300
fix issue link
commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 14:34:11 2023 +0300
all: add issues links
commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 13:11:58 2023 +0300
all: add log message
commit a40a0c87937abb778e4e632a5403543371b6d2e0
Merge: 87fd71ba b31bab59
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:16:08 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:13:44 2023 +0300
all: add todo
commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c
Author: Stanislav Chzhen <[email protected]>
Date: Mon Feb 6 13:27:24 2023 +0300
all: add changelog
commit 8d227b684794e306e314d8cb848fe354d4578607
Author: Stanislav Chzhen <[email protected]>
Date: Fri Feb 3 16:06:43 2023 +0300
all: querylog ignore </s> remove // a querylog.QueryLog without actually implementing all methods.
</s> add // a [querylog.QueryLog] without actually implementing all methods. </s> remove // testQueryLog is a simple querylog.QueryLog implementation for tests.
</s> add // testQueryLog is a simple [querylog.QueryLog] implementation for tests. </s> remove // Add implements the querylog.QueryLog interface for *testQueryLog.
</s> add // Add implements the [querylog.QueryLog] interface for *testQueryLog. </s> add // Ignored is the list of host names, which are should not be written
// to log.
Ignored *stringutil.Set </s> add // ShouldLog returns true if request for the host should be logged.
ShouldLog(host string, qType, qClass uint16) bool </s> remove DNS dnsConfig `yaml:"dns"`
TLS tlsConfigSettings `yaml:"tls"`
</s> add DNS dnsConfig `yaml:"dns"`
TLS tlsConfigSettings `yaml:"tls"`
QueryLog queryLogConfig `yaml:"querylog"` | https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3 | internal/dnsforward/stats_test.go |
keep keep add keep keep keep keep | <mask> "net/netip"
<mask> "os"
<mask> "path/filepath"
<mask> "sync"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghalg"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtls"
</s> Pull request 1727: 4299-querylog-ignore
Merge in DNS/adguard-home from 4299-querylog-ignore to master
Squashed commit of the following:
commit 06f32fef860d63dc2af9aad8d4251918c5babd00
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 17:14:26 2023 +0300
add debug msg
commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:30:06 2023 +0300
add line break
commit a96fe712b6e5c6a190a92b2f83ed031a85658e58
Merge: d1035219 b8d55eaf
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:12:32 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit d1035219e15e5b5639b2fc39e0b17cfc05904722
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 16:11:03 2023 +0300
fix docs
commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 15:30:16 2023 +0300
fix issue link
commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 14:34:11 2023 +0300
all: add issues links
commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 13:11:58 2023 +0300
all: add log message
commit a40a0c87937abb778e4e632a5403543371b6d2e0
Merge: 87fd71ba b31bab59
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:16:08 2023 +0300
Merge branch 'master' into 4299-querylog-ignore
commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7
Author: Stanislav Chzhen <[email protected]>
Date: Tue Feb 7 12:13:44 2023 +0300
all: add todo
commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c
Author: Stanislav Chzhen <[email protected]>
Date: Mon Feb 6 13:27:24 2023 +0300
all: add changelog
commit 8d227b684794e306e314d8cb848fe354d4578607
Author: Stanislav Chzhen <[email protected]>
Date: Fri Feb 3 16:06:43 2023 +0300
all: querylog ignore </s> add "strings" </s> add if l.isIgnored(e.QHost) {
return nil, ts, nil
}
</s> remove BindHosts: []netip.Addr{netip.IPv4Unspecified()},
Port: defaultPortDNS,
StatsInterval: 1,
QueryLogEnabled: true,
QueryLogFileEnabled: true,
QueryLogInterval: timeutil.Duration{Duration: 90 * timeutil.Day},
QueryLogMemSize: 1000,
</s> add BindHosts: []netip.Addr{netip.IPv4Unspecified()},
Port: defaultPortDNS,
StatsInterval: 1, </s> add q := msg.Question[0]
host := strings.ToLower(strings.TrimSuffix(q.Name, ".")) </s> remove if len(msg.Question) >= 1 && msg.Question[0].Qtype == dns.TypeANY && s.conf.RefuseAny {
</s> add if q.Qtype == dns.TypeANY && s.conf.RefuseAny { </s> remove if shouldLog && s.queryLog != nil {
</s> add if shouldLog &&
s.queryLog != nil &&
s.queryLog.ShouldLog(host, q.Qtype, q.Qclass) { | https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3 | internal/home/config.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.