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> os.Exit(0) <mask> } <mask> } <mask> <mask> config.clients.Init(config.Clients) <mask> config.Clients = nil <mask> <mask> if (runtime.GOOS == "linux" || runtime.GOOS == "darwin") && <mask> config.RlimitNoFile != 0 { <mask> setRlimit(config.RlimitNoFile) </s> * dhcp,clients: DHCP server module is passed to Clients module during initialization. </s> add if config.dhcpServer != nil { c := dhcpd.ServerConfig{} config.dhcpServer.WriteDiskConfig(&c) config.DHCP = c } </s> remove leases := config.dhcpServer.Leases() </s> add if clients.dhcpServer == nil { return } leases := clients.dhcpServer.Leases() </s> remove macFound := config.dhcpServer.FindMACbyIP(ipAddr) </s> add if clients.dhcpServer == nil { return Client{}, false } macFound := clients.dhcpServer.FindMACbyIP(ipAddr) </s> remove ok, _ := config.clients.AddHost(l.IP.String(), l.Hostname, ClientSourceDHCP) </s> add ok, _ := clients.AddHost(l.IP.String(), l.Hostname, ClientSourceDHCP) </s> remove func (clients *clientsContainer) Init(objects []clientObject) { </s> add func (clients *clientsContainer) Init(objects []clientObject, dhcpServer *dhcpd.Server) { </s> add // Create - create object func Create(config ServerConfig) *Server { s := Server{} s.conf = config return &s }
https://github.com/AdguardTeam/AdGuardHome/commit/149fcc0f2dccbe0018122f1efa5b8977cf6ff273
home/home.go
keep keep keep add keep keep keep keep keep
<mask> "example_regex_meaning": "block access to the domains matching the specified regular expression", <mask> "example_upstream_regular": "regular DNS (over UDP)", <mask> "example_upstream_dot": "encrypted <0>DNS-over-TLS</0>", <mask> "example_upstream_doh": "encrypted <0>DNS-over-HTTPS</0>", <mask> "example_upstream_sdns": "you can use <0>DNS Stamps</0> for <1>DNSCrypt</1> or <2>DNS-over-HTTPS</2> resolvers", <mask> "example_upstream_tcp": "regular DNS (over TCP)", <mask> "all_lists_up_to_date_toast": "All lists are already up-to-date", <mask> "updated_upstream_dns_toast": "Updated the upstream DNS servers", <mask> "dns_test_ok_toast": "Specified DNS servers are working correctly", </s> + client: Add experimental DNS-over-QUIC support </s> add "encryption_doq": "DNS-over-QUIC port", "encryption_doq_desc": "If this port is configured, AdGuard Home will run a DNS-over-QUIC server on this port. It's experimental and may not be reliable at the moment. The only DNS provider that supports it now is AdGuard DNS", </s> add <<<<<<< Updated upstream </s> add /** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS; </s> add export const DNS_OVER_QUIC_PORT = 784; </s> remove color: var(--red); </s> add color: #cd201f; </s> add port_dns_over_quic,
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/__locales/en.json
keep keep keep add keep keep keep keep keep
<mask> "encryption_https": "HTTPS port", <mask> "encryption_https_desc": "If HTTPS port is configured, AdGuard Home admin interface will be accessible via HTTPS, and it will also provide DNS-over-HTTPS on '/dns-query' location.", <mask> "encryption_dot": "DNS-over-TLS port", <mask> "encryption_dot_desc": "If this port is configured, AdGuard Home will run a DNS-over-TLS server on this port.", <mask> "encryption_certificates": "Certificates", <mask> "encryption_certificates_desc": "In order to use encryption, you need to provide a valid SSL certificates chain for your domain. You can get a free certificate on <0>{{link}}</0> or you can buy it from one of the trusted Certificate Authorities.", <mask> "encryption_certificates_input": "Copy/paste your PEM-encoded certificates here.", <mask> "encryption_status": "Status", <mask> "encryption_expire": "Expires", </s> + client: Add experimental DNS-over-QUIC support </s> add <<<<<<< Updated upstream </s> add "example_upstream_doq": "encrypted <0>DNS-over-QUIC</0>", </s> remove import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; </s> add import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators'; </s> remove import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; </s> add import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants'; </s> add /** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS; </s> add export const DNS_OVER_QUIC_PORT = 784;
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/__locales/en.json
keep keep keep add keep keep keep keep
<mask> "setup_config_to_enable_dhcp_server": "Setup config to enable DHCP server", <mask> "original_response": "Original response", <mask> "click_to_view_queries": "Click to view queries", <mask> "port_53_faq_link": "Port 53 is often occupied by \"DNSStubListener\" or \"systemd-resolved\" services. Please read <0>this instruction</0> on how to resolve this.", <mask> "adg_will_drop_dns_queries": "AdGuard Home will be dropping all DNS queries from this client." <mask> ======= <mask> "adg_will_drop_dns_queries": "AdGuard Home will be dropping all DNS queries from this client.", <mask> "experimental": "Experimental" </s> + client: Add experimental DNS-over-QUIC support </s> add "encryption_doq": "DNS-over-QUIC port", "encryption_doq_desc": "If this port is configured, AdGuard Home will run a DNS-over-QUIC server on this port. It's experimental and may not be reliable at the moment. The only DNS provider that supports it now is AdGuard DNS", </s> add "example_upstream_doq": "encrypted <0>DNS-over-QUIC</0>", </s> remove import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; </s> add import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators'; </s> remove import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; </s> add import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants'; </s> add /** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS; </s> add export const DNS_OVER_QUIC_PORT = 784;
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/__locales/en.json
keep keep keep add keep keep keep keep keep keep
<mask> values.certificate_chain = btoa(values.certificate_chain); <mask> values.private_key = btoa(values.private_key); <mask> values.port_https = values.port_https || 0; <mask> values.port_dns_over_tls = values.port_dns_over_tls || 0; <mask> <mask> const response = await apiClient.setTlsConfig(values); <mask> response.certificate_chain = atob(response.certificate_chain); <mask> response.private_key = atob(response.private_key); <mask> dispatch(setTlsConfigSuccess(response)); <mask> dispatch(addSuccessToast('encryption_config_saved')); </s> + client: Add experimental DNS-over-QUIC support </s> add values.port_dns_over_quic = values.port_dns_over_quic || 0; </s> add export const DNS_OVER_QUIC_PORT = 784; </s> add /** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS; </s> remove import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; </s> add import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants'; </s> add port_dns_over_quic, </s> remove color: var(--red); </s> add color: #cd201f;
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/actions/encryption.js
keep add keep keep keep keep keep keep
<mask> values.port_https = values.port_https || 0; <mask> values.port_dns_over_tls = values.port_dns_over_tls || 0; <mask> <mask> const response = await apiClient.validateTlsConfig(values); <mask> response.certificate_chain = atob(response.certificate_chain); <mask> response.private_key = atob(response.private_key); <mask> dispatch(validateTlsConfigSuccess(response)); <mask> } catch (error) { </s> + client: Add experimental DNS-over-QUIC support </s> add values.port_dns_over_quic = values.port_dns_over_quic || 0; </s> remove import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; </s> add import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants'; </s> add /** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS; </s> add export const DNS_OVER_QUIC_PORT = 784; </s> add port_dns_over_quic, </s> remove color: var(--red); </s> add color: #cd201f;
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/actions/encryption.js
keep keep keep keep replace keep keep keep replace keep keep
<mask> renderCheckboxField, <mask> renderRadioField, <mask> toNumber, <mask> } from '../../../helpers/form'; <mask> import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; <mask> import i18n from '../../../i18n'; <mask> import KeyStatus from './KeyStatus'; <mask> import CertificateStatus from './CertificateStatus'; <mask> import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; <mask> <mask> const validate = (values) => { </s> + client: Add experimental DNS-over-QUIC support </s> add <<<<<<< Updated upstream </s> remove color: var(--red); </s> add color: #cd201f; </s> add /** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS; </s> add values.port_dns_over_quic = values.port_dns_over_quic || 0; </s> add export const DNS_OVER_QUIC_PORT = 784;
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Encryption/Form.js
keep add keep keep keep keep
<mask> port_https: STANDARD_HTTPS_PORT, <mask> port_dns_over_tls: DNS_OVER_TLS_PORT, <mask> server_name: '', <mask> force_https: false, <mask> enabled: false, <mask> }; </s> + client: Add experimental DNS-over-QUIC support </s> remove import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; </s> add import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants'; </s> add /** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS; </s> remove import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; </s> add import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators'; </s> add export const DNS_OVER_QUIC_PORT = 784; </s> remove color: var(--red); </s> add color: #cd201f; </s> add port_dns_over_quic,
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Encryption/Form.js
keep keep add keep keep keep keep keep keep
<mask> force_https, <mask> port_https, <mask> port_dns_over_tls, <mask> certificate_chain, <mask> private_key, <mask> certificate_path, <mask> private_key_path, <mask> } = encryption; <mask> </s> + client: Add experimental DNS-over-QUIC support </s> add port_dns_over_quic, </s> remove import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; </s> add import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants'; </s> remove color: var(--red); </s> add color: #cd201f; </s> add values.port_dns_over_quic = values.port_dns_over_quic || 0; </s> remove import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; </s> add import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators'; </s> add values.port_dns_over_quic = values.port_dns_over_quic || 0;
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Encryption/index.js
keep keep keep add keep keep keep keep keep keep
<mask> server_name, <mask> force_https, <mask> port_https, <mask> port_dns_over_tls, <mask> certificate_chain, <mask> private_key, <mask> certificate_path, <mask> private_key_path, <mask> }); <mask> </s> + client: Add experimental DNS-over-QUIC support </s> add port_dns_over_quic, </s> add /** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS; </s> add export const DNS_OVER_QUIC_PORT = 784; </s> remove color: var(--red); </s> add color: #cd201f; </s> add port_dns_over_quic: DNS_OVER_QUIC_PORT, </s> remove import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; </s> add import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants';
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Encryption/index.js
keep keep keep keep replace keep keep keep keep keep
<mask> font-size: 11px; <mask> } <mask> <mask> .form__message--error { <mask> color: var(--red); <mask> } <mask> <mask> .form__message--left-pad { <mask> padding-left: 0.85rem; <mask> } </s> + client: Add experimental DNS-over-QUIC support </s> remove import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; </s> add import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators'; </s> remove import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; </s> add import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants'; </s> add values.port_dns_over_quic = values.port_dns_over_quic || 0; </s> add port_dns_over_quic, </s> add /** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS; </s> add export const DNS_OVER_QUIC_PORT = 784;
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Settings.css
keep add keep keep keep keep
<mask> export const STANDARD_HTTPS_PORT = 443; <mask> export const DNS_OVER_TLS_PORT = 853; <mask> export const MAX_PORT = 65535; <mask> <mask> export const EMPTY_DATE = '0001-01-01T00:00:00Z'; <mask> </s> + client: Add experimental DNS-over-QUIC support </s> add /** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS; </s> remove import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; </s> add import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants'; </s> add values.port_dns_over_quic = values.port_dns_over_quic || 0; </s> add values.port_dns_over_quic = values.port_dns_over_quic || 0; </s> remove import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; </s> add import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators'; </s> add port_dns_over_quic,
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/helpers/constants.js
keep add keep keep keep keep keep keep
<mask> }; <mask> <mask> /** <mask> * @param value {number} <mask> * @returns {undefined|string} <mask> */ <mask> export const validateIsSafePort = (value) => { <mask> if (UNSAFE_PORTS.includes(value)) { </s> + client: Add experimental DNS-over-QUIC support </s> remove import { DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT } from '../../../helpers/constants'; </s> add import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants'; </s> add export const DNS_OVER_QUIC_PORT = 784; </s> add port_dns_over_quic: DNS_OVER_QUIC_PORT, </s> add values.port_dns_over_quic = values.port_dns_over_quic || 0; </s> remove color: var(--red); </s> add color: #cd201f; </s> remove import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; </s> add import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators';
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/helpers/validators.js
keep keep keep replace keep replace keep keep keep
<mask> s.processInitial, <mask> s.processDDRQuery, <mask> s.processDetermineLocal, <mask> s.processInternalHosts, <mask> s.processRestrictLocal, <mask> s.processInternalIPAddrs, <mask> s.processFilteringBeforeRequest, <mask> s.processLocalPTR, <mask> s.processUpstream, </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "%s", addr) </s> remove lowhost := strings.ToLower(l.Hostname) </s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) ip := netutil.CloneIP(l.IP) </s> remove ipToHost.Set(l.IP, lowhost) ip := make(net.IP, 4) copy(ip, l.IP.To4()) </s> add ipToHost.Set(ip, lowhost) </s> remove // processInternalHosts respond to A requests if the target hostname is known to </s> add // processDHCPHosts respond to A requests if the target hostname is known to </s> remove func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPHosts(dctx *dnsContext) (rc resultCode) {
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
keep replace keep replace replace replace replace keep keep
<mask> <mask> lowhost := strings.ToLower(l.Hostname) <mask> <mask> ipToHost.Set(l.IP, lowhost) <mask> <mask> ip := make(net.IP, 4) <mask> copy(ip, l.IP.To4()) <mask> hostToIP[lowhost] = ip <mask> } </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> add dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> remove examplelan = "example.lan" </s> add examplelan = "example." + defaultLocalDomainSuffix </s> remove res := s.processInternalHosts(dctx) </s> add res := s.processDHCPHosts(dctx) </s> remove // domainNameToSuffix converts a domain name into a local domain suffix. func domainNameToSuffix(tld string) (suffix string) { l := len(tld) + 2 b := make([]byte, l) b[0] = '.' copy(b[1:], tld) b[l-1] = '.' return string(b) } </s> add </s> remove func TestServer_ProcessInternalHosts_localRestriction(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) {
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep replace keep keep keep keep
<mask> <mask> return ip, true <mask> } <mask> <mask> // processInternalHosts respond to A requests if the target hostname is known to <mask> // the server. <mask> // <mask> // TODO(a.garipov): Adapt to AAAA as well. <mask> func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { <mask> if !s.dhcpServer.Enabled() { <mask> return resultCodeSuccess <mask> } <mask> </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPAddrs(ctx *dnsContext) (rc resultCode) { </s> remove host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) { </s> remove reqHost := strings.ToLower(q.Name) </s> add reqHost := strings.ToLower(q.Name[:len(q.Name)-1]) </s> remove ip, ok := s.hostToIP(host) </s> add ip, ok := s.hostToIP(reqHost) </s> remove // don't need to be inaccessible externally. </s> add // don't need to be accessible externally.
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
keep replace keep keep replace replace
<mask> <mask> reqHost := strings.ToLower(q.Name) <mask> // TODO(a.garipov): Move everything related to DHCP local domain to the DHCP <mask> // server. <mask> host := strings.TrimSuffix(reqHost, s.localDomainSuffix) <mask> if host == reqHost { </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPHosts(dctx *dnsContext) (rc resultCode) { </s> remove func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPAddrs(ctx *dnsContext) (rc resultCode) { </s> remove // processInternalHosts respond to A requests if the target hostname is known to </s> add // processDHCPHosts respond to A requests if the target hostname is known to </s> remove // don't need to be inaccessible externally. </s> add // don't need to be accessible externally. </s> remove func TestServer_ProcessInternalHosts_localRestriction(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) {
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> // Do not even put into query log. <mask> return resultCodeFinish <mask> } <mask> <mask> ip, ok := s.hostToIP(host) <mask> if !ok { <mask> // TODO(e.burkov): Inspect special cases when user want to apply some <mask> // rules handled by other processors to the hosts with TLD. <mask> d.Res = s.genNXDomain(req) <mask> </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPAddrs(ctx *dnsContext) (rc resultCode) { </s> remove // processInternalHosts respond to A requests if the target hostname is known to </s> add // processDHCPHosts respond to A requests if the target hostname is known to </s> remove const defaultLocalDomainSuffix = ".lan." </s> add const defaultLocalDomainSuffix = "lan" </s> remove // don't need to be inaccessible externally. </s> add // don't need to be accessible externally. </s> remove func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPHosts(dctx *dnsContext) (rc resultCode) { </s> remove host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) {
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> // Restrict an access to local addresses for external clients. We also <mask> // assume that all the DHCP leases we give are locally-served or at least <mask> // don't need to be inaccessible externally. <mask> if !s.privateNets.Contains(ip) { <mask> log.Debug("dns: addr %s is not from locally-served network", ip) <mask> <mask> return resultCodeSuccess <mask> } </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove reqHost := strings.ToLower(q.Name) </s> add reqHost := strings.ToLower(q.Name[:len(q.Name)-1]) </s> remove host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) { </s> remove func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPAddrs(ctx *dnsContext) (rc resultCode) { </s> remove const defaultLocalDomainSuffix = ".lan." </s> add const defaultLocalDomainSuffix = "lan" </s> remove func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPHosts(dctx *dnsContext) (rc resultCode) { </s> remove // processInternalHosts respond to A requests if the target hostname is known to </s> add // processDHCPHosts respond to A requests if the target hostname is known to
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> // Respond to PTR requests if the target IP is leased by our DHCP server and the <mask> // requestor is inside the local network. <mask> func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) { <mask> d := ctx.proxyCtx <mask> if d.Res != nil { <mask> return resultCodeSuccess <mask> } <mask> </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPHosts(dctx *dnsContext) (rc resultCode) { </s> remove // processInternalHosts respond to A requests if the target hostname is known to </s> add // processDHCPHosts respond to A requests if the target hostname is known to </s> remove reqHost := strings.ToLower(q.Name) </s> add reqHost := strings.ToLower(q.Name[:len(q.Name)-1]) </s> remove host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) { </s> remove // don't need to be inaccessible externally. </s> add // don't need to be accessible externally. </s> remove ip, ok := s.hostToIP(host) </s> add ip, ok := s.hostToIP(reqHost)
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> }) <mask> } <mask> } <mask> <mask> func TestServer_ProcessInternalHosts_localRestriction(t *testing.T) { <mask> knownIP := net.IP{1, 2, 3, 4} <mask> <mask> testCases := []struct { <mask> name string <mask> host string </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove examplelan = "example.lan" </s> add examplelan = "example." + defaultLocalDomainSuffix </s> remove func TestServer_ProcessInternalHosts(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts(t *testing.T) { </s> remove // domainNameToSuffix converts a domain name into a local domain suffix. func domainNameToSuffix(tld string) (suffix string) { l := len(tld) + 2 b := make([]byte, l) b[0] = '.' copy(b[1:], tld) b[l-1] = '.' return string(b) } </s> add </s> remove host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) { </s> remove t.Run(tc.name, func(t *testing.T) { s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example": knownIP, }, } </s> add s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example." + tc.suffix: knownIP, }, } </s> remove reqHost := strings.ToLower(q.Name) </s> add reqHost := strings.ToLower(q.Name[:len(q.Name)-1])
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> s := &Server{ <mask> dhcpServer: &testDHCP{}, <mask> localDomainSuffix: defaultLocalDomainSuffix, <mask> tableHostToIP: hostToIPTable{ <mask> "example": knownIP, <mask> }, <mask> } <mask> <mask> req := &dns.Msg{ <mask> MsgHdr: dns.MsgHdr{ </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove t.Run(tc.name, func(t *testing.T) { s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example": knownIP, }, } </s> add s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example." + tc.suffix: knownIP, }, } </s> remove req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, } </s> add req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, } </s> remove dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> add dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> remove res := s.processInternalHosts(dctx) </s> add res := s.processDHCPHosts(dctx) </s> remove res := s.processInternalHosts(dctx) </s> add t.Run(tc.name, func(t *testing.T) { res := s.processDHCPHosts(dctx) </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "%s", addr)
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> isLocalClient: tc.isLocalCli, <mask> } <mask> <mask> res := s.processInternalHosts(dctx) <mask> require.Equal(t, tc.wantRes, res) <mask> pctx := dctx.proxyCtx <mask> if tc.wantRes == resultCodeFinish { <mask> require.NotNil(t, pctx.Res) <mask> </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove res := s.processInternalHosts(dctx) </s> add t.Run(tc.name, func(t *testing.T) { res := s.processDHCPHosts(dctx) </s> remove dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> add dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> remove host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) { </s> remove t.Run(tc.name, func(t *testing.T) { s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example": knownIP, }, } </s> add s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example." + tc.suffix: knownIP, }, } </s> remove reqHost := strings.ToLower(q.Name) </s> add reqHost := strings.ToLower(q.Name[:len(q.Name)-1]) </s> remove req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, } </s> add req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, }
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
keep keep keep keep replace keep keep keep keep keep keep keep keep replace keep keep keep keep
<mask> }) <mask> } <mask> } <mask> <mask> func TestServer_ProcessInternalHosts(t *testing.T) { <mask> const ( <mask> examplecom = "example.com" <mask> examplelan = "example.lan" <mask> ) <mask> <mask> func TestServer_ProcessInternalHosts(t *testing.T) { <mask> const ( <mask> examplecom = "example.com" <mask> examplelan = "example.lan" <mask> ) <mask> <mask> knownIP := net.IP{1, 2, 3, 4} <mask> testCases := []struct { </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove func TestServer_ProcessInternalHosts_localRestriction(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) { </s> add const localDomain = "lan" </s> remove // domainNameToSuffix converts a domain name into a local domain suffix. func domainNameToSuffix(tld string) (suffix string) { l := len(tld) + 2 b := make([]byte, l) b[0] = '.' copy(b[1:], tld) b[l-1] = '.' return string(b) } </s> add </s> remove localDomainSuffix = domainNameToSuffix(p.LocalDomain) </s> add localDomainSuffix = p.LocalDomain </s> remove t.Run(tc.name, func(t *testing.T) { s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example": knownIP, }, } </s> add s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example." + tc.suffix: knownIP, }, }
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> qtyp: dns.TypeAAAA, <mask> }, { <mask> name: "success_custom_suffix", <mask> host: "example.custom", <mask> suffix: ".custom.", <mask> wantIP: knownIP, <mask> wantRes: resultCodeSuccess, <mask> qtyp: dns.TypeA, <mask> }} <mask> </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove t.Run(tc.name, func(t *testing.T) { s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example": knownIP, }, } </s> add s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example." + tc.suffix: knownIP, }, } </s> remove "example": knownIP, </s> add "example." + defaultLocalDomainSuffix: knownIP, </s> remove req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, } </s> add req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, } </s> remove res := s.processInternalHosts(dctx) </s> add t.Run(tc.name, func(t *testing.T) { res := s.processDHCPHosts(dctx) </s> remove dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> add dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> remove res := s.processInternalHosts(dctx) </s> add res := s.processDHCPHosts(dctx)
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
keep keep replace replace replace replace replace replace replace replace keep replace replace replace replace replace replace replace replace replace replace keep
<mask> <mask> for _, tc := range testCases { <mask> t.Run(tc.name, func(t *testing.T) { <mask> s := &Server{ <mask> dhcpServer: &testDHCP{}, <mask> localDomainSuffix: tc.suffix, <mask> tableHostToIP: hostToIPTable{ <mask> "example": knownIP, <mask> }, <mask> } <mask> <mask> req := &dns.Msg{ <mask> MsgHdr: dns.MsgHdr{ <mask> Id: 1234, <mask> }, <mask> Question: []dns.Question{{ <mask> Name: dns.Fqdn(tc.host), <mask> Qtype: tc.qtyp, <mask> Qclass: dns.ClassINET, <mask> }}, <mask> } <mask> </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove "example": knownIP, </s> add "example." + defaultLocalDomainSuffix: knownIP, </s> remove dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> add dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> remove res := s.processInternalHosts(dctx) </s> add t.Run(tc.name, func(t *testing.T) { res := s.processDHCPHosts(dctx) </s> remove func TestServer_ProcessInternalHosts_localRestriction(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) { </s> remove res := s.processInternalHosts(dctx) </s> add res := s.processDHCPHosts(dctx)
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
keep keep replace replace replace replace replace replace keep replace keep
<mask> } <mask> <mask> dctx := &dnsContext{ <mask> proxyCtx: &proxy.DNSContext{ <mask> Req: req, <mask> }, <mask> isLocalClient: true, <mask> } <mask> <mask> res := s.processInternalHosts(dctx) <mask> pctx := dctx.proxyCtx </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, } </s> add req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, } </s> remove res := s.processInternalHosts(dctx) </s> add res := s.processDHCPHosts(dctx) </s> remove t.Run(tc.name, func(t *testing.T) { s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example": knownIP, }, } </s> add s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example." + tc.suffix: knownIP, }, } </s> remove host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) { </s> remove "example": knownIP, </s> add "example." + defaultLocalDomainSuffix: knownIP,
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> // defaultLocalDomainSuffix is the default suffix used to detect internal hosts <mask> // when no suffix is provided. <mask> // <mask> // See the documentation for Server.localDomainSuffix. <mask> const defaultLocalDomainSuffix = ".lan." <mask> <mask> // DNSCreateParams are parameters to create a new server. <mask> type DNSCreateParams struct { <mask> DNSFilter *filtering.DNSFilter <mask> Stats stats.Stats </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove // processInternalHosts respond to A requests if the target hostname is known to </s> add // processDHCPHosts respond to A requests if the target hostname is known to </s> remove // don't need to be inaccessible externally. </s> add // don't need to be accessible externally. </s> remove // domainNameToSuffix converts a domain name into a local domain suffix. func domainNameToSuffix(tld string) (suffix string) { l := len(tld) + 2 b := make([]byte, l) b[0] = '.' copy(b[1:], tld) b[l-1] = '.' return string(b) } </s> add </s> remove func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPHosts(dctx *dnsContext) (rc resultCode) { </s> remove ip, ok := s.hostToIP(host) </s> add ip, ok := s.hostToIP(reqHost) </s> remove func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPAddrs(ctx *dnsContext) (rc resultCode) {
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> Anonymizer *aghnet.IPMut <mask> LocalDomain string <mask> } <mask> <mask> // domainNameToSuffix converts a domain name into a local domain suffix. <mask> func domainNameToSuffix(tld string) (suffix string) { <mask> l := len(tld) + 2 <mask> b := make([]byte, l) <mask> b[0] = '.' <mask> copy(b[1:], tld) <mask> b[l-1] = '.' <mask> <mask> return string(b) <mask> } <mask> <mask> const ( <mask> // recursionTTL is the time recursive request is cached for. <mask> recursionTTL = 1 * time.Second <mask> // cachedRecurrentReqNum is the maximum number of cached recurrent <mask> // requests. </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove const defaultLocalDomainSuffix = ".lan." </s> add const defaultLocalDomainSuffix = "lan" </s> remove examplelan = "example.lan" </s> add examplelan = "example." + defaultLocalDomainSuffix </s> remove func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPAddrs(ctx *dnsContext) (rc resultCode) { </s> remove host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) { </s> remove reqHost := strings.ToLower(q.Name) </s> add reqHost := strings.ToLower(q.Name[:len(q.Name)-1]) </s> remove // processInternalHosts respond to A requests if the target hostname is known to </s> add // processDHCPHosts respond to A requests if the target hostname is known to
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward.go
keep keep keep keep replace keep keep keep keep keep
<mask> if err != nil { <mask> return nil, fmt.Errorf("local domain: %w", err) <mask> } <mask> <mask> localDomainSuffix = domainNameToSuffix(p.LocalDomain) <mask> } <mask> <mask> if p.Anonymizer == nil { <mask> p.Anonymizer = aghnet.NewIPMut(nil) <mask> } </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPAddrs(ctx *dnsContext) (rc resultCode) { </s> remove reqHost := strings.ToLower(q.Name) </s> add reqHost := strings.ToLower(q.Name[:len(q.Name)-1]) </s> remove func TestServer_ProcessInternalHosts(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts(t *testing.T) { </s> remove host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) { </s> add LocalDomain: localDomain, </s> remove res := s.processInternalHosts(dctx) </s> add res := s.processDHCPHosts(dctx)
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward.go
keep add keep keep keep keep
<mask> <mask> func TestPTRResponseFromDHCPLeases(t *testing.T) { <mask> s, err := NewServer(DNSCreateParams{ <mask> DNSFilter: filtering.New(&filtering.Config{}, nil), <mask> DHCPServer: &testDHCP{}, <mask> PrivateNets: netutil.SubnetSetFunc(netutil.IsLocallyServed), </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> add LocalDomain: localDomain, </s> remove func TestServer_ProcessInternalHosts_localRestriction(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) { </s> remove t.Run(tc.name, func(t *testing.T) { s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example": knownIP, }, } </s> add s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example." + tc.suffix: knownIP, }, } </s> remove func TestServer_ProcessInternalHosts(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts(t *testing.T) { </s> remove examplelan = "example.lan" </s> add examplelan = "example." + defaultLocalDomainSuffix </s> remove assert.Equal(t, "myhost.", ptr.Ptr) </s> add assert.Equal(t, dns.Fqdn("myhost."+localDomain), ptr.Ptr)
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward_test.go
keep keep keep add keep keep keep keep keep
<mask> s, err := NewServer(DNSCreateParams{ <mask> DNSFilter: filtering.New(&filtering.Config{}, nil), <mask> DHCPServer: &testDHCP{}, <mask> PrivateNets: netutil.SubnetSetFunc(netutil.IsLocallyServed), <mask> }) <mask> require.NoError(t, err) <mask> <mask> s.conf.UDPListenAddrs = []*net.UDPAddr{{}} <mask> s.conf.TCPListenAddrs = []*net.TCPAddr{{}} </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> add const localDomain = "lan" </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "%s", addr) </s> remove localDomainSuffix = domainNameToSuffix(p.LocalDomain) </s> add localDomainSuffix = p.LocalDomain </s> remove func TestServer_ProcessInternalHosts(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts(t *testing.T) { </s> remove examplelan = "example.lan" </s> add examplelan = "example." + defaultLocalDomainSuffix </s> remove func TestServer_ProcessInternalHosts_localRestriction(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) {
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> addr := s.dnsProxy.Addr(proxy.ProtoUDP) <mask> req := createTestMessageWithType("34.12.168.192.in-addr.arpa.", dns.TypePTR) <mask> <mask> resp, err := dns.Exchange(req, addr.String()) <mask> require.NoError(t, err) <mask> <mask> require.Len(t, resp.Answer, 1) <mask> <mask> assert.Equal(t, dns.TypePTR, resp.Answer[0].Header().Rrtype) <mask> assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name) </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove assert.Equal(t, "myhost.", ptr.Ptr) </s> add assert.Equal(t, dns.Fqdn("myhost."+localDomain), ptr.Ptr) </s> add LocalDomain: localDomain, </s> remove res := s.processInternalHosts(dctx) </s> add t.Run(tc.name, func(t *testing.T) { res := s.processDHCPHosts(dctx) </s> remove dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> add dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> remove "example": knownIP, </s> add "example." + defaultLocalDomainSuffix: knownIP, </s> remove req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, } </s> add req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, }
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> assert.Equal(t, "34.12.168.192.in-addr.arpa.", resp.Answer[0].Header().Name) <mask> <mask> ptr, ok := resp.Answer[0].(*dns.PTR) <mask> require.True(t, ok) <mask> assert.Equal(t, "myhost.", ptr.Ptr) <mask> } <mask> <mask> func TestPTRResponseFromHosts(t *testing.T) { <mask> // Prepare test hosts file. <mask> </s> Pull request: 4699 dhcp ptr Merge in DNS/adguard-home from 4699-dhcp-ptr to master Closes #4699. Squashed commit of the following: commit 0a8e2b3e22b7fad28a53db65031cc39d8755ecf4 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:40:53 2022 +0300 dnsforward: imp naming again commit 0b0884a8305f18f7f69560b86be8837933e220e9 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 18:26:58 2022 +0300 dnsforward: imp naming commit e193f53d9a1dd76d41396c06e2ec5a1e7d176557 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:26:00 2022 +0300 all: imp chlog commit 8ac9f84f086d9cb0b0f9da72bfc51f9b70a3dab7 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:18:48 2022 +0300 all: log changes commit 7cdc175d02b6eacfcb6ba62a5424d11e2561a879 Author: Eugene Burkov <[email protected]> Date: Tue Jun 28 17:03:52 2022 +0300 dnsforward: add tld to dhcp leased hostnames </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "%s", addr) </s> remove res := s.processInternalHosts(dctx) </s> add t.Run(tc.name, func(t *testing.T) { res := s.processDHCPHosts(dctx) </s> remove ip, ok := s.hostToIP(host) </s> add ip, ok := s.hostToIP(reqHost) </s> remove func TestServer_ProcessInternalHosts_localRestriction(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) { </s> remove dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> add dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> remove func TestServer_ProcessInternalHosts(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts(t *testing.T) {
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward_test.go
keep keep add keep keep keep keep keep keep
<mask> <mask> import { LANGUAGES, BASE_LOCALE } from './helpers/twosky'; <mask> <mask> import be from './__locales/be.json'; <mask> import bg from './__locales/bg.json'; <mask> import cs from './__locales/cs.json'; <mask> import da from './__locales/da.json'; <mask> import de from './__locales/de.json'; <mask> import en from './__locales/en.json'; </s> Pull request: add-ar-i18n Merge in DNS/adguard-home from add-ar-i18n to master Squashed commit of the following: commit 6ef7c70bceb6f6ebabd81011154022a75fc91bd3 Author: Ainar Garipov <[email protected]> Date: Wed Aug 10 20:55:39 2022 +0300 client: add ar locale </s> add "ar", </s> add ar: { translation: ar }, </s> remove func handleI18nCurrentLanguage(w http.ResponseWriter, r *http.Request) { </s> add func handleI18nCurrentLanguage(w http.ResponseWriter, _ *http.Request) {
https://github.com/AdguardTeam/AdGuardHome/commit/14fd995ae9a4a9f8e4a56f2d0a33aadc7bc42035
client/src/i18n.js
keep keep add keep keep keep keep keep keep
<mask> import { setHtmlLangAttr } from './helpers/helpers'; <mask> <mask> const resources = { <mask> be: { translation: be }, <mask> bg: { translation: bg }, <mask> cs: { translation: cs }, <mask> da: { translation: da }, <mask> de: { translation: de }, <mask> en: { translation: en }, </s> Pull request: add-ar-i18n Merge in DNS/adguard-home from add-ar-i18n to master Squashed commit of the following: commit 6ef7c70bceb6f6ebabd81011154022a75fc91bd3 Author: Ainar Garipov <[email protected]> Date: Wed Aug 10 20:55:39 2022 +0300 client: add ar locale </s> remove func handleI18nCurrentLanguage(w http.ResponseWriter, r *http.Request) { </s> add func handleI18nCurrentLanguage(w http.ResponseWriter, _ *http.Request) { </s> add import ar from './__locales/ar.json'; </s> add "ar",
https://github.com/AdguardTeam/AdGuardHome/commit/14fd995ae9a4a9f8e4a56f2d0a33aadc7bc42035
client/src/i18n.js
keep keep add keep keep keep keep
<mask> <mask> // TODO(a.garipov): Get rid of a global or generate from .twosky.json. <mask> var allowedLanguages = stringutil.NewSet( <mask> "be", <mask> "bg", <mask> "cs", <mask> "da", </s> Pull request: add-ar-i18n Merge in DNS/adguard-home from add-ar-i18n to master Squashed commit of the following: commit 6ef7c70bceb6f6ebabd81011154022a75fc91bd3 Author: Ainar Garipov <[email protected]> Date: Wed Aug 10 20:55:39 2022 +0300 client: add ar locale </s> add import ar from './__locales/ar.json'; </s> add ar: { translation: ar }, </s> remove func handleI18nCurrentLanguage(w http.ResponseWriter, r *http.Request) { </s> add func handleI18nCurrentLanguage(w http.ResponseWriter, _ *http.Request) {
https://github.com/AdguardTeam/AdGuardHome/commit/14fd995ae9a4a9f8e4a56f2d0a33aadc7bc42035
internal/home/i18n.go
keep keep keep keep replace keep keep keep keep keep
<mask> "zh-hk", <mask> "zh-tw", <mask> ) <mask> <mask> func handleI18nCurrentLanguage(w http.ResponseWriter, r *http.Request) { <mask> w.Header().Set("Content-Type", "text/plain") <mask> log.Printf("config.Language is %s", config.Language) <mask> _, err := fmt.Fprintf(w, "%s\n", config.Language) <mask> if err != nil { <mask> msg := fmt.Sprintf("Unable to write response json: %s", err) </s> Pull request: add-ar-i18n Merge in DNS/adguard-home from add-ar-i18n to master Squashed commit of the following: commit 6ef7c70bceb6f6ebabd81011154022a75fc91bd3 Author: Ainar Garipov <[email protected]> Date: Wed Aug 10 20:55:39 2022 +0300 client: add ar locale </s> add ar: { translation: ar }, </s> add import ar from './__locales/ar.json'; </s> add "ar",
https://github.com/AdguardTeam/AdGuardHome/commit/14fd995ae9a4a9f8e4a56f2d0a33aadc7bc42035
internal/home/i18n.go
keep add keep keep keep keep keep
<mask> } <mask> <mask> // New creates properly initialized DNS Filter that is ready to be used <mask> func New(c *Config, blockFilters []Filter) *Dnsfilter { <mask> <mask> if c != nil { <mask> cacheConf := cache.Config{ </s> Merge: - blocked-services: settings were reset on restart Close #1624 Squashed commit of the following: commit eecc91ca1f9d062c27702a9c07da74da673bef05 Merge: ec53dbeb 26f78dcc Author: Simon Zolin <[email protected]> Date: Mon Apr 27 13:15:58 2020 +0300 Merge remote-tracking branch 'origin/master' into fix-blocked-svcs commit ec53dbebdc2fbd2ff94f939d2bd8fb07b9dd1bc8 Author: Simon Zolin <[email protected]> Date: Mon Apr 27 12:58:50 2020 +0300 minor commit 1e3c20ed02151965ebaca55ac4f25a951a772062 Author: Simon Zolin <[email protected]> Date: Mon Apr 27 12:53:37 2020 +0300 - blocked-services: settings were reset on restart broken by: 0789e4b20dea132f5d66ee18f7d1fbd05c10b014 * refactor: move blocked-services functions to dnsfilter </s> remove initBlockedServices() </s> add </s> add // 'clients' module uses 'dnsfilter' module's static data (dnsfilter.BlockedSvcKnown()), // so we have to initialize dnsfilter's static data first, // but also avoid relying on automatic Go init() function dnsfilter.InitModule()
https://github.com/AdguardTeam/AdGuardHome/commit/14ffd1a3f52049931b21abe4ebce5bd22ece715b
dnsfilter/dnsfilter.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> bsvcs = append(bsvcs, s) <mask> } <mask> d.BlockedServices = bsvcs <mask> <mask> initBlockedServices() <mask> <mask> if blockFilters != nil { <mask> err := d.initFiltering(nil, blockFilters) <mask> if err != nil { <mask> log.Error("Can't initialize filtering subsystem: %s", err) <mask> d.Close() </s> Merge: - blocked-services: settings were reset on restart Close #1624 Squashed commit of the following: commit eecc91ca1f9d062c27702a9c07da74da673bef05 Merge: ec53dbeb 26f78dcc Author: Simon Zolin <[email protected]> Date: Mon Apr 27 13:15:58 2020 +0300 Merge remote-tracking branch 'origin/master' into fix-blocked-svcs commit ec53dbebdc2fbd2ff94f939d2bd8fb07b9dd1bc8 Author: Simon Zolin <[email protected]> Date: Mon Apr 27 12:58:50 2020 +0300 minor commit 1e3c20ed02151965ebaca55ac4f25a951a772062 Author: Simon Zolin <[email protected]> Date: Mon Apr 27 12:53:37 2020 +0300 - blocked-services: settings were reset on restart broken by: 0789e4b20dea132f5d66ee18f7d1fbd05c10b014 * refactor: move blocked-services functions to dnsfilter </s> add // InitModule() - manually initialize blocked services map func InitModule() { initBlockedServices() } </s> add // 'clients' module uses 'dnsfilter' module's static data (dnsfilter.BlockedSvcKnown()), // so we have to initialize dnsfilter's static data first, // but also avoid relying on automatic Go init() function dnsfilter.InitModule()
https://github.com/AdguardTeam/AdGuardHome/commit/14ffd1a3f52049931b21abe4ebce5bd22ece715b
dnsfilter/dnsfilter.go
keep keep add keep keep keep keep
<mask> } <mask> } <mask> <mask> config.DHCP.WorkDir = Context.workDir <mask> config.DHCP.HTTPRegister = httpRegister <mask> config.DHCP.ConfigModified = onConfigModified <mask> Context.dhcpServer = dhcpd.Create(config.DHCP) </s> Merge: - blocked-services: settings were reset on restart Close #1624 Squashed commit of the following: commit eecc91ca1f9d062c27702a9c07da74da673bef05 Merge: ec53dbeb 26f78dcc Author: Simon Zolin <[email protected]> Date: Mon Apr 27 13:15:58 2020 +0300 Merge remote-tracking branch 'origin/master' into fix-blocked-svcs commit ec53dbebdc2fbd2ff94f939d2bd8fb07b9dd1bc8 Author: Simon Zolin <[email protected]> Date: Mon Apr 27 12:58:50 2020 +0300 minor commit 1e3c20ed02151965ebaca55ac4f25a951a772062 Author: Simon Zolin <[email protected]> Date: Mon Apr 27 12:53:37 2020 +0300 - blocked-services: settings were reset on restart broken by: 0789e4b20dea132f5d66ee18f7d1fbd05c10b014 * refactor: move blocked-services functions to dnsfilter </s> remove initBlockedServices() </s> add </s> add // InitModule() - manually initialize blocked services map func InitModule() { initBlockedServices() }
https://github.com/AdguardTeam/AdGuardHome/commit/14ffd1a3f52049931b21abe4ebce5bd22ece715b
home/home.go
keep add keep keep keep keep keep
<mask> var v interface{} <mask> v, ok = s.tableIPToHost.Get(ip) <mask> <mask> if host, ok = v.(string); !ok { <mask> log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) <mask> <mask> return "", false </s> Pull request #1238: dnsforward: fix panic Updates #3318. Squashed commit of the following: commit eebaa3ac3a6bfcb29e280006ead8ea9554b8a3bf Author: Ainar Garipov <[email protected]> Date: Tue Jul 6 14:59:00 2021 +0300 dnsforward: imp code commit 7591a3b183ab95f27f908267321518740cb7d4bb Author: Ainar Garipov <[email protected]> Date: Tue Jul 6 14:55:33 2021 +0300 dnsforward: fix panic </s> remove return host, ok </s> add return host, true </s> remove var typOK bool if host, typOK = v.(string); !typOK { </s> add if host, ok = v.(string); !ok {
https://github.com/AdguardTeam/AdGuardHome/commit/1571609e5975be22e31d3ef7336a4ac6b1f08880
internal/dnsforward/dns.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> <mask> var v interface{} <mask> v, ok = s.tableIPToHost.Get(ip) <mask> <mask> var typOK bool <mask> if host, typOK = v.(string); !typOK { <mask> log.Error("dns: bad type %T in tableIPToHost for %s", v, ip) <mask> <mask> return "", false <mask> } <mask> </s> Pull request #1238: dnsforward: fix panic Updates #3318. Squashed commit of the following: commit eebaa3ac3a6bfcb29e280006ead8ea9554b8a3bf Author: Ainar Garipov <[email protected]> Date: Tue Jul 6 14:59:00 2021 +0300 dnsforward: imp code commit 7591a3b183ab95f27f908267321518740cb7d4bb Author: Ainar Garipov <[email protected]> Date: Tue Jul 6 14:55:33 2021 +0300 dnsforward: fix panic </s> remove return host, ok </s> add return host, true </s> add if !ok { return "", false }
https://github.com/AdguardTeam/AdGuardHome/commit/1571609e5975be22e31d3ef7336a4ac6b1f08880
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return "", false <mask> } <mask> <mask> return host, ok <mask> } <mask> <mask> // Respond to PTR requests if the target IP is leased by our DHCP server and the <mask> // requestor is inside the local network. <mask> func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) { </s> Pull request #1238: dnsforward: fix panic Updates #3318. Squashed commit of the following: commit eebaa3ac3a6bfcb29e280006ead8ea9554b8a3bf Author: Ainar Garipov <[email protected]> Date: Tue Jul 6 14:59:00 2021 +0300 dnsforward: imp code commit 7591a3b183ab95f27f908267321518740cb7d4bb Author: Ainar Garipov <[email protected]> Date: Tue Jul 6 14:55:33 2021 +0300 dnsforward: fix panic </s> remove var typOK bool if host, typOK = v.(string); !typOK { </s> add if host, ok = v.(string); !ok { </s> add if !ok { return "", false }
https://github.com/AdguardTeam/AdGuardHome/commit/1571609e5975be22e31d3ef7336a4ac6b1f08880
internal/dnsforward/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return safe <mask> } <mask> <mask> func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { <mask> for _, s := range tls.CipherSuites() { <mask> if slices.Contains(ciphers, s.Name) { <mask> userCiphers = append(userCiphers, s.ID) <mask> log.Debug("user specified cipher : %s, ID : %d", s.Name, s.ID) <mask> } </s> changes done as per review comments </s> add } else { log.Error("unknown cipher : %s ", s) </s> add // getTLSCiphers check for overriden tls ciphers, if the slice is // empty, then default safe ciphers are used func getTLSCiphers() []uint16 { var cipher []uint16 if len(config.TLS.OverrideTLSCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.ParseCipherIDs(config.TLS.OverrideTLSCiphers) } return cipher } </s> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) { </s> remove var cipher []uint16 if len(web.conf.tlsCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) } </s> add </s> remove go web.mustStartHTTP3(addr, cipher) </s> add go web.mustStartHTTP3(addr) </s> remove tlsCiphers: config.TLS.TLSCiphers, </s> add tlsCiphers: getTLSCiphers(),
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/aghtls/aghtls.go
keep add keep keep keep keep keep
<mask> userCiphers = append(userCiphers, s.ID) <mask> log.Debug("user specified cipher : %s, ID : %d", s.Name, s.ID) <mask> } <mask> } <mask> <mask> return userCiphers <mask> } </s> changes done as per review comments </s> remove func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { </s> add // ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) { </s> add // getTLSCiphers check for overriden tls ciphers, if the slice is // empty, then default safe ciphers are used func getTLSCiphers() []uint16 { var cipher []uint16 if len(config.TLS.OverrideTLSCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.ParseCipherIDs(config.TLS.OverrideTLSCiphers) } return cipher } </s> remove var cipher []uint16 if len(web.conf.tlsCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) } </s> add </s> remove tlsCiphers: config.TLS.TLSCiphers, </s> add tlsCiphers: getTLSCiphers(), </s> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) { </s> remove // ciphers specified by user tlsCiphers []string </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/aghtls/aghtls.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> cert tls.Certificate <mask> // DNS names from certificate (SAN) or CN value from Subject <mask> dnsNames []string <mask> <mask> // ciphers specified by user <mask> TLSCiphers []string `yaml:"tls_ciphers" json:"-"` <mask> } <mask> <mask> // DNSCryptConfig is the DNSCrypt server configuration struct. <mask> type DNSCryptConfig struct { <mask> ResolverCert *dnscrypt.Cert </s> changes done as per review comments </s> remove // ciphers specified by user tlsCiphers []string </s> add </s> add // getTLSCiphers check for overriden tls ciphers, if the slice is // empty, then default safe ciphers are used func getTLSCiphers() []uint16 { var cipher []uint16 if len(config.TLS.OverrideTLSCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.ParseCipherIDs(config.TLS.OverrideTLSCiphers) } return cipher } </s> remove func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { </s> add // ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) { </s> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) { </s> add // Ciphers that are used for https listener tlsCiphers []uint16 </s> add } else { log.Error("unknown cipher : %s ", s)
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/dnsforward/config.go
keep keep keep keep replace keep keep keep keep keep
<mask> clientFS: clientFS, <mask> clientBetaFS: clientBetaFS, <mask> <mask> serveHTTP3: config.DNS.ServeHTTP3, <mask> tlsCiphers: config.TLS.TLSCiphers, <mask> } <mask> <mask> web = newWeb(&webConf) <mask> if web == nil { <mask> return nil, fmt.Errorf("initializing web: %w", err) </s> changes done as per review comments </s> add // getTLSCiphers check for overriden tls ciphers, if the slice is // empty, then default safe ciphers are used func getTLSCiphers() []uint16 { var cipher []uint16 if len(config.TLS.OverrideTLSCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.ParseCipherIDs(config.TLS.OverrideTLSCiphers) } return cipher } </s> remove var cipher []uint16 if len(web.conf.tlsCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) } </s> add </s> add } else { log.Error("unknown cipher : %s ", s) </s> remove func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { </s> add // ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) { </s> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) { </s> remove go web.mustStartHTTP3(addr, cipher) </s> add go web.mustStartHTTP3(addr)
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/home.go
keep keep keep add
<mask> type jsonError struct { <mask> // Message is the error message, an opaque string. <mask> Message string `json:"message"` <mask> } </s> changes done as per review comments </s> remove // ciphers specified by user tlsCiphers []string </s> add </s> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) { </s> remove // ciphers specified by user TLSCiphers []string `yaml:"tls_ciphers" json:"-"` </s> add // OverrideTLSCiphers holds the cipher names. If the slice is empty // default set of ciphers are used for https listener, else this is // considered. OverrideTLSCiphers []string `yaml:"override_tls_ciphers" json:"-"` </s> add // Ciphers that are used for https listener tlsCiphers []uint16 </s> remove func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { </s> add // ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) { </s> remove var cipher []uint16 if len(web.conf.tlsCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/home.go
keep keep keep keep replace keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtls" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/NYTimes/gziphandler" <mask> "github.com/lucas-clemente/quic-go" </s> changes done as per review comments </s> remove CipherSuites: ciphers, </s> add CipherSuites: web.conf.tlsCiphers, </s> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) { </s> remove go web.mustStartHTTP3(addr, cipher) </s> add go web.mustStartHTTP3(addr) </s> remove CipherSuites: cipher, </s> add CipherSuites: web.conf.tlsCiphers, </s> remove var cipher []uint16 if len(web.conf.tlsCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) } </s> add </s> remove // ciphers specified by user tlsCiphers []string </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
keep keep keep add keep keep keep keep
<mask> writeTimeout = 60 * time.Second <mask> ) <mask> <mask> type webConfig struct { <mask> clientFS fs.FS <mask> clientBetaFS fs.FS <mask> <mask> BindHost net.IP </s> changes done as per review comments </s> add // getTLSCiphers check for overriden tls ciphers, if the slice is // empty, then default safe ciphers are used func getTLSCiphers() []uint16 { var cipher []uint16 if len(config.TLS.OverrideTLSCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.ParseCipherIDs(config.TLS.OverrideTLSCiphers) } return cipher } </s> remove // ciphers specified by user tlsCiphers []string </s> add </s> remove var cipher []uint16 if len(web.conf.tlsCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) } </s> add </s> remove // ciphers specified by user TLSCiphers []string `yaml:"tls_ciphers" json:"-"` </s> add // OverrideTLSCiphers holds the cipher names. If the slice is empty // default set of ciphers are used for https listener, else this is // considered. OverrideTLSCiphers []string `yaml:"override_tls_ciphers" json:"-"` </s> remove func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { </s> add // ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) { </s> remove tlsCiphers: config.TLS.TLSCiphers, </s> add tlsCiphers: getTLSCiphers(),
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> <mask> firstRun bool <mask> <mask> serveHTTP3 bool <mask> <mask> // ciphers specified by user <mask> tlsCiphers []string <mask> } <mask> <mask> // httpsServer contains the data for the HTTPS server. <mask> type httpsServer struct { <mask> // server is the pre-HTTP/3 HTTPS server. </s> changes done as per review comments </s> remove // ciphers specified by user TLSCiphers []string `yaml:"tls_ciphers" json:"-"` </s> add // OverrideTLSCiphers holds the cipher names. If the slice is empty // default set of ciphers are used for https listener, else this is // considered. OverrideTLSCiphers []string `yaml:"override_tls_ciphers" json:"-"` </s> add // getTLSCiphers check for overriden tls ciphers, if the slice is // empty, then default safe ciphers are used func getTLSCiphers() []uint16 { var cipher []uint16 if len(config.TLS.OverrideTLSCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.ParseCipherIDs(config.TLS.OverrideTLSCiphers) } return cipher } </s> add // Ciphers that are used for https listener tlsCiphers []uint16 </s> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) { </s> remove func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { </s> add // ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) { </s> add } else { log.Error("unknown cipher : %s ", s)
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> } <mask> <mask> web.httpsServer.cond.L.Unlock() <mask> <mask> var cipher []uint16 <mask> <mask> if len(web.conf.tlsCiphers) == 0 { <mask> cipher = aghtls.SaferCipherSuites() <mask> } else { <mask> cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) <mask> } <mask> <mask> addr := netutil.JoinHostPort(web.conf.BindHost.String(), web.conf.PortHTTPS) <mask> web.httpsServer.server = &http.Server{ <mask> ErrorLog: log.StdLog("web: https", log.DEBUG), <mask> Addr: addr, <mask> TLSConfig: &tls.Config{ </s> changes done as per review comments </s> add // getTLSCiphers check for overriden tls ciphers, if the slice is // empty, then default safe ciphers are used func getTLSCiphers() []uint16 { var cipher []uint16 if len(config.TLS.OverrideTLSCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.ParseCipherIDs(config.TLS.OverrideTLSCiphers) } return cipher } </s> add } else { log.Error("unknown cipher : %s ", s) </s> remove func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { </s> add // ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) { </s> remove CipherSuites: ciphers, </s> add CipherSuites: web.conf.tlsCiphers, </s> remove CipherSuites: cipher, </s> add CipherSuites: web.conf.tlsCiphers, </s> remove tlsCiphers: config.TLS.TLSCiphers, </s> add tlsCiphers: getTLSCiphers(),
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
keep keep keep keep replace keep keep keep keep keep
<mask> Addr: addr, <mask> TLSConfig: &tls.Config{ <mask> Certificates: []tls.Certificate{web.httpsServer.cert}, <mask> RootCAs: Context.tlsRoots, <mask> CipherSuites: cipher, <mask> MinVersion: tls.VersionTLS12, <mask> }, <mask> Handler: withMiddlewares(Context.mux, limitRequestBody), <mask> ReadTimeout: web.conf.ReadTimeout, <mask> ReadHeaderTimeout: web.conf.ReadHeaderTimeout, </s> changes done as per review comments </s> remove CipherSuites: ciphers, </s> add CipherSuites: web.conf.tlsCiphers, </s> remove var cipher []uint16 if len(web.conf.tlsCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) } </s> add </s> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) { </s> remove go web.mustStartHTTP3(addr, cipher) </s> add go web.mustStartHTTP3(addr) </s> remove // ciphers specified by user tlsCiphers []string </s> add </s> add // Ciphers that are used for https listener tlsCiphers []uint16
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> printHTTPAddresses(aghhttp.SchemeHTTPS) <mask> <mask> if web.conf.serveHTTP3 { <mask> go web.mustStartHTTP3(addr, cipher) <mask> } <mask> <mask> log.Debug("web: starting https server") <mask> err := web.httpsServer.server.ListenAndServeTLS("", "") <mask> if !errors.Is(err, http.ErrServerClosed) { </s> changes done as per review comments </s> remove var cipher []uint16 if len(web.conf.tlsCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) } </s> add </s> remove func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { </s> add // ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) { </s> add // getTLSCiphers check for overriden tls ciphers, if the slice is // empty, then default safe ciphers are used func getTLSCiphers() []uint16 { var cipher []uint16 if len(config.TLS.OverrideTLSCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.ParseCipherIDs(config.TLS.OverrideTLSCiphers) } return cipher } </s> add // Ciphers that are used for https listener tlsCiphers []uint16 </s> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) { </s> remove tlsCiphers: config.TLS.TLSCiphers, </s> add tlsCiphers: getTLSCiphers(),
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> } <mask> } <mask> <mask> func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { <mask> defer log.OnPanic("web: http3") <mask> <mask> web.httpsServer.server3 = &http3.Server{ <mask> // TODO(a.garipov): See if there is a way to use the error log as <mask> // well as timeouts here. </s> changes done as per review comments </s> remove func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { </s> add // ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) { </s> add // getTLSCiphers check for overriden tls ciphers, if the slice is // empty, then default safe ciphers are used func getTLSCiphers() []uint16 { var cipher []uint16 if len(config.TLS.OverrideTLSCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.ParseCipherIDs(config.TLS.OverrideTLSCiphers) } return cipher } </s> remove // ciphers specified by user tlsCiphers []string </s> add </s> remove // ciphers specified by user TLSCiphers []string `yaml:"tls_ciphers" json:"-"` </s> add // OverrideTLSCiphers holds the cipher names. If the slice is empty // default set of ciphers are used for https listener, else this is // considered. OverrideTLSCiphers []string `yaml:"override_tls_ciphers" json:"-"` </s> remove var cipher []uint16 if len(web.conf.tlsCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) } </s> add </s> add } else { log.Error("unknown cipher : %s ", s)
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
keep keep keep keep replace keep keep keep keep keep
<mask> Addr: address, <mask> TLSConfig: &tls.Config{ <mask> Certificates: []tls.Certificate{web.httpsServer.cert}, <mask> RootCAs: Context.tlsRoots, <mask> CipherSuites: ciphers, <mask> MinVersion: tls.VersionTLS12, <mask> }, <mask> Handler: withMiddlewares(Context.mux, limitRequestBody), <mask> } <mask> </s> changes done as per review comments </s> remove CipherSuites: cipher, </s> add CipherSuites: web.conf.tlsCiphers, </s> remove var cipher []uint16 if len(web.conf.tlsCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.UserPreferredCipherSuites(web.conf.tlsCiphers) } </s> add </s> add // getTLSCiphers check for overriden tls ciphers, if the slice is // empty, then default safe ciphers are used func getTLSCiphers() []uint16 { var cipher []uint16 if len(config.TLS.OverrideTLSCiphers) == 0 { cipher = aghtls.SaferCipherSuites() } else { cipher = aghtls.ParseCipherIDs(config.TLS.OverrideTLSCiphers) } return cipher } </s> add } else { log.Error("unknown cipher : %s ", s) </s> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) { </s> remove func UserPreferredCipherSuites(ciphers []string) (userCiphers []uint16) { </s> add // ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) {
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
keep keep keep keep replace keep keep keep keep keep
<mask> go 1.19 <mask> <mask> require ( <mask> github.com/AdguardTeam/dnsproxy v0.48.3 <mask> github.com/AdguardTeam/golibs v0.13.1 <mask> github.com/AdguardTeam/urlfilter v0.16.1 <mask> github.com/NYTimes/gziphandler v1.1.1 <mask> github.com/ameshkov/dnscrypt/v2 v2.2.6 <mask> github.com/digineo/go-ipset/v2 v2.2.1 <mask> github.com/dimfeld/httptreemux/v5 v5.5.0 </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove github.com/AdguardTeam/golibs v0.13.1 h1:x6ChoXk2jborbCWJ01TyBAEY3SilHts0SCG7yjnf6Sc= github.com/AdguardTeam/golibs v0.13.1/go.mod h1:7ylQLv2Lqsc3UW3jHoITynYk6Y1tYtgEMkR09ppfsN8= </s> add github.com/AdguardTeam/golibs v0.13.2 h1:BPASsyQKmb+b8VnvsNOHp7bKfcZl9Z+Z2UhPjOiupSc= github.com/AdguardTeam/golibs v0.13.2/go.mod h1:7ylQLv2Lqsc3UW3jHoITynYk6Y1tYtgEMkR09ppfsN8= </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove loginURL := w.hdr.Get("Location") </s> add loginURL := w.hdr.Get(httphdr.Location) </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location)) </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove w.Header().Set("Content-Type", "application/xml") </s> add w.Header().Set(httphdr.ContentType, "application/xml")
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
go.mod
keep keep keep keep replace replace keep keep keep keep keep
<mask> github.com/AdguardTeam/dnsproxy v0.48.3 h1:h9xgDSmd1MqsPFNApyaPVXolmSTtzOWOcfWvPeDEP6s= <mask> github.com/AdguardTeam/dnsproxy v0.48.3/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw= <mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/AdguardTeam/golibs v0.10.4/go.mod h1:rSfQRGHIdgfxriDDNgNJ7HmE5zRoURq8R+VdR81Zuzw= <mask> github.com/AdguardTeam/golibs v0.13.1 h1:x6ChoXk2jborbCWJ01TyBAEY3SilHts0SCG7yjnf6Sc= <mask> github.com/AdguardTeam/golibs v0.13.1/go.mod h1:7ylQLv2Lqsc3UW3jHoITynYk6Y1tYtgEMkR09ppfsN8= <mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU= <mask> github.com/AdguardTeam/urlfilter v0.16.1 h1:ZPi0rjqo8cQf2FVdzo6cqumNoHZx2KPXj2yZa1A5BBw= <mask> github.com/AdguardTeam/urlfilter v0.16.1/go.mod h1:46YZDOV1+qtdRDuhZKVPSSp7JWWes0KayqHrKAFBdEI= <mask> github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= <mask> github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove github.com/AdguardTeam/golibs v0.13.1 </s> add github.com/AdguardTeam/golibs v0.13.2 </s> remove w.Header().Set("Retry-After", strconv.Itoa(int(left.Seconds()))) </s> add w.Header().Set(httphdr.RetryAfter, strconv.Itoa(int(left.Seconds()))) </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove loginURL := w.hdr.Get("Location") </s> add loginURL := w.hdr.Get(httphdr.Location) </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location)) </s> add "github.com/AdguardTeam/golibs/httphdr"
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
go.sum
keep keep add keep keep keep keep keep keep
<mask> "net/http" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/version" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // HTTP scheme constants. <mask> const ( <mask> SchemeHTTP = "http" </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove // HTTP Headers // HTTP header name constants. // // TODO(a.garipov): Remove unused. const ( HdrNameAcceptEncoding = "Accept-Encoding" HdrNameAccessControlAllowOrigin = "Access-Control-Allow-Origin" HdrNameAltSvc = "Alt-Svc" HdrNameContentEncoding = "Content-Encoding" HdrNameContentType = "Content-Type" HdrNameOrigin = "Origin" HdrNameServer = "Server" HdrNameTrailer = "Trailer" HdrNameUserAgent = "User-Agent" HdrNameVary = "Vary" ) </s> add // HTTP headers </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove import "net/http" </s> add import ( "net/http" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/golibs/httphdr" ) </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove w.Header().Set("Content-Type", "application/xml") </s> add w.Header().Set(httphdr.ContentType, "application/xml") </s> add "github.com/AdguardTeam/golibs/httphdr"
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/aghhttp/aghhttp.go
keep keep keep keep replace keep keep keep keep keep
<mask> // WriteTextPlainDeprecated responds to the request with a message about <mask> // deprecation and removal of a plain-text API if the request is made with the <mask> // "text/plain" content-type. <mask> func WriteTextPlainDeprecated(w http.ResponseWriter, r *http.Request) (isPlainText bool) { <mask> if r.Header.Get(HdrNameContentType) != HdrValTextPlain { <mask> return false <mask> } <mask> <mask> Error(r, w, http.StatusUnsupportedMediaType, textPlainDeprMsg) <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON) </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove respHdr.Set(aghhttp.HdrNameAltSvc, altSvc) </s> add respHdr.Set(httphdr.AltSvc, altSvc) </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent()) </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/aghhttp/aghhttp.go
keep keep keep keep replace keep keep keep keep keep
<mask> // WriteJSONResponseCode is like [WriteJSONResponse] but adds the ability to <mask> // redefine the status code. <mask> func WriteJSONResponseCode(w http.ResponseWriter, r *http.Request, code int, resp any) (err error) { <mask> w.WriteHeader(code) <mask> w.Header().Set(HdrNameContentType, HdrValApplicationJSON) <mask> err = json.NewEncoder(w).Encode(resp) <mask> if err != nil { <mask> Error(r, w, http.StatusInternalServerError, "encoding resp: %s", err) <mask> } <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent()) </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove req.Header.Set("Content-Type", cType) </s> add req.Header.Set(httphdr.ContentType, cType) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html") </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/aghhttp/aghhttp.go
keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> package aghhttp <mask> <mask> // HTTP Headers <mask> <mask> // HTTP header name constants. <mask> // <mask> // TODO(a.garipov): Remove unused. <mask> const ( <mask> HdrNameAcceptEncoding = "Accept-Encoding" <mask> HdrNameAccessControlAllowOrigin = "Access-Control-Allow-Origin" <mask> HdrNameAltSvc = "Alt-Svc" <mask> HdrNameContentEncoding = "Content-Encoding" <mask> HdrNameContentType = "Content-Type" <mask> HdrNameOrigin = "Origin" <mask> HdrNameServer = "Server" <mask> HdrNameTrailer = "Trailer" <mask> HdrNameUserAgent = "User-Agent" <mask> HdrNameVary = "Vary" <mask> ) <mask> <mask> // HTTP header value constants. <mask> const ( <mask> HdrValApplicationJSON = "application/json" <mask> HdrValTextPlain = "text/plain" </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove w.Header().Set("Content-Type", "application/xml") </s> add w.Header().Set(httphdr.ContentType, "application/xml") </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP, </s> remove import "net/http" </s> add import ( "net/http" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/golibs/httphdr" ) </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain {
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/aghhttp/header.go
keep add keep keep keep keep keep keep
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/AdguardTeam/golibs/testutil" <mask> "github.com/miekg/dns" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> ) </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr"
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/dnsforward/http_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> s.conf = tc.conf() <mask> s.handleGetConfig(w, nil) <mask> <mask> cType := w.Header().Get(aghhttp.HdrNameContentType) <mask> assert.Equal(t, aghhttp.HdrValApplicationJSON, cType) <mask> assert.JSONEq(t, string(caseWant), w.Body.String()) <mask> }) <mask> } <mask> } </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove req.Header.Set("Content-Type", cType) </s> add req.Header.Set(httphdr.ContentType, cType) </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location)) </s> remove w.Header().Set("Retry-After", strconv.Itoa(int(left.Seconds()))) </s> add w.Header().Set(httphdr.RetryAfter, strconv.Itoa(int(left.Seconds()))) </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor) </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP,
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/dnsforward/http_test.go
keep keep add keep keep keep keep
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/AdguardTeam/golibs/timeutil" <mask> "go.etcd.io/bbolt" </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr"
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> // <mask> // TODO(a.garipov): Support header Forwarded from RFC 7329. <mask> func realIP(r *http.Request) (ip net.IP, err error) { <mask> proxyHeaders := []string{ <mask> "CF-Connecting-IP", <mask> "True-Client-IP", <mask> "X-Real-IP", <mask> } <mask> <mask> for _, h := range proxyHeaders { <mask> v := r.Header.Get(h) <mask> ip = net.ParseIP(v) </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent()) </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html") </s> remove w.Header().Set("Content-Disposition", contDisp) </s> add w.Header().Set(httphdr.ContentDisposition, contDisp) </s> remove h.Set("Content-Type", "application/json") </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> // If none of the above yielded any results, get the leftmost IP address <mask> // from the X-Forwarded-For header. <mask> s := r.Header.Get("X-Forwarded-For") <mask> ipStrs := strings.SplitN(s, ", ", 2) <mask> ip = net.ParseIP(ipStrs[0]) <mask> if ip != nil { <mask> return ip, nil <mask> } </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove respHdr.Set(aghhttp.HdrNameAltSvc, altSvc) </s> add respHdr.Set(httphdr.AltSvc, altSvc) </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html") </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP,
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> if rateLimiter := Context.auth.raleLimiter; rateLimiter != nil { <mask> if left := rateLimiter.check(remoteAddr); left > 0 { <mask> w.Header().Set("Retry-After", strconv.Itoa(int(left.Seconds()))) <mask> aghhttp.Error(r, w, http.StatusTooManyRequests, "auth: blocked for %s", left) <mask> <mask> return <mask> } <mask> } </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove req.Header.Set("Content-Type", cType) </s> add req.Header.Set(httphdr.ContentType, cType) </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor) </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON) </s> remove h.Set("Content-Disposition", d) </s> add h.Set(httphdr.ContentDisposition, d) </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/")
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> <mask> http.SetCookie(w, cookie) <mask> <mask> h := w.Header() <mask> h.Set("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate") <mask> h.Set("Pragma", "no-cache") <mask> h.Set("Expires", "0") <mask> <mask> aghhttp.OK(w) <mask> } <mask> <mask> func handleLogout(w http.ResponseWriter, r *http.Request) { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent()) </s> remove w.Header().Set("Content-Disposition", contDisp) </s> add w.Header().Set(httphdr.ContentDisposition, contDisp) </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP, </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain {
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
keep keep keep keep replace keep keep keep keep keep
<mask> c, err := r.Cookie(sessionCookieName) <mask> if err != nil { <mask> // The only error that is returned from r.Cookie is [http.ErrNoCookie]. <mask> // The user is already logged out. <mask> respHdr.Set("Location", "/login.html") <mask> w.WriteHeader(http.StatusFound) <mask> <mask> return <mask> } <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove req.Header.Set("Content-Type", cType) </s> add req.Header.Set(httphdr.ContentType, cType) </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON) </s> remove respHdr.Set("Location", "/login.html") respHdr.Set("Set-Cookie", c.String()) </s> add respHdr.Set(httphdr.Location, "/login.html") respHdr.Set(httphdr.SetCookie, c.String()) </s> remove respHdr.Set(aghhttp.HdrNameAccessControlAllowOrigin, originURL.String()) respHdr.Set(aghhttp.HdrNameVary, aghhttp.HdrNameOrigin) </s> add respHdr.Set(httphdr.AccessControlAllowOrigin, originURL.String()) respHdr.Set(httphdr.Vary, httphdr.Origin) </s> remove respHdr.Set(aghhttp.HdrNameAltSvc, altSvc) </s> add respHdr.Set(httphdr.AltSvc, altSvc)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> HttpOnly: true, <mask> SameSite: http.SameSiteLaxMode, <mask> } <mask> <mask> respHdr.Set("Location", "/login.html") <mask> respHdr.Set("Set-Cookie", c.String()) <mask> w.WriteHeader(http.StatusFound) <mask> } <mask> <mask> // RegisterAuthHandlers - register handlers <mask> func RegisterAuthHandlers() { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html") </s> remove w.Header().Set("Location", "/login.html") </s> add w.Header().Set(httphdr.Location, "/login.html") </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove r.Header.Del("Authorization") </s> add r.Header.Del(httphdr.Authorization) </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP,
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
keep keep keep keep replace keep keep keep keep keep
<mask> if glProcessRedirect(w, r) { <mask> log.Debug("auth: redirected to login page by GL-Inet submodule") <mask> } else { <mask> log.Debug("auth: redirected to login page") <mask> w.Header().Set("Location", "/login.html") <mask> w.WriteHeader(http.StatusFound) <mask> } <mask> } else { <mask> log.Debug("auth: responded with forbidden to %s %s", r.Method, p) <mask> w.WriteHeader(http.StatusForbidden) </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove r.Header.Del("Authorization") </s> add r.Header.Del(httphdr.Authorization) </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove respHdr.Set("Location", "/login.html") respHdr.Set("Set-Cookie", c.String()) </s> add respHdr.Set(httphdr.Location, "/login.html") respHdr.Set(httphdr.SetCookie, c.String()) </s> remove loginURL := w.hdr.Get("Location") </s> add loginURL := w.hdr.Get(httphdr.Location) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html")
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
keep keep keep keep replace keep keep keep keep keep
<mask> if authRequired && err == nil { <mask> // Redirect to the dashboard if already authenticated. <mask> res := Context.auth.checkSession(cookie.Value) <mask> if res == checkSessionOK { <mask> w.Header().Set("Location", "/") <mask> w.WriteHeader(http.StatusFound) <mask> <mask> return <mask> } <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove respHdr.Set(aghhttp.HdrNameAltSvc, altSvc) </s> add respHdr.Set(httphdr.AltSvc, altSvc) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html") </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove req.Header.Set("Content-Type", cType) </s> add req.Header.Set(httphdr.ContentType, cType) </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor) </s> remove w.Header().Set("Location", "/login.html") </s> add w.Header().Set(httphdr.Location, "/login.html")
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
keep keep add keep keep keep keep keep
<mask> "testing" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/testutil" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr"
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
keep keep keep keep replace keep keep keep replace
<mask> r.URL = &url.URL{Path: "/"} <mask> handlerCalled = false <mask> handler2(&w, &r) <mask> assert.Equal(t, http.StatusFound, w.statusCode) <mask> assert.NotEmpty(t, w.hdr.Get("Location")) <mask> assert.False(t, handlerCalled) <mask> <mask> // go to login page <mask> loginURL := w.hdr.Get("Location") </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location)) </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie) </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // get / <mask> handler2 = optionalAuth(handler) <mask> w.hdr = make(http.Header) <mask> r.Header.Set("Cookie", cookie.String()) <mask> r.URL = &url.URL{Path: "/"} <mask> handlerCalled = false <mask> handler2(&w, &r) <mask> assert.True(t, handlerCalled) <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie) </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove r.Header.Del("Authorization") </s> add r.Header.Del(httphdr.Authorization) </s> remove r.Header.Set("Cookie", "bad") </s> add r.Header.Set(httphdr.Cookie, "bad") </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location)) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> handlerCalled = false <mask> handler2(&w, &r) <mask> assert.True(t, handlerCalled) <mask> <mask> r.Header.Del("Cookie") <mask> <mask> // get / with basic auth <mask> handler2 = optionalAuth(handler) <mask> w.hdr = make(http.Header) <mask> r.URL = &url.URL{Path: "/"} </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove r.Header.Set("Cookie", "bad") </s> add r.Header.Set(httphdr.Cookie, "bad") </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove r.Header.Del("Authorization") </s> add r.Header.Del(httphdr.Authorization) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie) </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location))
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
keep replace keep keep keep keep replace keep keep
<mask> assert.True(t, handlerCalled) <mask> r.Header.Del("Authorization") <mask> <mask> // get login page with a valid cookie - we're redirected to / <mask> handler2 = optionalAuth(handler) <mask> w.hdr = make(http.Header) <mask> r.Header.Set("Cookie", cookie.String()) <mask> r.URL = &url.URL{Path: loginURL} <mask> handlerCalled = false </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove r.Header.Set("Cookie", "bad") </s> add r.Header.Set(httphdr.Cookie, "bad") </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location)) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
keep keep keep replace keep replace keep
<mask> r.URL = &url.URL{Path: loginURL} <mask> handlerCalled = false <mask> handler2(&w, &r) <mask> assert.NotEmpty(t, w.hdr.Get("Location")) <mask> assert.False(t, handlerCalled) <mask> r.Header.Del("Cookie") <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location)) </s> remove loginURL := w.hdr.Get("Location") </s> add loginURL := w.hdr.Get(httphdr.Location) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie) </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove r.Header.Set("Cookie", "bad") </s> add r.Header.Set(httphdr.Cookie, "bad")
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
keep replace keep keep keep keep replace keep keep keep keep
<mask> w.hdr = make(http.Header) <mask> r.Header.Set("Cookie", "bad") <mask> r.URL = &url.URL{Path: loginURL} <mask> handlerCalled = false <mask> handler2(&w, &r) <mask> assert.True(t, handlerCalled) <mask> r.Header.Del("Cookie") <mask> <mask> Context.auth.Close() <mask> } <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie) </s> remove r.Header.Set("Cookie", cookie.String()) </s> add r.Header.Set(httphdr.Cookie, cookie.String()) </s> remove assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, w.hdr.Get(httphdr.Location))
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> wantIP: net.IPv4(1, 2, 3, 4), <mask> }, { <mask> name: "success_proxy", <mask> header: http.Header{ <mask> textproto.CanonicalMIMEHeaderKey("X-Real-IP"): []string{"1.2.3.5"}, <mask> }, <mask> remoteAddr: remoteAddr, <mask> wantErrMsg: "", <mask> wantIP: net.IPv4(1, 2, 3, 5), <mask> }, { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove textproto.CanonicalMIMEHeaderKey("X-Forwarded-For"): []string{ </s> add textproto.CanonicalMIMEHeaderKey(httphdr.XForwardedFor): []string{ </s> remove h.Set("Content-Disposition", d) </s> add h.Set(httphdr.ContentDisposition, d) </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove w.Header().Set("Location", "/login.html") </s> add w.Header().Set(httphdr.Location, "/login.html") </s> remove w.Header().Set("Content-Disposition", contDisp) </s> add w.Header().Set(httphdr.ContentDisposition, contDisp) </s> remove respHdr.Set(aghhttp.HdrNameAltSvc, altSvc) </s> add respHdr.Set(httphdr.AltSvc, altSvc)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> wantIP: net.IPv4(1, 2, 3, 5), <mask> }, { <mask> name: "success_proxy_multiple", <mask> header: http.Header{ <mask> textproto.CanonicalMIMEHeaderKey("X-Forwarded-For"): []string{ <mask> "1.2.3.6, 1.2.3.5", <mask> }, <mask> }, <mask> remoteAddr: remoteAddr, <mask> wantErrMsg: "", </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove textproto.CanonicalMIMEHeaderKey("X-Real-IP"): []string{"1.2.3.5"}, </s> add textproto.CanonicalMIMEHeaderKey(httphdr.XRealIP): []string{"1.2.3.5"}, </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP, </s> remove h.Set("Content-Disposition", d) </s> add h.Set(httphdr.ContentDisposition, d) </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove w.Header().Set("Location", "/login.html") </s> add w.Header().Set(httphdr.Location, "/login.html") </s> remove w.Header().Set("Content-Disposition", contDisp) </s> add w.Header().Set(httphdr.ContentDisposition, contDisp)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
keep keep add keep keep keep keep keep keep
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/AdGuardHome/internal/version" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/NYTimes/gziphandler" <mask> ) <mask> <mask> // appendDNSAddrs is a convenient helper for appending a formatted form of DNS </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent())
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/control.go
keep keep keep keep replace keep keep keep keep keep
<mask> // to w, and ok is false. <mask> func ensureContentType(w http.ResponseWriter, r *http.Request) (ok bool) { <mask> const statusUnsup = http.StatusUnsupportedMediaType <mask> <mask> cType := r.Header.Get(aghhttp.HdrNameContentType) <mask> if r.ContentLength == 0 { <mask> if cType == "" { <mask> return true <mask> } <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove w.Header().Set("Content-Disposition", contDisp) </s> add w.Header().Set(httphdr.ContentDisposition, contDisp) </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove respHdr.Set(aghhttp.HdrNameAccessControlAllowOrigin, originURL.String()) respHdr.Set(aghhttp.HdrNameVary, aghhttp.HdrNameOrigin) </s> add respHdr.Set(httphdr.AccessControlAllowOrigin, originURL.String()) respHdr.Set(httphdr.Vary, httphdr.Origin) </s> remove cType := w.Header().Get(aghhttp.HdrNameContentType) </s> add cType := w.Header().Get(httphdr.ContentType) </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/control.go
keep keep keep keep replace keep keep keep keep keep
<mask> // TODO(a.garipov): Consider adding a configurable max-age. Currently, the <mask> // default is 24 hours. <mask> if serveHTTP3 { <mask> altSvc := fmt.Sprintf(`h3=":%d"`, portHTTPS) <mask> respHdr.Set(aghhttp.HdrNameAltSvc, altSvc) <mask> } <mask> <mask> if r.TLS == nil && web.forceHTTPS { <mask> hostPort := host <mask> if port := web.conf.PortHTTPS; port != defaultPortHTTPS { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent()) </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor) </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html")
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/control.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> Scheme: aghhttp.SchemeHTTP, <mask> Host: r.Host, <mask> } <mask> <mask> respHdr.Set(aghhttp.HdrNameAccessControlAllowOrigin, originURL.String()) <mask> respHdr.Set(aghhttp.HdrNameVary, aghhttp.HdrNameOrigin) <mask> <mask> return true <mask> } <mask> <mask> // postInstall lets the handler to run only if firstRun is false. Otherwise, it </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html") </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON) </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/control.go
keep keep keep add keep keep keep keep keep
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" <mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/google/uuid" <mask> "howett.net/plist" <mask> ) <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr"
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/mobileconfig.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/xml") <mask> <mask> const ( <mask> dohContDisp = `attachment; filename=doh.mobileconfig` <mask> dotContDisp = `attachment; filename=dot.mobileconfig` <mask> ) </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove // HTTP Headers // HTTP header name constants. // // TODO(a.garipov): Remove unused. const ( HdrNameAcceptEncoding = "Accept-Encoding" HdrNameAccessControlAllowOrigin = "Access-Control-Allow-Origin" HdrNameAltSvc = "Alt-Svc" HdrNameContentEncoding = "Content-Encoding" HdrNameContentType = "Content-Type" HdrNameOrigin = "Origin" HdrNameServer = "Server" HdrNameTrailer = "Trailer" HdrNameUserAgent = "User-Agent" HdrNameVary = "Vary" ) </s> add // HTTP headers </s> remove w.Header().Set("Content-Disposition", contDisp) </s> add w.Header().Set(httphdr.ContentDisposition, contDisp) </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/mobileconfig.go
keep keep keep keep replace keep keep keep keep keep
<mask> if dnsp == dnsProtoTLS { <mask> contDisp = dotContDisp <mask> } <mask> <mask> w.Header().Set("Content-Disposition", contDisp) <mask> <mask> _, _ = w.Write(mobileconfig) <mask> } <mask> <mask> func handleMobileConfigDoH(w http.ResponseWriter, r *http.Request) { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove h.Set("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate") h.Set("Pragma", "no-cache") h.Set("Expires", "0") </s> add h.Set(httphdr.CacheControl, "no-store, no-cache, must-revalidate, proxy-revalidate") h.Set(httphdr.Pragma, "no-cache") h.Set(httphdr.Expires, "0") </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP, </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/")
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/mobileconfig.go
keep keep keep add keep keep keep keep keep
<mask> "strconv" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" <mask> "github.com/AdguardTeam/golibs/log" <mask> ) <mask> <mask> // JSON Utilities <mask> </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove import "net/http" </s> add import ( "net/http" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/golibs/httphdr" )
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/next/websvc/json.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> // request. <mask> func writeJSONResponse(w http.ResponseWriter, r *http.Request, v any, code int) { <mask> // TODO(a.garipov): Put some of these to a middleware. <mask> h := w.Header() <mask> h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) <mask> h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) <mask> <mask> w.WriteHeader(code) <mask> <mask> err := json.NewEncoder(w).Encode(v) <mask> if err != nil { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON) </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP, </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove req.Header.Set("Content-Type", cType) </s> add req.Header.Set(httphdr.ContentType, cType) </s> remove h.Set("Content-Disposition", d) </s> add h.Set(httphdr.ContentDisposition, d)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/next/websvc/json.go
keep keep replace keep keep keep keep keep
<mask> package websvc <mask> <mask> import "net/http" <mask> <mask> // Middlewares <mask> <mask> // jsonMw sets the content type of the response to application/json. <mask> func jsonMw(h http.Handler) (wrapped http.HandlerFunc) { </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor) </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON) </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/")
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/next/websvc/middleware.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // jsonMw sets the content type of the response to application/json. <mask> func jsonMw(h http.Handler) (wrapped http.HandlerFunc) { <mask> f := func(w http.ResponseWriter, r *http.Request) { <mask> w.Header().Set("Content-Type", "application/json") <mask> <mask> h.ServeHTTP(w, r) <mask> } <mask> <mask> return http.HandlerFunc(f) </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove import "net/http" </s> add import ( "net/http" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/golibs/httphdr" ) </s> remove if r.Header.Get(HdrNameContentType) != HdrValTextPlain { </s> add if r.Header.Get(httphdr.ContentType) != HdrValTextPlain { </s> remove cType := r.Header.Get(aghhttp.HdrNameContentType) </s> add cType := r.Header.Get(httphdr.ContentType) </s> remove s := r.Header.Get("X-Forwarded-For") </s> add s := r.Header.Get(httphdr.XForwardedFor) </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON) </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent())
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/next/websvc/middleware.go
keep keep add keep keep keep keep keep
<mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghio" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/httphdr" <mask> "github.com/AdguardTeam/golibs/log" </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr"
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
scripts/translations/main.go
keep add keep keep keep keep keep keep
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "golang.org/x/exp/maps" <mask> "golang.org/x/exp/slices" <mask> ) <mask> <mask> const ( </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove w.Header().Set("Content-Type", "application/xml") </s> add w.Header().Set(httphdr.ContentType, "application/xml") </s> add "github.com/AdguardTeam/golibs/httphdr" </s> remove // HTTP Headers // HTTP header name constants. // // TODO(a.garipov): Remove unused. const ( HdrNameAcceptEncoding = "Accept-Encoding" HdrNameAccessControlAllowOrigin = "Access-Control-Allow-Origin" HdrNameAltSvc = "Alt-Svc" HdrNameContentEncoding = "Content-Encoding" HdrNameContentType = "Content-Type" HdrNameOrigin = "Origin" HdrNameServer = "Server" HdrNameTrailer = "Trailer" HdrNameUserAgent = "User-Agent" HdrNameVary = "Vary" ) </s> add // HTTP headers
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
scripts/translations/main.go
keep keep replace keep keep replace
<mask> <mask> h := make(textproto.MIMEHeader) <mask> h.Set("Content-Type", "application/json") <mask> <mask> d := fmt.Sprintf("form-data; name=%q; filename=%q", "file", defaultBaseFile) <mask> h.Set("Content-Disposition", d) </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove "CF-Connecting-IP", "True-Client-IP", "X-Real-IP", </s> add httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP, </s> remove w.Header().Set("Content-Type", "application/json") </s> add w.Header().Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent()) </s> remove h.Set("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate") h.Set("Pragma", "no-cache") h.Set("Expires", "0") </s> add h.Set(httphdr.CacheControl, "no-store, no-cache, must-revalidate, proxy-revalidate") h.Set(httphdr.Pragma, "no-cache") h.Set(httphdr.Expires, "0") </s> remove cType := w.Header().Get(aghhttp.HdrNameContentType) </s> add cType := w.Header().Get(httphdr.ContentType)
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
scripts/translations/main.go
keep keep keep keep replace keep keep keep keep keep
<mask> if err != nil { <mask> return fmt.Errorf("bad request: %w", err) <mask> } <mask> <mask> req.Header.Set("Content-Type", cType) <mask> <mask> resp, err := client.Do(req) <mask> if err != nil { <mask> return fmt.Errorf("client post form: %w", err) <mask> } </s> Pull request 1807: upd-golibs Merge in DNS/adguard-home from upd-golibs to master Squashed commit of the following: commit cde42a72c2140245f345681cbb936ed3bc4645a1 Author: Ainar Garipov <[email protected]> Date: Fri Apr 7 13:57:02 2023 +0300 all: upd golibs, use hdrs </s> remove h.Set("Content-Disposition", d) </s> add h.Set(httphdr.ContentDisposition, d) </s> remove respHdr.Set("Location", "/login.html") </s> add respHdr.Set(httphdr.Location, "/login.html") </s> remove w.Header().Set(HdrNameContentType, HdrValApplicationJSON) </s> add w.Header().Set(httphdr.ContentType, HdrValApplicationJSON) </s> remove w.Header().Set("Location", "/") </s> add w.Header().Set(httphdr.Location, "/") </s> remove h.Set(aghhttp.HdrNameContentType, aghhttp.HdrValApplicationJSON) h.Set(aghhttp.HdrNameServer, aghhttp.UserAgent()) </s> add h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON) h.Set(httphdr.Server, aghhttp.UserAgent()) </s> remove w.Header().Set("Retry-After", strconv.Itoa(int(left.Seconds()))) </s> add w.Header().Set(httphdr.RetryAfter, strconv.Itoa(int(left.Seconds())))
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
scripts/translations/main.go
keep keep keep add keep keep keep keep keep
<mask> border-radius: 4px !important; <mask> pointer-events: auto !important; <mask> background-color: var(--white); <mask> z-index: 102; <mask> } <mask> <mask> .white-space--nowrap { <mask> white-space: nowrap !important; <mask> } </s> Open tooltip on hover, show scroll on overflow y </s> remove .tooltip__container { overflow-y: scroll; } </s> add </s> add import { HIDE_TOOLTIP_DELAY } from '../../../helpers/constants'; </s> add export const HIDE_TOOLTIP_DELAY = 300; </s> remove scrollHide: PropTypes.bool, </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/15db9e9c1daec31d5d6f1d6d77a59bc125fb00d5
client/src/components/Logs/Cells/Tooltip.css
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> <mask> .grid .key-colon, .grid .title--border { <mask> font-weight: bold; <mask> } <mask> <mask> .tooltip__container { <mask> overflow-y: scroll; <mask> } <mask> } <mask> <mask> .grid .key-colon:nth-child(odd)::after { <mask> content: ':'; <mask> } </s> Open tooltip on hover, show scroll on overflow y </s> add overflow-y: scroll; max-height: 100%; </s> add import { HIDE_TOOLTIP_DELAY } from '../../../helpers/constants'; </s> remove scrollHide: PropTypes.bool, </s> add </s> add export const HIDE_TOOLTIP_DELAY = 300;
https://github.com/AdguardTeam/AdGuardHome/commit/15db9e9c1daec31d5d6f1d6d77a59bc125fb00d5
client/src/components/Logs/Cells/Tooltip.css