docstring_tokens
stringlengths
0
76.5k
code_tokens
stringlengths
75
1.81M
label_window
sequencelengths
4
2.12k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
if clients.dhcpServer == nil { return Client{}, false } macFound := clients.dhcpServer.FindMACbyIP(ipAddr)
<mask> } <mask> } <mask> } <mask> <mask> macFound := config.dhcpServer.FindMACbyIP(ipAddr) <mask> if macFound == nil { <mask> return Client{}, false <mask> } <mask> for _, c = range clients.list { <mask> for _, id := range c.IDs { </s> * dhcp,clients: DHCP server module is passed to Clients module during initialization. </s> remove leases := config.dhcpServer.Leases() </s> add if clients.dhcpServer == nil { return } leases := clients.dhcpServer.Leases() </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) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/149fcc0f2dccbe0018122f1efa5b8977cf6ff273
home/clients.go
if clients.dhcpServer == nil { return } leases := clients.dhcpServer.Leases()
<mask> } <mask> <mask> // add clients from DHCP that have non-empty Hostname property <mask> func (clients *clientsContainer) addFromDHCP() { <mask> leases := config.dhcpServer.Leases() <mask> n := 0 <mask> for _, l := range leases { <mask> if len(l.Hostname) == 0 { <mask> continue <mask> } </s> * dhcp,clients: DHCP server module is passed to Clients module during initialization. </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 macFound := config.dhcpServer.FindMACbyIP(ipAddr) </s> add if clients.dhcpServer == nil { return Client{}, false } macFound := clients.dhcpServer.FindMACbyIP(ipAddr) </s> remove func (clients *clientsContainer) Init(objects []clientObject) { </s> add func (clients *clientsContainer) Init(objects []clientObject, dhcpServer *dhcpd.Server) { </s> remove config.clients.Init(config.Clients) </s> add config.dhcpServer = dhcpd.Create(config.DHCP) config.clients.Init(config.Clients, config.dhcpServer)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/149fcc0f2dccbe0018122f1efa5b8977cf6ff273
home/clients.go
ok, _ := clients.AddHost(l.IP.String(), l.Hostname, ClientSourceDHCP)
<mask> for _, l := range leases { <mask> if len(l.Hostname) == 0 { <mask> continue <mask> } <mask> ok, _ := config.clients.AddHost(l.IP.String(), l.Hostname, ClientSourceDHCP) <mask> if ok { <mask> n++ <mask> } <mask> } <mask> log.Debug("Added %d client aliases from DHCP", n) </s> * dhcp,clients: DHCP server module is passed to Clients module during initialization. </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 config.clients.Init(config.Clients) </s> add config.dhcpServer = dhcpd.Create(config.DHCP) config.clients.Init(config.Clients, config.dhcpServer)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/149fcc0f2dccbe0018122f1efa5b8977cf6ff273
home/clients.go
clients.Init(nil, nil)
<mask> var e error <mask> var b bool <mask> clients := clientsContainer{} <mask> <mask> clients.Init(nil) <mask> <mask> // add <mask> c = Client{ <mask> IDs: []string{"1.1.1.1", "aa:aa:aa:aa:aa:aa"}, <mask> Name: "client1", </s> * dhcp,clients: DHCP server module is passed to Clients module during initialization. </s> remove clients.Init(nil) </s> add clients.Init(nil, nil) </s> remove leases := config.dhcpServer.Leases() </s> add if clients.dhcpServer == nil { return } leases := clients.dhcpServer.Leases()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/149fcc0f2dccbe0018122f1efa5b8977cf6ff273
home/clients_test.go
clients.Init(nil, nil)
<mask> <mask> func TestClientsWhois(t *testing.T) { <mask> var c Client <mask> clients := clientsContainer{} <mask> clients.Init(nil) <mask> <mask> whois := [][]string{{"orgname", "orgname-val"}, {"country", "country-val"}} <mask> // set whois info on new client <mask> clients.SetWhoisInfo("1.1.1.255", whois) <mask> assert.True(t, clients.ipHost["1.1.1.255"].WhoisInfo[0][1] == "orgname-val") </s> * dhcp,clients: DHCP server module is passed to Clients module during initialization. </s> remove clients.Init(nil) </s> add clients.Init(nil, nil) </s> remove leases := config.dhcpServer.Leases() </s> add if clients.dhcpServer == nil { return } leases := clients.dhcpServer.Leases() </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 macFound := config.dhcpServer.FindMACbyIP(ipAddr) </s> add if clients.dhcpServer == nil { return Client{}, false } macFound := clients.dhcpServer.FindMACbyIP(ipAddr)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/149fcc0f2dccbe0018122f1efa5b8977cf6ff273
home/clients_test.go
dhcpServer *dhcpd.Server
<mask> <mask> dnsctx dnsContext <mask> dnsFilter *dnsfilter.Dnsfilter <mask> dnsServer *dnsforward.Server <mask> dhcpServer dhcpd.Server <mask> httpServer *http.Server <mask> httpsServer HTTPSServer <mask> <mask> BindHost string `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to <mask> BindPort int `yaml:"bind_port"` // BindPort is the port the HTTP server </s> * dhcp,clients: DHCP server module is passed to Clients module during initialization. </s> remove func (clients *clientsContainer) Init(objects []clientObject) { </s> add func (clients *clientsContainer) Init(objects []clientObject, dhcpServer *dhcpd.Server) { </s> remove clients.Init(nil) </s> add clients.Init(nil, nil)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/149fcc0f2dccbe0018122f1efa5b8977cf6ff273
home/config.go
if config.dhcpServer != nil { c := dhcpd.ServerConfig{} config.dhcpServer.WriteDiskConfig(&c) config.DHCP = c }
<mask> config.DNS.DnsfilterConf = c <mask> } <mask> <mask> configFile := config.getConfigFilename() <mask> log.Debug("Writing YAML file: %s", configFile) <mask> yamlText, err := yaml.Marshal(&config) <mask> config.Clients = nil <mask> if err != nil { <mask> log.Error("Couldn't generate YAML file: %s", err) </s> * dhcp,clients: DHCP server module is passed to Clients module during initialization. </s> remove config.clients.Init(config.Clients) </s> add config.dhcpServer = dhcpd.Create(config.DHCP) config.clients.Init(config.Clients, config.dhcpServer) </s> remove macFound := config.dhcpServer.FindMACbyIP(ipAddr) </s> add if clients.dhcpServer == nil { return Client{}, false } macFound := clients.dhcpServer.FindMACbyIP(ipAddr) </s> remove func (clients *clientsContainer) Init(objects []clientObject) { </s> add func (clients *clientsContainer) Init(objects []clientObject, dhcpServer *dhcpd.Server) {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/149fcc0f2dccbe0018122f1efa5b8977cf6ff273
home/config.go
"github.com/AdguardTeam/AdGuardHome/dhcpd"
<mask> "syscall" <mask> "time" <mask> <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/NYTimes/gziphandler" <mask> "github.com/gobuffalo/packr" <mask> ) <mask> </s> * dhcp,clients: DHCP server module is passed to Clients module during initialization. </s> remove config.clients.Init(config.Clients) </s> add config.dhcpServer = dhcpd.Create(config.DHCP) config.clients.Init(config.Clients, config.dhcpServer) </s> remove dhcpServer dhcpd.Server </s> add dhcpServer *dhcpd.Server </s> remove clients.Init(nil) </s> add clients.Init(nil, nil)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/149fcc0f2dccbe0018122f1efa5b8977cf6ff273
home/home.go
config.dhcpServer = dhcpd.Create(config.DHCP) config.clients.Init(config.Clients, config.dhcpServer)
<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> 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) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/149fcc0f2dccbe0018122f1efa5b8977cf6ff273
home/home.go
"example_upstream_doq": "encrypted <0>DNS-over-QUIC</0>",
<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> remove color: var(--red); </s> add color: #cd201f;
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/__locales/en.json
"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",
<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> 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';
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/__locales/en.json
<<<<<<< Updated upstream
<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> 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';
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/__locales/en.json
values.port_dns_over_quic = values.port_dns_over_quic || 0;
<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> 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';
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/actions/encryption.js
values.port_dns_over_quic = values.port_dns_over_quic || 0;
<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> 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';
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/actions/encryption.js
import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators';
<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> </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> remove color: var(--red); </s> add color: #cd201f;
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Encryption/Form.js
import { DNS_OVER_QUIC_PORT, DNS_OVER_TLS_PORT, FORM_NAME, STANDARD_HTTPS_PORT, } from '../../../helpers/constants';
<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) => { <mask> const errors = {}; <mask> <mask> if (values.port_dns_over_tls && values.port_https) { </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 color: var(--red); </s> add color: #cd201f;
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Encryption/Form.js
port_dns_over_quic: DNS_OVER_QUIC_PORT,
<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> remove import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; </s> add import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators'; </s> remove color: var(--red); </s> add color: #cd201f;
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Encryption/Form.js
port_dns_over_quic,
<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> 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> remove import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; </s> add import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators';
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Encryption/index.js
port_dns_over_quic,
<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> remove color: var(--red); </s> add color: #cd201f;
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Encryption/index.js
color: #cd201f;
<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';
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/components/Settings/Settings.css
export const DNS_OVER_QUIC_PORT = 784;
<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> 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 import { validateIsSafePort, validatePort, validatePortTLS } from '../../../helpers/validators'; </s> add import { validateIsSafePort, validatePort, validatePortQuic, validatePortTLS, } from '../../../helpers/validators';
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/helpers/constants.js
/** * @param value {number} * @returns {undefined|string} */ export const validatePortQuic = validatePortTLS;
<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> remove color: var(--red); </s> add color: #cd201f;
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14bc5297ac6cb7c6dbc74d55239eeb16c041c048
client/src/helpers/validators.js
s.processDHCPHosts,
<mask> s.processRecursion, <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 s.processInternalIPAddrs, </s> add s.processDHCPAddrs, </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
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
s.processDHCPAddrs,
<mask> s.processDDRQuery, <mask> s.processDetermineLocal, <mask> s.processInternalHosts, <mask> s.processRestrictLocal, <mask> s.processInternalIPAddrs, <mask> s.processFilteringBeforeRequest, <mask> s.processLocalPTR, <mask> s.processUpstream, <mask> s.processFilteringAfterResponse, <mask> s.ipset.process, </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 s.processInternalHosts, </s> add s.processDHCPHosts, </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
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) ip := netutil.CloneIP(l.IP)
<mask> err, <mask> ) <mask> } <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()) </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 ipToHost.Set(l.IP, lowhost) ip := make(net.IP, 4) copy(ip, l.IP.To4()) </s> add ipToHost.Set(ip, lowhost) </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "%s", addr) </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 dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> add dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
ipToHost.Set(ip, lowhost)
<mask> } <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> } <mask> <mask> log.Debug("dns: added %d A/PTR entries from DHCP", ipToHost.Len()) <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 lowhost := strings.ToLower(l.Hostname) </s> add lowhost := strings.ToLower(l.Hostname + "." + s.localDomainSuffix) ip := netutil.CloneIP(l.IP) </s> remove // don't need to be inaccessible externally. </s> add // don't need to be accessible externally. </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_localRestriction(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) { </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, }}, }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
// processDHCPHosts respond to A requests if the target hostname is known to
<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() { </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 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)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
func (s *Server) processDHCPHosts(dctx *dnsContext) (rc resultCode) {
<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> <mask> req := dctx.proxyCtx.Req </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 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 // don't need to be inaccessible externally. </s> add // don't need to be accessible externally.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
reqHost := strings.ToLower(q.Name[:len(q.Name)-1])
<mask> if q.Qtype != dns.TypeA && q.Qtype != dns.TypeAAAA { <mask> return resultCodeSuccess <mask> } <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 { <mask> return resultCodeSuccess </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 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 func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPHosts(dctx *dnsContext) (rc resultCode) { </s> remove // don't need to be inaccessible externally. </s> add // don't need to be accessible externally. </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
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
if !strings.HasSuffix(reqHost, s.localDomainSuffix) {
<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 { <mask> return resultCodeSuccess <mask> } <mask> <mask> d := dctx.proxyCtx <mask> if !dctx.isLocalClient { </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 func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPAddrs(ctx *dnsContext) (rc resultCode) { </s> remove func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) { </s> add func (s *Server) processDHCPHosts(dctx *dnsContext) (rc resultCode) { </s> remove // don't need to be inaccessible externally. </s> add // don't need to be accessible externally. </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
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
ip, ok := s.hostToIP(reqHost)
<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) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
// don't need to be accessible externally.
<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) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
func (s *Server) processDHCPAddrs(ctx *dnsContext) (rc resultCode) {
<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.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns.go
func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) {
<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, }, }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
"example." + defaultLocalDomainSuffix: knownIP,
<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)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
res := s.processDHCPHosts(dctx)
<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])
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
func TestServer_ProcessDHCPHosts(t *testing.T) {
<mask> }) <mask> } <mask> } <mask> <mask> func TestServer_ProcessInternalHosts(t *testing.T) { <mask> const ( <mask> examplecom = "example.com" <mask> examplelan = "example.lan" <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 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) { </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
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
examplelan = "example." + defaultLocalDomainSuffix
<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 { <mask> name 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 func TestServer_ProcessInternalHosts_localRestriction(t *testing.T) { </s> add func TestServer_ProcessDHCPHosts_localRestriction(t *testing.T) { </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 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, }, }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
suffix: "custom",
<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, }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
s := &Server{ dhcpServer: &testDHCP{}, localDomainSuffix: tc.suffix, tableHostToIP: hostToIPTable{ "example." + tc.suffix: knownIP, }, }
<mask> qtyp: dns.TypeA, <mask> }} <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> }, </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 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 suffix: ".custom.", </s> add suffix: "custom", </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) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
req := &dns.Msg{ MsgHdr: dns.MsgHdr{ Id: 1234, }, Question: []dns.Question{{ Name: dns.Fqdn(tc.host), Qtype: tc.qtyp, Qclass: dns.ClassINET, }}, }
<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> <mask> dctx := &dnsContext{ <mask> proxyCtx: &proxy.DNSContext{ <mask> Req: 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 dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </s> add dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, } </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 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)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
dctx := &dnsContext{ proxyCtx: &proxy.DNSContext{ Req: req, }, isLocalClient: true, }
<mask> Qclass: dns.ClassINET, <mask> }}, <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 <mask> assert.Equal(t, tc.wantRes, res) <mask> if tc.wantRes == resultCodeFinish { </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 res := s.processInternalHosts(dctx) </s> add res := s.processDHCPHosts(dctx) </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 host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) { </s> remove assert.Equal(t, "myhost.", ptr.Ptr) </s> add assert.Equal(t, dns.Fqdn("myhost."+localDomain), ptr.Ptr)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
t.Run(tc.name, func(t *testing.T) { res := s.processDHCPHosts(dctx)
<mask> }, <mask> isLocalClient: true, <mask> } <mask> <mask> res := s.processInternalHosts(dctx) <mask> pctx := dctx.proxyCtx <mask> assert.Equal(t, tc.wantRes, res) <mask> if tc.wantRes == resultCodeFinish { <mask> require.NotNil(t, pctx.Res) <mask> assert.Equal(t, dns.RcodeNameError, pctx.Res.Rcode) </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 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 assert.Equal(t, "myhost.", ptr.Ptr) </s> add assert.Equal(t, dns.Fqdn("myhost."+localDomain), ptr.Ptr) </s> remove require.NoError(t, err) </s> add require.NoErrorf(t, err, "%s", addr) </s> remove host := strings.TrimSuffix(reqHost, s.localDomainSuffix) if host == reqHost { </s> add if !strings.HasSuffix(reqHost, s.localDomainSuffix) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dns_test.go
const defaultLocalDomainSuffix = "lan"
<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)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward.go
<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])
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward.go
localDomainSuffix = p.LocalDomain
<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) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward.go
const localDomain = "lan"
<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> 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
[ "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward_test.go
LocalDomain: localDomain,
<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> 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
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward_test.go
require.NoErrorf(t, err, "%s", addr)
<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> 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,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward_test.go
assert.Equal(t, dns.Fqdn("myhost."+localDomain), ptr.Ptr)
<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, }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14d8f58592cbb192216cfe98e28e9b38e40a97c5
internal/dnsforward/dnsforward_test.go
import ar from './__locales/ar.json';
<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> remove func handleI18nCurrentLanguage(w http.ResponseWriter, r *http.Request) { </s> add func handleI18nCurrentLanguage(w http.ResponseWriter, _ *http.Request) {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14fd995ae9a4a9f8e4a56f2d0a33aadc7bc42035
client/src/i18n.js
ar: { translation: ar },
<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) {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14fd995ae9a4a9f8e4a56f2d0a33aadc7bc42035
client/src/i18n.js
"ar",
<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> remove func handleI18nCurrentLanguage(w http.ResponseWriter, r *http.Request) { </s> add func handleI18nCurrentLanguage(w http.ResponseWriter, _ *http.Request) {
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14fd995ae9a4a9f8e4a56f2d0a33aadc7bc42035
internal/home/i18n.go
func handleI18nCurrentLanguage(w http.ResponseWriter, _ *http.Request) {
<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
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14fd995ae9a4a9f8e4a56f2d0a33aadc7bc42035
internal/home/i18n.go
// InitModule() - manually initialize blocked services map func InitModule() { initBlockedServices() }
<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
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14ffd1a3f52049931b21abe4ebce5bd22ece715b
dnsfilter/dnsfilter.go
<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
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14ffd1a3f52049931b21abe4ebce5bd22ece715b
dnsfilter/dnsfilter.go
// '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()
<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
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/14ffd1a3f52049931b21abe4ebce5bd22ece715b
home/home.go
if !ok { return "", false }
<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 {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1571609e5975be22e31d3ef7336a4ac6b1f08880
internal/dnsforward/dns.go
if host, ok = v.(string); !ok {
<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
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1571609e5975be22e31d3ef7336a4ac6b1f08880
internal/dnsforward/dns.go
return host, true
<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 {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/1571609e5975be22e31d3ef7336a4ac6b1f08880
internal/dnsforward/dns.go
// ParseCipherIDs returns a set of cipher suites with the cipher names provided func ParseCipherIDs(ciphers []string) (userCiphers []uint16) {
<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> 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)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/aghtls/aghtls.go
} else { log.Error("unknown cipher : %s ", s)
<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> 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) {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/aghtls/aghtls.go
// 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:"-"`
<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> 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) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/dnsforward/config.go
tlsCiphers: getTLSCiphers(),
<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> 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> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/home.go
// 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 }
<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> 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) {
[ "keep", "keep", "keep", "add" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/home.go
<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
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
// Ciphers that are used for https listener tlsCiphers []uint16
<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> 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) {
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
<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> 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) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
<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> 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,
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
CipherSuites: web.conf.tlsCiphers,
<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
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
go web.mustStartHTTP3(addr)
<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> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
func (web *Web) mustStartHTTP3(address string) {
<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> 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
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
CipherSuites: web.conf.tlsCiphers,
<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> remove func (web *Web) mustStartHTTP3(address string, ciphers []uint16) { </s> add func (web *Web) mustStartHTTP3(address string) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15b19ff7268da689933dd369862930afc98fcc8e
internal/home/web.go
github.com/AdguardTeam/golibs v0.13.2
<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> 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))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
go.mod
github.com/AdguardTeam/golibs v0.13.2 h1:BPASsyQKmb+b8VnvsNOHp7bKfcZl9Z+Z2UhPjOiupSc= github.com/AdguardTeam/golibs v0.13.2/go.mod h1:7ylQLv2Lqsc3UW3jHoITynYk6Y1tYtgEMkR09ppfsN8=
<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))
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
go.sum
"github.com/AdguardTeam/golibs/httphdr"
<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> remove import "net/http" </s> add import ( "net/http" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/golibs/httphdr" ) </s> remove w.Header().Set("Content-Type", "application/xml") </s> add w.Header().Set(httphdr.ContentType, "application/xml")
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/aghhttp/aghhttp.go
if r.Header.Get(httphdr.ContentType) != HdrValTextPlain {
<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())
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/aghhttp/aghhttp.go
w.Header().Set(httphdr.ContentType, HdrValApplicationJSON)
<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, "/")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/aghhttp/aghhttp.go
// HTTP headers
<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> 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" )
[ "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/aghhttp/header.go
"github.com/AdguardTeam/golibs/httphdr"
<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
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/dnsforward/http_test.go
cType := w.Header().Get(httphdr.ContentType)
<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)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/dnsforward/http_test.go
"github.com/AdguardTeam/golibs/httphdr"
<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
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
httphdr.CFConnectingIP, httphdr.TrueClientIP, httphdr.XRealIP,
<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)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
s := r.Header.Get(httphdr.XForwardedFor)
<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")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
w.Header().Set(httphdr.RetryAfter, strconv.Itoa(int(left.Seconds())))
<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)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
h.Set(httphdr.CacheControl, "no-store, no-cache, must-revalidate, proxy-revalidate") h.Set(httphdr.Pragma, "no-cache") h.Set(httphdr.Expires, "0")
<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,
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
respHdr.Set(httphdr.Location, "/login.html")
<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)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
respHdr.Set(httphdr.Location, "/login.html") respHdr.Set(httphdr.SetCookie, c.String())
<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())
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
w.Header().Set(httphdr.Location, "/login.html")
<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)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
w.Header().Set(httphdr.Location, "/")
<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)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth.go
"github.com/AdguardTeam/golibs/httphdr"
<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
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
assert.NotEmpty(t, w.hdr.Get(httphdr.Location))
<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") <mask> r.URL = &url.URL{Path: loginURL} </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 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> 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())
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
loginURL := w.hdr.Get(httphdr.Location)
<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") <mask> r.URL = &url.URL{Path: loginURL} <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 assert.NotEmpty(t, w.hdr.Get("Location")) </s> add assert.NotEmpty(t, 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> 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", "bad") </s> add r.Header.Set(httphdr.Cookie, "bad")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
r.Header.Set(httphdr.Cookie, cookie.String())
<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))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
r.Header.Del(httphdr.Cookie)
<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)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
r.Header.Del(httphdr.Authorization)
<mask> r.SetBasicAuth("name", "password") <mask> handlerCalled = false <mask> handler2(&w, &r) <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()) </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", 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.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
r.Header.Set(httphdr.Cookie, cookie.String())
<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 <mask> handler2(&w, &r) <mask> assert.NotEmpty(t, w.hdr.Get("Location")) <mask> assert.False(t, handlerCalled) </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 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.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())
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
assert.NotEmpty(t, w.hdr.Get(httphdr.Location))
<mask> r.Header.Set("Cookie", cookie.String()) <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> <mask> // get login page with an invalid cookie <mask> handler2 = optionalAuth(handler) </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", "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 loginURL := w.hdr.Get("Location") </s> add loginURL := w.hdr.Get(httphdr.Location)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
r.Header.Del(httphdr.Cookie)
<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> <mask> // get login page with an invalid cookie <mask> handler2 = optionalAuth(handler) <mask> w.hdr = make(http.Header) <mask> r.Header.Set("Cookie", "bad") </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 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("Authorization") </s> add r.Header.Del(httphdr.Authorization) </s> remove r.Header.Del("Cookie") </s> add r.Header.Del(httphdr.Cookie)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go
r.Header.Set(httphdr.Cookie, "bad")
<mask> <mask> // get login page with an invalid cookie <mask> handler2 = optionalAuth(handler) <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") </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 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.Del("Authorization") </s> add r.Header.Del(httphdr.Authorization)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/15bba281ee36ff9af69aced1068a9fc6925a0a6b
internal/home/auth_test.go