docstring_tokens
stringlengths
18
16.9k
code_tokens
stringlengths
75
1.81M
html_url
stringlengths
74
116
file_name
stringlengths
3
311
keep keep keep keep replace replace keep keep keep keep keep
<mask> // TTL for a web session (in hours) <mask> // An active session is automatically refreshed once a day. <mask> WebSessionTTLHours uint32 `yaml:"web_session_ttl"` <mask> <mask> DNS dnsConfig `yaml:"dns"` <mask> TLS tlsConfigSettings `yaml:"tls"` <mask> <mask> // Filters reflects the filters from [filtering.Config]. It's cloned to the <mask> // config used in the filtering module at the startup. Afterwards it's <mask> // cloned from the filtering module back here. <mask> // </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add // // TODO(s.chzhen): Add lowercased, non-FQDN version of the hostname from the // question of the request. </s> remove // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` </s> add </s> remove // Add implements the querylog.QueryLog interface for *testQueryLog. </s> add // Add implements the [querylog.QueryLog] interface for *testQueryLog. </s> add // ShouldLog implements the [querylog.QueryLog] interface for *testQueryLog. func (l *testQueryLog) ShouldLog(string, uint16, uint16) bool { return true } </s> add // Ignored is the list of host names, which are should not be written // to log. Ignored *stringutil.Set </s> add QueryLog: queryLogConfig{ Enabled: true, FileEnabled: true, Interval: timeutil.Duration{Duration: 90 * timeutil.Day}, MemSize: 1000, Ignored: []string{}, },
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/config.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> // StatsInterval is the time interval for flushing statistics to the disk in <mask> // days. <mask> StatsInterval uint32 `yaml:"statistics_interval"` <mask> <mask> // QueryLogEnabled defines if the query log is enabled. <mask> QueryLogEnabled bool `yaml:"querylog_enabled"` <mask> // QueryLogFileEnabled defines, if the query log is written to the file. <mask> QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` <mask> // QueryLogInterval is the interval for query log's files rotation. <mask> QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` <mask> // QueryLogMemSize is the number of entries kept in memory before they are <mask> // flushed to disk. <mask> QueryLogMemSize uint32 `yaml:"querylog_size_memory"` <mask> <mask> // AnonymizeClientIP defines if clients' IP addresses should be anonymized <mask> // in query log and statistics. <mask> AnonymizeClientIP bool `yaml:"anonymize_client_ip"` <mask> <mask> dnsforward.FilteringConfig `yaml:",inline"` </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add // Ignored is the list of host names, which are should not be written // to log. Ignored *stringutil.Set </s> add // ShouldLog returns true if request for the host should be logged. ShouldLog(host string, qType, qClass uint16) bool </s> add // ShouldLog returns true if request for the host should be logged. func (l *queryLog) ShouldLog(host string, _, _ uint16) bool { return !l.isIgnored(host) } // isIgnored returns true if the host is in the Ignored list. func (l *queryLog) isIgnored(host string) bool { return l.conf.Ignored.Has(host) } </s> remove DNS dnsConfig `yaml:"dns"` TLS tlsConfigSettings `yaml:"tls"` </s> add DNS dnsConfig `yaml:"dns"` TLS tlsConfigSettings `yaml:"tls"` QueryLog queryLogConfig `yaml:"querylog"` </s> add // // TODO(s.chzhen): Add lowercased, non-FQDN version of the hostname from the // question of the request. </s> add // ShouldLog implements the [querylog.QueryLog] interface for *testQueryLog. func (l *testQueryLog) ShouldLog(string, uint16, uint16) bool { return true }
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/config.go
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
<mask> AuthAttempts: 5, <mask> AuthBlockMin: 15, <mask> WebSessionTTLHours: 30 * 24, <mask> DNS: dnsConfig{ <mask> BindHosts: []netip.Addr{netip.IPv4Unspecified()}, <mask> Port: defaultPortDNS, <mask> StatsInterval: 1, <mask> QueryLogEnabled: true, <mask> QueryLogFileEnabled: true, <mask> QueryLogInterval: timeutil.Duration{Duration: 90 * timeutil.Day}, <mask> QueryLogMemSize: 1000, <mask> FilteringConfig: dnsforward.FilteringConfig{ <mask> ProtectionEnabled: true, // whether or not use any of filtering features <mask> BlockingMode: dnsforward.BlockingModeDefault, <mask> BlockedResponseTTL: 10, // in seconds <mask> Ratelimit: 20, </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add QueryLog: queryLogConfig{ Enabled: true, FileEnabled: true, Interval: timeutil.Duration{Duration: 90 * timeutil.Day}, MemSize: 1000, Ignored: []string{}, }, </s> add // // TODO(s.chzhen): Add lowercased, non-FQDN version of the hostname from the // question of the request. </s> remove DNS dnsConfig `yaml:"dns"` TLS tlsConfigSettings `yaml:"tls"` </s> add DNS dnsConfig `yaml:"dns"` TLS tlsConfigSettings `yaml:"tls"` QueryLog queryLogConfig `yaml:"querylog"` </s> add // Ignored is the list of host names, which are should not be written // to log. Ignored *stringutil.Set </s> remove // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` </s> add </s> remove if shouldLog && s.queryLog != nil { </s> add if shouldLog && s.queryLog != nil && s.queryLog.ShouldLog(host, q.Qtype, q.Qclass) {
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/config.go
keep keep keep add keep keep keep keep keep keep
<mask> PortHTTPS: defaultPortHTTPS, <mask> PortDNSOverTLS: defaultPortTLS, // needs to be passed through to dnsproxy <mask> PortDNSOverQUIC: defaultPortQUIC, <mask> }, <mask> // NOTE: Keep these parameters in sync with the one put into <mask> // client/src/helpers/filters/filters.js by scripts/vetted-filters. <mask> // <mask> // TODO(a.garipov): Think of a way to make scripts/vetted-filters update <mask> // these as well if necessary. <mask> Filters: []filtering.FilterYAML{{ </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add // Ignored is the list of host names, which are should not be written // to log. Ignored *stringutil.Set </s> remove // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` </s> add </s> remove // a querylog.QueryLog without actually implementing all methods. </s> add // a [querylog.QueryLog] without actually implementing all methods. </s> remove // testQueryLog is a simple querylog.QueryLog implementation for tests. </s> add // testQueryLog is a simple [querylog.QueryLog] implementation for tests. </s> remove DNS dnsConfig `yaml:"dns"` TLS tlsConfigSettings `yaml:"tls"` </s> add DNS dnsConfig `yaml:"dns"` TLS tlsConfigSettings `yaml:"tls"` QueryLog queryLogConfig `yaml:"querylog"` </s> add // ShouldLog implements the [querylog.QueryLog] interface for *testQueryLog. func (l *testQueryLog) ShouldLog(string, uint16, uint16) bool { return true }
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/config.go
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> <mask> if Context.queryLog != nil { <mask> dc := querylog.Config{} <mask> Context.queryLog.WriteDiskConfig(&dc) <mask> config.DNS.QueryLogEnabled = dc.Enabled <mask> config.DNS.QueryLogFileEnabled = dc.FileEnabled <mask> config.DNS.QueryLogInterval = timeutil.Duration{Duration: dc.RotationIvl} <mask> config.DNS.QueryLogMemSize = dc.MemSize <mask> config.DNS.AnonymizeClientIP = dc.AnonymizeClientIP <mask> } <mask> <mask> if Context.filters != nil { <mask> Context.filters.WriteDiskConfig(config.DNS.DnsfilterConf) </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add config.QueryLog.Enabled = dc.Enabled config.QueryLog.FileEnabled = dc.FileEnabled config.QueryLog.Interval = timeutil.Duration{Duration: dc.RotationIvl} config.QueryLog.MemSize = dc.MemSize config.QueryLog.Ignored = dc.Ignored.Values() sort.Strings(config.QueryLog.Ignored) </s> add RotationIvl: config.QueryLog.Interval.Duration, MemSize: config.QueryLog.MemSize, Enabled: config.QueryLog.Enabled, FileEnabled: config.QueryLog.FileEnabled, Ignored: stringutil.NewSet(), } for _, v := range config.QueryLog.Ignored { host := strings.ToLower(strings.TrimSuffix(v, ".")) if conf.Ignored.Has(host) { return fmt.Errorf("duplicate ignored host %s", host) } conf.Ignored.Add(host) </s> add if l.isIgnored(e.QHost) { return nil, ts, nil } </s> add } else { log.Debug("request for %s from %s ignored; not logging", host, ip) </s> remove if shouldLog && s.queryLog != nil { </s> add if shouldLog && s.queryLog != nil && s.queryLog.ShouldLog(host, q.Qtype, q.Qclass) { </s> remove if len(msg.Question) >= 1 && msg.Question[0].Qtype == dns.TypeANY && s.conf.RefuseAny { </s> add if q.Qtype == dns.TypeANY && s.conf.RefuseAny {
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/config.go
keep add keep keep keep keep keep
<mask> Context.queryLog.WriteDiskConfig(&dc) <mask> config.DNS.AnonymizeClientIP = dc.AnonymizeClientIP <mask> } <mask> <mask> if Context.filters != nil { <mask> Context.filters.WriteDiskConfig(config.DNS.DnsfilterConf) <mask> config.Filters = config.DNS.DnsfilterConf.Filters </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> remove config.DNS.QueryLogEnabled = dc.Enabled config.DNS.QueryLogFileEnabled = dc.FileEnabled config.DNS.QueryLogInterval = timeutil.Duration{Duration: dc.RotationIvl} config.DNS.QueryLogMemSize = dc.MemSize </s> add </s> add if l.isIgnored(e.QHost) { return nil, ts, nil } </s> add } else { log.Debug("request for %s from %s ignored; not logging", host, ip) </s> add RotationIvl: config.QueryLog.Interval.Duration, MemSize: config.QueryLog.MemSize, Enabled: config.QueryLog.Enabled, FileEnabled: config.QueryLog.FileEnabled, Ignored: stringutil.NewSet(), } for _, v := range config.QueryLog.Ignored { host := strings.ToLower(strings.TrimSuffix(v, ".")) if conf.Ignored.Has(host) { return fmt.Errorf("duplicate ignored host %s", host) } conf.Ignored.Add(host) </s> remove if shouldLog && s.queryLog != nil { </s> add if shouldLog && s.queryLog != nil && s.queryLog.ShouldLog(host, q.Qtype, q.Qclass) { </s> remove if len(msg.Question) >= 1 && msg.Question[0].Qtype == dns.TypeANY && s.conf.RefuseAny { </s> add if q.Qtype == dns.TypeANY && s.conf.RefuseAny {
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/config.go
keep keep add keep keep keep keep
<mask> "net/url" <mask> "os" <mask> "path/filepath" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghalg" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add "sort" </s> add "github.com/AdguardTeam/golibs/stringutil" </s> add if l.isIgnored(e.QHost) { return nil, ts, nil } </s> remove BindHosts: []netip.Addr{netip.IPv4Unspecified()}, Port: defaultPortDNS, StatsInterval: 1, QueryLogEnabled: true, QueryLogFileEnabled: true, QueryLogInterval: timeutil.Duration{Duration: 90 * timeutil.Day}, QueryLogMemSize: 1000, </s> add BindHosts: []netip.Addr{netip.IPv4Unspecified()}, Port: defaultPortDNS, StatsInterval: 1, </s> add q := msg.Question[0] host := strings.ToLower(strings.TrimSuffix(q.Name, ".")) </s> remove if len(msg.Question) >= 1 && msg.Question[0].Qtype == dns.TypeANY && s.conf.RefuseAny { </s> add if q.Qtype == dns.TypeANY && s.conf.RefuseAny {
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/dns.go
keep keep add keep keep keep keep keep
<mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/ameshkov/dnscrypt/v2" <mask> yaml "gopkg.in/yaml.v3" <mask> ) <mask> <mask> // Default ports. </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add "github.com/AdguardTeam/golibs/stringutil" </s> remove const currentSchemaVersion = 14 </s> add const currentSchemaVersion = 15 </s> remove // testQueryLog is a simple querylog.QueryLog implementation for tests. </s> add // testQueryLog is a simple [querylog.QueryLog] implementation for tests. </s> add "github.com/AdguardTeam/golibs/stringutil" </s> add // // TODO(s.chzhen): Add lowercased, non-FQDN version of the hostname from the // question of the request. </s> remove // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/dns.go
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> ConfigModified: onConfigModified, <mask> HTTPRegister: httpRegister, <mask> FindClient: Context.clients.findMultiple, <mask> BaseDir: baseDir, <mask> RotationIvl: config.DNS.QueryLogInterval.Duration, <mask> MemSize: config.DNS.QueryLogMemSize, <mask> Enabled: config.DNS.QueryLogEnabled, <mask> FileEnabled: config.DNS.QueryLogFileEnabled, <mask> AnonymizeClientIP: config.DNS.AnonymizeClientIP, <mask> } <mask> Context.queryLog = querylog.New(conf) <mask> <mask> Context.filters, err = filtering.New(config.DNS.DnsfilterConf, nil) </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add RotationIvl: config.QueryLog.Interval.Duration, MemSize: config.QueryLog.MemSize, Enabled: config.QueryLog.Enabled, FileEnabled: config.QueryLog.FileEnabled, Ignored: stringutil.NewSet(), } for _, v := range config.QueryLog.Ignored { host := strings.ToLower(strings.TrimSuffix(v, ".")) if conf.Ignored.Has(host) { return fmt.Errorf("duplicate ignored host %s", host) } conf.Ignored.Add(host) </s> add if l.isIgnored(e.QHost) { return nil, ts, nil } </s> add QueryLog: queryLogConfig{ Enabled: true, FileEnabled: true, Interval: timeutil.Duration{Duration: 90 * timeutil.Day}, MemSize: 1000, Ignored: []string{}, }, </s> remove config.DNS.QueryLogEnabled = dc.Enabled config.DNS.QueryLogFileEnabled = dc.FileEnabled config.DNS.QueryLogInterval = timeutil.Duration{Duration: dc.RotationIvl} config.DNS.QueryLogMemSize = dc.MemSize </s> add </s> add config.QueryLog.Enabled = dc.Enabled config.QueryLog.FileEnabled = dc.FileEnabled config.QueryLog.Interval = timeutil.Duration{Duration: dc.RotationIvl} config.QueryLog.MemSize = dc.MemSize config.QueryLog.Ignored = dc.Ignored.Values() sort.Strings(config.QueryLog.Ignored) </s> add // ShouldLog returns true if request for the host should be logged. func (l *queryLog) ShouldLog(host string, _, _ uint16) bool { return !l.isIgnored(host) } // isIgnored returns true if the host is in the Ignored list. func (l *queryLog) isIgnored(host string) bool { return l.conf.Ignored.Has(host) }
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/dns.go
keep keep add keep keep keep keep keep
<mask> FindClient: Context.clients.findMultiple, <mask> BaseDir: baseDir, <mask> AnonymizeClientIP: config.DNS.AnonymizeClientIP, <mask> } <mask> Context.queryLog = querylog.New(conf) <mask> <mask> Context.filters, err = filtering.New(config.DNS.DnsfilterConf, nil) <mask> if err != nil { </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> remove RotationIvl: config.DNS.QueryLogInterval.Duration, MemSize: config.DNS.QueryLogMemSize, Enabled: config.DNS.QueryLogEnabled, FileEnabled: config.DNS.QueryLogFileEnabled, </s> add </s> add if l.isIgnored(e.QHost) { return nil, ts, nil } </s> remove config.DNS.QueryLogEnabled = dc.Enabled config.DNS.QueryLogFileEnabled = dc.FileEnabled config.DNS.QueryLogInterval = timeutil.Duration{Duration: dc.RotationIvl} config.DNS.QueryLogMemSize = dc.MemSize </s> add </s> add config.QueryLog.Enabled = dc.Enabled config.QueryLog.FileEnabled = dc.FileEnabled config.QueryLog.Interval = timeutil.Duration{Duration: dc.RotationIvl} config.QueryLog.MemSize = dc.MemSize config.QueryLog.Ignored = dc.Ignored.Values() sort.Strings(config.QueryLog.Ignored) </s> add } else { log.Debug("request for %s from %s ignored; not logging", host, ip) </s> remove if shouldLog && s.queryLog != nil { </s> add if shouldLog && s.queryLog != nil && s.queryLog.ShouldLog(host, q.Qtype, q.Qclass) {
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/dns.go
keep keep keep keep replace keep keep keep keep keep
<mask> yaml "gopkg.in/yaml.v3" <mask> ) <mask> <mask> // currentSchemaVersion is the current schema version. <mask> const currentSchemaVersion = 14 <mask> <mask> // These aliases are provided for convenience. <mask> type ( <mask> yarr = []any <mask> yobj = map[string]any </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add "github.com/AdguardTeam/golibs/stringutil" </s> add // // TODO(s.chzhen): Add lowercased, non-FQDN version of the hostname from the // question of the request. </s> add // Ignored is the list of host names, which are should not be written // to log. Ignored *stringutil.Set </s> remove // testQueryLog is a simple querylog.QueryLog implementation for tests. </s> add // testQueryLog is a simple [querylog.QueryLog] implementation for tests. </s> add // ShouldLog implements the [querylog.QueryLog] interface for *testQueryLog. func (l *testQueryLog) ShouldLog(string, uint16, uint16) bool { return true } </s> remove // Add implements the querylog.QueryLog interface for *testQueryLog. </s> add // Add implements the [querylog.QueryLog] interface for *testQueryLog.
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/upgrade.go
keep add keep keep keep keep
<mask> upgradeSchema12to13, <mask> upgradeSchema13to14, <mask> } <mask> <mask> n := 0 <mask> for i, u := range upgrades { </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add RotationIvl: config.QueryLog.Interval.Duration, MemSize: config.QueryLog.MemSize, Enabled: config.QueryLog.Enabled, FileEnabled: config.QueryLog.FileEnabled, Ignored: stringutil.NewSet(), } for _, v := range config.QueryLog.Ignored { host := strings.ToLower(strings.TrimSuffix(v, ".")) if conf.Ignored.Has(host) { return fmt.Errorf("duplicate ignored host %s", host) } conf.Ignored.Add(host) </s> add q := msg.Question[0] host := strings.ToLower(strings.TrimSuffix(q.Name, ".")) </s> remove if len(msg.Question) >= 1 && msg.Question[0].Qtype == dns.TypeANY && s.conf.RefuseAny { </s> add if q.Qtype == dns.TypeANY && s.conf.RefuseAny { </s> remove config.DNS.QueryLogEnabled = dc.Enabled config.DNS.QueryLogFileEnabled = dc.FileEnabled config.DNS.QueryLogInterval = timeutil.Duration{Duration: dc.RotationIvl} config.DNS.QueryLogMemSize = dc.MemSize </s> add </s> add } else { log.Debug("request for %s from %s ignored; not logging", host, ip) </s> remove // Add implements the querylog.QueryLog interface for *testQueryLog. </s> add // Add implements the [querylog.QueryLog] interface for *testQueryLog.
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/home/upgrade.go
keep keep keep add
<mask> _ = l.flushLogBuffer(false) <mask> }() <mask> } <mask> } </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> remove if len(msg.Question) >= 1 && msg.Question[0].Qtype == dns.TypeANY && s.conf.RefuseAny { </s> add if q.Qtype == dns.TypeANY && s.conf.RefuseAny { </s> add RotationIvl: config.QueryLog.Interval.Duration, MemSize: config.QueryLog.MemSize, Enabled: config.QueryLog.Enabled, FileEnabled: config.QueryLog.FileEnabled, Ignored: stringutil.NewSet(), } for _, v := range config.QueryLog.Ignored { host := strings.ToLower(strings.TrimSuffix(v, ".")) if conf.Ignored.Has(host) { return fmt.Errorf("duplicate ignored host %s", host) } conf.Ignored.Add(host) </s> add config.QueryLog.Enabled = dc.Enabled config.QueryLog.FileEnabled = dc.FileEnabled config.QueryLog.Interval = timeutil.Duration{Duration: dc.RotationIvl} config.QueryLog.MemSize = dc.MemSize config.QueryLog.Ignored = dc.Ignored.Values() sort.Strings(config.QueryLog.Ignored) </s> remove // Add implements the querylog.QueryLog interface for *testQueryLog. </s> add // Add implements the [querylog.QueryLog] interface for *testQueryLog. </s> remove config.DNS.QueryLogEnabled = dc.Enabled config.DNS.QueryLogFileEnabled = dc.FileEnabled config.DNS.QueryLogInterval = timeutil.Duration{Duration: dc.RotationIvl} config.DNS.QueryLogMemSize = dc.MemSize </s> add </s> remove RotationIvl: config.DNS.QueryLogInterval.Duration, MemSize: config.DNS.QueryLogMemSize, Enabled: config.DNS.QueryLogEnabled, FileEnabled: config.DNS.QueryLogFileEnabled, </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/querylog/qlog.go
keep keep keep add keep keep keep keep keep keep
<mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/dnsproxy/proxyutil" <mask> "github.com/AdguardTeam/golibs/testutil" <mask> "github.com/AdguardTeam/golibs/timeutil" <mask> "github.com/miekg/dns" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> ) </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add "github.com/AdguardTeam/golibs/stringutil" </s> remove // testQueryLog is a simple querylog.QueryLog implementation for tests. </s> add // testQueryLog is a simple [querylog.QueryLog] implementation for tests. </s> add "github.com/AdguardTeam/golibs/stringutil" </s> remove const currentSchemaVersion = 14 </s> add const currentSchemaVersion = 15 </s> add if l.isIgnored(e.QHost) { return nil, ts, nil } </s> remove // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/querylog/qlog_test.go
keep keep keep add keep keep keep keep keep keep
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet" <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/timeutil" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> // QueryLog - main interface <mask> type QueryLog interface { </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add "github.com/AdguardTeam/golibs/stringutil" </s> add "github.com/AdguardTeam/golibs/stringutil" </s> remove // Add implements the querylog.QueryLog interface for *testQueryLog. </s> add // Add implements the [querylog.QueryLog] interface for *testQueryLog. </s> remove // testQueryLog is a simple querylog.QueryLog implementation for tests. </s> add // testQueryLog is a simple [querylog.QueryLog] implementation for tests. </s> add // ShouldLog implements the [querylog.QueryLog] interface for *testQueryLog. func (l *testQueryLog) ShouldLog(string, uint16, uint16) bool { return true } </s> remove // a querylog.QueryLog without actually implementing all methods. </s> add // a [querylog.QueryLog] without actually implementing all methods.
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/querylog/querylog.go
keep keep add keep keep keep keep keep keep
<mask> <mask> // WriteDiskConfig - write configuration <mask> WriteDiskConfig(c *Config) <mask> } <mask> <mask> // Config is the query log configuration structure. <mask> type Config struct { <mask> // Anonymizer processes the IP addresses to anonymize those if needed. <mask> Anonymizer *aghnet.IPMut </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add // Ignored is the list of host names, which are should not be written // to log. Ignored *stringutil.Set </s> remove // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` </s> add </s> add // ShouldLog implements the [querylog.QueryLog] interface for *testQueryLog. func (l *testQueryLog) ShouldLog(string, uint16, uint16) bool { return true } </s> add // // TODO(s.chzhen): Add lowercased, non-FQDN version of the hostname from the // question of the request. </s> remove // a querylog.QueryLog without actually implementing all methods. </s> add // a [querylog.QueryLog] without actually implementing all methods. </s> add "github.com/AdguardTeam/golibs/stringutil"
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/querylog/querylog.go
keep keep add keep keep keep keep keep
<mask> // AnonymizeClientIP tells if the query log should anonymize clients' IP <mask> // addresses. <mask> AnonymizeClientIP bool <mask> } <mask> <mask> // AddParams is the parameters for adding an entry. <mask> type AddParams struct { <mask> Question *dns.Msg </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> remove // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` </s> add </s> add // ShouldLog returns true if request for the host should be logged. ShouldLog(host string, qType, qClass uint16) bool </s> add // ShouldLog returns true if request for the host should be logged. func (l *queryLog) ShouldLog(host string, _, _ uint16) bool { return !l.isIgnored(host) } // isIgnored returns true if the host is in the Ignored list. func (l *queryLog) isIgnored(host string) bool { return l.conf.Ignored.Has(host) } </s> add // ShouldLog implements the [querylog.QueryLog] interface for *testQueryLog. func (l *testQueryLog) ShouldLog(string, uint16, uint16) bool { return true } </s> add // // TODO(s.chzhen): Add lowercased, non-FQDN version of the hostname from the // question of the request. </s> remove // Add implements the querylog.QueryLog interface for *testQueryLog. </s> add // Add implements the [querylog.QueryLog] interface for *testQueryLog.
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/querylog/querylog.go
keep keep keep add keep keep keep keep
<mask> <mask> e = &logEntry{} <mask> decodeLogEntry(e, line) <mask> <mask> e.client, err = l.client(e.ClientID, e.IP.String(), cache) <mask> if err != nil { <mask> log.Error( <mask> "querylog: enriching file record at time %s for client %q (clientid %q): %s", </s> Pull request 1727: 4299-querylog-ignore Merge in DNS/adguard-home from 4299-querylog-ignore to master Squashed commit of the following: commit 06f32fef860d63dc2af9aad8d4251918c5babd00 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 17:14:26 2023 +0300 add debug msg commit 48fc9cf90bcb5baec4b9a7949b5be00055ad0955 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:30:06 2023 +0300 add line break commit a96fe712b6e5c6a190a92b2f83ed031a85658e58 Merge: d1035219 b8d55eaf Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:12:32 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit d1035219e15e5b5639b2fc39e0b17cfc05904722 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 16:11:03 2023 +0300 fix docs commit caea5dcdf3e2ca8fe2d54cb1463226bb791470f8 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 15:30:16 2023 +0300 fix issue link commit f6e3d122404e1363dd6dd7fa0221e8ce321354e9 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 14:34:11 2023 +0300 all: add issues links commit 52f77188f1c3a93494585ca8a3ea16e373a8b5c6 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 13:11:58 2023 +0300 all: add log message commit a40a0c87937abb778e4e632a5403543371b6d2e0 Merge: 87fd71ba b31bab59 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:16:08 2023 +0300 Merge branch 'master' into 4299-querylog-ignore commit 87fd71ba01588f798ba944a75e6585ebdc4aa1f7 Author: Stanislav Chzhen <[email protected]> Date: Tue Feb 7 12:13:44 2023 +0300 all: add todo commit c0c2ea08d36f25003c709eb2c190a147c47c2e0c Author: Stanislav Chzhen <[email protected]> Date: Mon Feb 6 13:27:24 2023 +0300 all: add changelog commit 8d227b684794e306e314d8cb848fe354d4578607 Author: Stanislav Chzhen <[email protected]> Date: Fri Feb 3 16:06:43 2023 +0300 all: querylog ignore </s> add RotationIvl: config.QueryLog.Interval.Duration, MemSize: config.QueryLog.MemSize, Enabled: config.QueryLog.Enabled, FileEnabled: config.QueryLog.FileEnabled, Ignored: stringutil.NewSet(), } for _, v := range config.QueryLog.Ignored { host := strings.ToLower(strings.TrimSuffix(v, ".")) if conf.Ignored.Has(host) { return fmt.Errorf("duplicate ignored host %s", host) } conf.Ignored.Add(host) </s> add } else { log.Debug("request for %s from %s ignored; not logging", host, ip) </s> remove config.DNS.QueryLogEnabled = dc.Enabled config.DNS.QueryLogFileEnabled = dc.FileEnabled config.DNS.QueryLogInterval = timeutil.Duration{Duration: dc.RotationIvl} config.DNS.QueryLogMemSize = dc.MemSize </s> add </s> remove RotationIvl: config.DNS.QueryLogInterval.Duration, MemSize: config.DNS.QueryLogMemSize, Enabled: config.DNS.QueryLogEnabled, FileEnabled: config.DNS.QueryLogFileEnabled, </s> add </s> add config.QueryLog.Enabled = dc.Enabled config.QueryLog.FileEnabled = dc.FileEnabled config.QueryLog.Interval = timeutil.Duration{Duration: dc.RotationIvl} config.QueryLog.MemSize = dc.MemSize config.QueryLog.Ignored = dc.Ignored.Values() sort.Strings(config.QueryLog.Ignored) </s> remove if shouldLog && s.queryLog != nil { </s> add if shouldLog && s.queryLog != nil && s.queryLog.ShouldLog(host, q.Qtype, q.Qclass) {
https://github.com/AdguardTeam/AdGuardHome/commit/4baa6e699068d1aca2f11a88ebfb9094e6b218b3
internal/querylog/search.go
keep keep keep add keep keep keep keep keep
<mask> // processes both A/AAAA and PTR DNS requests for those. <mask> type HostsContainer struct { <mask> // requestMatcher matches the requests and translates the rules. It's <mask> // embedded to implement MatchRequest and Translate for *HostsContainer. <mask> requestMatcher <mask> <mask> // done is the channel to sign closing the container. <mask> done chan struct{} <mask> </s> Pull request: aghnet: do not turn bad etc/hosts entries into rules Updates #3946. Squashed commit of the following: commit 5d632dc4c49325308570adbfbc0fe333528989b5 Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:49:51 2021 +0300 aghnet: imp code commit 4da620ee625718f5cd7549277c483631f22b977b Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:33:39 2021 +0300 aghnet: do not turn bad etc/hosts entries into rules </s> remove // listID is the identifier for the list of generated rules. listID int </s> add </s> add // listID is the identifier for the list of generated rules. listID int </s> remove switch hashIdx := strings.IndexByte(f, '#'); hashIdx { case -1: hosts = append(hosts, f) </s> add hashIdx := strings.IndexByte(f, '#') if hashIdx == 0 { // The rest of the fields are a part of the comment so return. break } else if hashIdx > 0 { // Only a part of the field is a comment. f = f[:hashIdx] } // Make sure that invalid hosts aren't turned into rules. // // See https://github.com/AdguardTeam/AdGuardHome/issues/3946. err := netutil.ValidateDomainName(f) if err != nil { log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f) </s> remove case 0: // Go on. default: // Only a part of the field is a comment. hosts = append(hosts, f[:hashIdx]) </s> add </s> remove // The rest of the fields are a part of the comment so skip // immediately. break </s> add hosts = append(hosts, f) </s> remove if ip == nil { </s> add if ip == nil || len(hosts) == 0 {
https://github.com/AdguardTeam/AdGuardHome/commit/4be69d35eb276266b846a8a01481894f35d244dd
internal/aghnet/hostscontainer.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> // requestMatcher matches the requests and translates the rules. It's <mask> // embedded to implement MatchRequest and Translate for *HostsContainer. <mask> requestMatcher <mask> <mask> // listID is the identifier for the list of generated rules. <mask> listID int <mask> <mask> // done is the channel to sign closing the container. <mask> done chan struct{} <mask> <mask> // updates is the channel for receiving updated hosts. <mask> updates chan *netutil.IPMap </s> Pull request: aghnet: do not turn bad etc/hosts entries into rules Updates #3946. Squashed commit of the following: commit 5d632dc4c49325308570adbfbc0fe333528989b5 Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:49:51 2021 +0300 aghnet: imp code commit 4da620ee625718f5cd7549277c483631f22b977b Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:33:39 2021 +0300 aghnet: do not turn bad etc/hosts entries into rules </s> add // // TODO(a.garipov, e.burkov): Consider fully merging into HostsContainer. </s> add // listID is the identifier for the list of generated rules. listID int </s> remove case 0: // Go on. default: // Only a part of the field is a comment. hosts = append(hosts, f[:hashIdx]) </s> add </s> remove // The rest of the fields are a part of the comment so skip // immediately. break </s> add hosts = append(hosts, f) </s> remove switch hashIdx := strings.IndexByte(f, '#'); hashIdx { case -1: hosts = append(hosts, f) </s> add hashIdx := strings.IndexByte(f, '#') if hashIdx == 0 { // The rest of the fields are a part of the comment so return. break } else if hashIdx > 0 { // Only a part of the field is a comment. f = f[:hashIdx] } // Make sure that invalid hosts aren't turned into rules. // // See https://github.com/AdguardTeam/AdGuardHome/issues/3946. err := netutil.ValidateDomainName(f) if err != nil { log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f) </s> add # See https://github.com/AdguardTeam/AdGuardHome/issues/3946. 1.0.0.3 * 1.0.0.4 *.com
https://github.com/AdguardTeam/AdGuardHome/commit/4be69d35eb276266b846a8a01481894f35d244dd
internal/aghnet/hostscontainer.go
keep keep keep add keep keep keep keep keep
<mask> w aghos.FSWatcher <mask> <mask> // patterns stores specified paths in the fs.Glob-compatible form. <mask> patterns []string <mask> } <mask> <mask> // ErrNoHostsPaths is returned when there are no valid paths to watch passed to <mask> // the HostsContainer. <mask> const ErrNoHostsPaths errors.Error = "no valid paths to hosts files provided" </s> Pull request: aghnet: do not turn bad etc/hosts entries into rules Updates #3946. Squashed commit of the following: commit 5d632dc4c49325308570adbfbc0fe333528989b5 Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:49:51 2021 +0300 aghnet: imp code commit 4da620ee625718f5cd7549277c483631f22b977b Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:33:39 2021 +0300 aghnet: do not turn bad etc/hosts entries into rules </s> add // // TODO(a.garipov, e.burkov): Consider fully merging into HostsContainer. </s> remove // listID is the identifier for the list of generated rules. listID int </s> add </s> remove // The rest of the fields are a part of the comment so skip // immediately. break </s> add hosts = append(hosts, f) </s> remove case 0: // Go on. default: // Only a part of the field is a comment. hosts = append(hosts, f[:hashIdx]) </s> add </s> remove switch hashIdx := strings.IndexByte(f, '#'); hashIdx { case -1: hosts = append(hosts, f) </s> add hashIdx := strings.IndexByte(f, '#') if hashIdx == 0 { // The rest of the fields are a part of the comment so return. break } else if hashIdx > 0 { // Only a part of the field is a comment. f = f[:hashIdx] } // Make sure that invalid hosts aren't turned into rules. // // See https://github.com/AdguardTeam/AdGuardHome/issues/3946. err := netutil.ValidateDomainName(f) if err != nil { log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f) </s> remove if ip == nil { </s> add if ip == nil || len(hosts) == 0 {
https://github.com/AdguardTeam/AdGuardHome/commit/4be69d35eb276266b846a8a01481894f35d244dd
internal/aghnet/hostscontainer.go
keep keep keep keep replace keep keep keep keep keep
<mask> ) (patterns []string, cont bool, err error) { <mask> s := bufio.NewScanner(r) <mask> for s.Scan() { <mask> ip, hosts := hp.parseLine(s.Text()) <mask> if ip == nil { <mask> continue <mask> } <mask> <mask> hp.addPairs(ip, hosts) <mask> } </s> Pull request: aghnet: do not turn bad etc/hosts entries into rules Updates #3946. Squashed commit of the following: commit 5d632dc4c49325308570adbfbc0fe333528989b5 Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:49:51 2021 +0300 aghnet: imp code commit 4da620ee625718f5cd7549277c483631f22b977b Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:33:39 2021 +0300 aghnet: do not turn bad etc/hosts entries into rules </s> remove switch hashIdx := strings.IndexByte(f, '#'); hashIdx { case -1: hosts = append(hosts, f) </s> add hashIdx := strings.IndexByte(f, '#') if hashIdx == 0 { // The rest of the fields are a part of the comment so return. break } else if hashIdx > 0 { // Only a part of the field is a comment. f = f[:hashIdx] } // Make sure that invalid hosts aren't turned into rules. // // See https://github.com/AdguardTeam/AdGuardHome/issues/3946. err := netutil.ValidateDomainName(f) if err != nil { log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f) </s> remove // The rest of the fields are a part of the comment so skip // immediately. break </s> add hosts = append(hosts, f) </s> add // // TODO(a.garipov, e.burkov): Consider fully merging into HostsContainer. </s> remove case 0: // Go on. default: // Only a part of the field is a comment. hosts = append(hosts, f[:hashIdx]) </s> add </s> add // listID is the identifier for the list of generated rules. listID int </s> remove // listID is the identifier for the list of generated rules. listID int </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4be69d35eb276266b846a8a01481894f35d244dd
internal/aghnet/hostscontainer.go
keep replace replace replace keep keep replace replace replace replace replace keep keep
<mask> for _, f := range fields[1:] { <mask> switch hashIdx := strings.IndexByte(f, '#'); hashIdx { <mask> case -1: <mask> hosts = append(hosts, f) <mask> <mask> continue <mask> case 0: <mask> // Go on. <mask> default: <mask> // Only a part of the field is a comment. <mask> hosts = append(hosts, f[:hashIdx]) <mask> } <mask> </s> Pull request: aghnet: do not turn bad etc/hosts entries into rules Updates #3946. Squashed commit of the following: commit 5d632dc4c49325308570adbfbc0fe333528989b5 Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:49:51 2021 +0300 aghnet: imp code commit 4da620ee625718f5cd7549277c483631f22b977b Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:33:39 2021 +0300 aghnet: do not turn bad etc/hosts entries into rules </s> remove // The rest of the fields are a part of the comment so skip // immediately. break </s> add hosts = append(hosts, f) </s> remove if ip == nil { </s> add if ip == nil || len(hosts) == 0 { </s> add // listID is the identifier for the list of generated rules. listID int </s> add // // TODO(a.garipov, e.burkov): Consider fully merging into HostsContainer. </s> remove // listID is the identifier for the list of generated rules. listID int </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4be69d35eb276266b846a8a01481894f35d244dd
internal/aghnet/hostscontainer.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> // Only a part of the field is a comment. <mask> hosts = append(hosts, f[:hashIdx]) <mask> } <mask> <mask> // The rest of the fields are a part of the comment so skip <mask> // immediately. <mask> break <mask> } <mask> <mask> return ip, hosts <mask> } <mask> </s> Pull request: aghnet: do not turn bad etc/hosts entries into rules Updates #3946. Squashed commit of the following: commit 5d632dc4c49325308570adbfbc0fe333528989b5 Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:49:51 2021 +0300 aghnet: imp code commit 4da620ee625718f5cd7549277c483631f22b977b Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:33:39 2021 +0300 aghnet: do not turn bad etc/hosts entries into rules </s> remove case 0: // Go on. default: // Only a part of the field is a comment. hosts = append(hosts, f[:hashIdx]) </s> add </s> remove switch hashIdx := strings.IndexByte(f, '#'); hashIdx { case -1: hosts = append(hosts, f) </s> add hashIdx := strings.IndexByte(f, '#') if hashIdx == 0 { // The rest of the fields are a part of the comment so return. break } else if hashIdx > 0 { // Only a part of the field is a comment. f = f[:hashIdx] } // Make sure that invalid hosts aren't turned into rules. // // See https://github.com/AdguardTeam/AdGuardHome/issues/3946. err := netutil.ValidateDomainName(f) if err != nil { log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f) </s> add // listID is the identifier for the list of generated rules. listID int </s> remove // listID is the identifier for the list of generated rules. listID int </s> add </s> add // // TODO(a.garipov, e.burkov): Consider fully merging into HostsContainer. </s> remove if ip == nil { </s> add if ip == nil || len(hosts) == 0 {
https://github.com/AdguardTeam/AdGuardHome/commit/4be69d35eb276266b846a8a01481894f35d244dd
internal/aghnet/hostscontainer.go
keep keep add keep keep keep keep
<mask> # See https://github.com/AdguardTeam/AdGuardHome/issues/3846. <mask> 1.0.0.2 a.whole lot.of aliases for.testing <mask> <mask> # Same for IPv6. <mask> ::1 simplehost <mask> :: hello hello.world <mask> ::2 a.whole lot.of aliases for.testing </s> Pull request: aghnet: do not turn bad etc/hosts entries into rules Updates #3946. Squashed commit of the following: commit 5d632dc4c49325308570adbfbc0fe333528989b5 Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:49:51 2021 +0300 aghnet: imp code commit 4da620ee625718f5cd7549277c483631f22b977b Author: Ainar Garipov <[email protected]> Date: Thu Dec 16 15:33:39 2021 +0300 aghnet: do not turn bad etc/hosts entries into rules </s> remove switch hashIdx := strings.IndexByte(f, '#'); hashIdx { case -1: hosts = append(hosts, f) </s> add hashIdx := strings.IndexByte(f, '#') if hashIdx == 0 { // The rest of the fields are a part of the comment so return. break } else if hashIdx > 0 { // Only a part of the field is a comment. f = f[:hashIdx] } // Make sure that invalid hosts aren't turned into rules. // // See https://github.com/AdguardTeam/AdGuardHome/issues/3946. err := netutil.ValidateDomainName(f) if err != nil { log.Error("%s: host %q is invalid, ignoring", hostsContainerPref, f) </s> remove // listID is the identifier for the list of generated rules. listID int </s> add </s> add // // TODO(a.garipov, e.burkov): Consider fully merging into HostsContainer. </s> remove if ip == nil { </s> add if ip == nil || len(hosts) == 0 { </s> add // listID is the identifier for the list of generated rules. listID int </s> remove // The rest of the fields are a part of the comment so skip // immediately. break </s> add hosts = append(hosts, f)
https://github.com/AdguardTeam/AdGuardHome/commit/4be69d35eb276266b846a8a01481894f35d244dd
internal/aghnet/testdata/etc_hosts
keep keep add keep keep keep keep
<mask> "react": { <mask> "pragma": "React", <mask> "version": "16.4" <mask> } <mask> }, <mask> <mask> "rules": { </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/.eslintrc
keep keep add keep keep keep keep
<mask> "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", <mask> "dev": true <mask> }, <mask> "array-find-index": { <mask> "version": "1.0.2", <mask> "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", <mask> "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> "ansi-regex": { <mask> "version": "2.1.1", <mask> "bundled": true, <mask> "dev": true <mask> }, <mask> "aproba": { <mask> "version": "1.2.0", <mask> "bundled": true, <mask> "dev": true, </s> + client: remove locales from js bundle </s> add "optional": true, </s> add "optional": true, </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> "balanced-match": { <mask> "version": "1.0.0", <mask> "bundled": true, <mask> "dev": true <mask> }, <mask> "brace-expansion": { <mask> "version": "1.1.11", <mask> "bundled": true, <mask> "dev": true, </s> + client: remove locales from js bundle </s> add "optional": true, </s> add "optional": true, </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep add keep keep keep keep
<mask> "version": "1.1.11", <mask> "bundled": true, <mask> "dev": true, <mask> "requires": { <mask> "balanced-match": "^1.0.0", <mask> "concat-map": "0.0.1" <mask> } </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep replace keep keep keep keep replace keep keep keep keep
<mask> "bundled": true, <mask> "dev": true <mask> }, <mask> "concat-map": { <mask> "version": "0.0.1", <mask> "bundled": true, <mask> "dev": true <mask> }, <mask> "console-control-strings": { <mask> "version": "1.1.0", <mask> "bundled": true, </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> "console-control-strings": { <mask> "version": "1.1.0", <mask> "bundled": true, <mask> "dev": true <mask> }, <mask> "core-util-is": { <mask> "version": "1.0.2", <mask> "bundled": true, <mask> "dev": true, </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> "inherits": { <mask> "version": "2.0.3", <mask> "bundled": true, <mask> "dev": true <mask> }, <mask> "ini": { <mask> "version": "1.3.5", <mask> "bundled": true, <mask> "dev": true, </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep add keep keep keep keep keep
<mask> "version": "1.0.0", <mask> "bundled": true, <mask> "dev": true, <mask> "requires": { <mask> "number-is-nan": "^1.0.0" <mask> } <mask> }, <mask> "isarray": { </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep add keep keep keep keep
<mask> "version": "3.0.4", <mask> "bundled": true, <mask> "dev": true, <mask> "requires": { <mask> "brace-expansion": "^1.1.7" <mask> } <mask> }, </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> "minimist": { <mask> "version": "0.0.8", <mask> "bundled": true, <mask> "dev": true <mask> }, <mask> "minipass": { <mask> "version": "2.3.5", <mask> "bundled": true, <mask> "dev": true, </s> + client: remove locales from js bundle </s> add "optional": true, </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep add keep keep keep keep keep
<mask> "version": "2.3.5", <mask> "bundled": true, <mask> "dev": true, <mask> "requires": { <mask> "safe-buffer": "^5.1.2", <mask> "yallist": "^3.0.0" <mask> } <mask> }, </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep add keep keep keep keep keep keep
<mask> "mkdirp": { <mask> "version": "0.5.1", <mask> "bundled": true, <mask> "dev": true, <mask> "requires": { <mask> "minimist": "0.0.8" <mask> } <mask> }, <mask> "ms": { <mask> "version": "2.1.1", </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> "number-is-nan": { <mask> "version": "1.0.1", <mask> "bundled": true, <mask> "dev": true <mask> }, <mask> "object-assign": { <mask> "version": "4.1.1", <mask> "bundled": true, <mask> "dev": true, </s> + client: remove locales from js bundle </s> add "optional": true, </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep add keep keep keep keep keep
<mask> "once": { <mask> "version": "1.4.0", <mask> "bundled": true, <mask> "dev": true, <mask> "requires": { <mask> "wrappy": "1" <mask> } <mask> }, <mask> "os-homedir": { </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> "safe-buffer": { <mask> "version": "5.1.2", <mask> "bundled": true, <mask> "dev": true <mask> }, <mask> "safer-buffer": { <mask> "version": "2.1.2", <mask> "bundled": true, <mask> "dev": true, </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep add keep keep keep keep
<mask> "string-width": { <mask> "version": "1.0.2", <mask> "bundled": true, <mask> "dev": true, <mask> "requires": { <mask> "code-point-at": "^1.0.0", <mask> "is-fullwidth-code-point": "^1.0.0", <mask> "strip-ansi": "^3.0.0" </s> + client: remove locales from js bundle </s> add "optional": true, </s> add "optional": true, </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep add keep keep keep keep keep keep
<mask> "bundled": true, <mask> "dev": true, <mask> "requires": { <mask> "ansi-regex": "^2.0.0" <mask> } <mask> }, <mask> "strip-json-comments": { <mask> "version": "2.0.1", </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep keep keep replace keep keep keep keep replace keep keep keep
<mask> }, <mask> "wrappy": { <mask> "version": "1.0.2", <mask> "bundled": true, <mask> "dev": true <mask> }, <mask> "yallist": { <mask> "version": "3.0.3", <mask> "bundled": true, <mask> "dev": true <mask> } <mask> } <mask> }, </s> + client: remove locales from js bundle </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package-lock.json
keep keep add keep keep keep keep keep
<mask> "date-fns": "^1.29.0", <mask> "i18next": "^12.0.0", <mask> "i18next-browser-languagedetector": "^2.2.3", <mask> "lodash": "^4.17.15", <mask> "nanoid": "^1.2.3", <mask> "prop-types": "^15.7.2", <mask> "react": "^16.4.0", <mask> "react-click-outside": "^3.0.1", </s> + client: remove locales from js bundle </s> add }, "import/resolver": { "webpack": { "config": "webpack.common.js" } </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true, </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/package.json
keep keep keep replace keep keep keep keep keep
<mask> import React, { Component, Fragment } from 'react'; <mask> import PropTypes from 'prop-types'; <mask> import { Trans, withNamespaces } from 'react-i18next'; <mask> import { REPOSITORY, LANGUAGES, PRIVACY_POLICY_LINK } from '../../helpers/constants'; <mask> import i18n from '../../i18n'; <mask> <mask> import Version from './Version'; <mask> import './Footer.css'; <mask> import './Select.css'; </s> + client: remove locales from js bundle </s> add import XHR from 'i18next-xhr-backend'; </s> remove import { DEFAULT_LANGUAGE } from './helpers/constants'; </s> add import { LANGUAGES, BASE_LOCALE } from './helpers/twosky'; </s> remove import vi from './__locales/vi.json'; import en from './__locales/en.json'; import ru from './__locales/ru.json'; import es from './__locales/es.json'; import fr from './__locales/fr.json'; import ja from './__locales/ja.json'; import sv from './__locales/sv.json'; import ptBR from './__locales/pt-br.json'; import zhTW from './__locales/zh-tw.json'; import bg from './__locales/bg.json'; import zhCN from './__locales/zh-cn.json'; import cs from './__locales/cs.json'; import da from './__locales/da.json'; import de from './__locales/de.json'; import id from './__locales/id.json'; import it from './__locales/it.json'; import ko from './__locales/ko.json'; import no from './__locales/no.json'; import nl from './__locales/nl.json'; import pl from './__locales/pl.json'; import ptPT from './__locales/pt-pt.json'; import sk from './__locales/sk.json'; import sl from './__locales/sl.json'; import tr from './__locales/tr.json'; import srCS from './__locales/sr-cs.json'; import hr from './__locales/hr.json'; import fa from './__locales/fa.json'; const resources = { en: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, fa: { translation: fa, }, }; const availableLanguages = Object.keys(resources); </s> add const availableLanguages = Object.keys(LANGUAGES); </s> add }, "import/resolver": { "webpack": { "config": "webpack.common.js" } </s> add "optional": true, </s> add whitelist: availableLanguages, backend: { loadPath: '/__locales/{{lng}}.json', },
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/src/components/ui/Footer.js
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> className="form-control select select--language" <mask> value={i18n.language} <mask> onChange={this.changeLanguage} <mask> > <mask> {LANGUAGES.map(language => ( <mask> <option key={language.key} value={language.key}> <mask> {language.name} <mask> </option> <mask> ))} <mask> </select> <mask> </div> <mask> </div> </s> + client: remove locales from js bundle </s> remove i18n.changeLanguage(DEFAULT_LANGUAGE); </s> add i18n.changeLanguage(BASE_LOCALE); </s> add whitelist: availableLanguages, backend: { loadPath: '/__locales/{{lng}}.json', }, </s> add new CopyPlugin([ { from: LOCALES_PATH, to: PUBLIC_PATH, context: 'src/', }, ]), </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/src/components/ui/Footer.js
add keep keep keep keep keep keep
<mask> import i18n from 'i18next'; <mask> import { reactI18nextModule } from 'react-i18next'; <mask> import { initReactI18n } from 'react-i18next/hooks'; <mask> import langDetect from 'i18next-browser-languagedetector'; <mask> <mask> import { LANGUAGES, BASE_LOCALE } from './helpers/twosky'; <mask> </s> + client: remove locales from js bundle </s> remove import { DEFAULT_LANGUAGE } from './helpers/constants'; </s> add import { LANGUAGES, BASE_LOCALE } from './helpers/twosky'; </s> remove import { REPOSITORY, LANGUAGES, PRIVACY_POLICY_LINK } from '../../helpers/constants'; </s> add import { REPOSITORY, PRIVACY_POLICY_LINK } from '../../helpers/constants'; import { LANGUAGES } from '../../helpers/twosky'; </s> remove import vi from './__locales/vi.json'; import en from './__locales/en.json'; import ru from './__locales/ru.json'; import es from './__locales/es.json'; import fr from './__locales/fr.json'; import ja from './__locales/ja.json'; import sv from './__locales/sv.json'; import ptBR from './__locales/pt-br.json'; import zhTW from './__locales/zh-tw.json'; import bg from './__locales/bg.json'; import zhCN from './__locales/zh-cn.json'; import cs from './__locales/cs.json'; import da from './__locales/da.json'; import de from './__locales/de.json'; import id from './__locales/id.json'; import it from './__locales/it.json'; import ko from './__locales/ko.json'; import no from './__locales/no.json'; import nl from './__locales/nl.json'; import pl from './__locales/pl.json'; import ptPT from './__locales/pt-pt.json'; import sk from './__locales/sk.json'; import sl from './__locales/sl.json'; import tr from './__locales/tr.json'; import srCS from './__locales/sr-cs.json'; import hr from './__locales/hr.json'; import fa from './__locales/fa.json'; const resources = { en: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, fa: { translation: fa, }, }; const availableLanguages = Object.keys(resources); </s> add const availableLanguages = Object.keys(LANGUAGES); </s> add }, "import/resolver": { "webpack": { "config": "webpack.common.js" } </s> add "optional": true, </s> add whitelist: availableLanguages, backend: { loadPath: '/__locales/{{lng}}.json', },
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/src/i18n.js
keep keep keep replace keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep
<mask> import { initReactI18n } from 'react-i18next/hooks'; <mask> import langDetect from 'i18next-browser-languagedetector'; <mask> <mask> import { DEFAULT_LANGUAGE } from './helpers/constants'; <mask> <mask> import vi from './__locales/vi.json'; <mask> import en from './__locales/en.json'; <mask> import ru from './__locales/ru.json'; <mask> import es from './__locales/es.json'; <mask> import fr from './__locales/fr.json'; <mask> import ja from './__locales/ja.json'; <mask> import sv from './__locales/sv.json'; <mask> import ptBR from './__locales/pt-br.json'; <mask> import zhTW from './__locales/zh-tw.json'; <mask> import bg from './__locales/bg.json'; <mask> import zhCN from './__locales/zh-cn.json'; <mask> import cs from './__locales/cs.json'; <mask> import da from './__locales/da.json'; <mask> import de from './__locales/de.json'; <mask> import id from './__locales/id.json'; <mask> import it from './__locales/it.json'; <mask> import ko from './__locales/ko.json'; <mask> import no from './__locales/no.json'; <mask> import nl from './__locales/nl.json'; <mask> import pl from './__locales/pl.json'; <mask> import ptPT from './__locales/pt-pt.json'; <mask> import sk from './__locales/sk.json'; <mask> import sl from './__locales/sl.json'; <mask> import tr from './__locales/tr.json'; <mask> import srCS from './__locales/sr-cs.json'; <mask> import hr from './__locales/hr.json'; <mask> import fa from './__locales/fa.json'; <mask> <mask> const resources = { <mask> en: { <mask> translation: en, <mask> }, <mask> vi: { <mask> translation: vi, <mask> }, <mask> ru: { <mask> translation: ru, <mask> }, <mask> es: { <mask> translation: es, <mask> }, <mask> fr: { <mask> translation: fr, <mask> }, <mask> ja: { <mask> translation: ja, <mask> }, <mask> sv: { <mask> translation: sv, <mask> }, <mask> 'pt-br': { <mask> translation: ptBR, <mask> }, <mask> 'zh-tw': { <mask> translation: zhTW, <mask> }, <mask> bg: { <mask> translation: bg, <mask> }, <mask> 'zh-cn': { <mask> translation: zhCN, <mask> }, <mask> cs: { <mask> translation: cs, <mask> }, <mask> da: { <mask> translation: da, <mask> }, <mask> de: { <mask> translation: de, <mask> }, <mask> id: { <mask> translation: id, <mask> }, <mask> it: { <mask> translation: it, <mask> }, <mask> ko: { <mask> translation: ko, <mask> }, <mask> no: { <mask> translation: no, <mask> }, <mask> nl: { <mask> translation: nl, <mask> }, <mask> pl: { <mask> translation: pl, <mask> }, <mask> 'pt-pt': { <mask> translation: ptPT, <mask> }, <mask> sk: { <mask> translation: sk, <mask> }, <mask> sl: { <mask> translation: sl, <mask> }, <mask> tr: { <mask> translation: tr, <mask> }, <mask> 'sr-cs': { <mask> translation: srCS, <mask> }, <mask> hr: { <mask> translation: hr, <mask> }, <mask> fa: { <mask> translation: fa, <mask> }, <mask> }; <mask> <mask> const availableLanguages = Object.keys(resources); <mask> <mask> i18n <mask> .use(langDetect) <mask> .use(initReactI18n) </s> + client: remove locales from js bundle </s> add import XHR from 'i18next-xhr-backend'; </s> remove import { REPOSITORY, LANGUAGES, PRIVACY_POLICY_LINK } from '../../helpers/constants'; </s> add import { REPOSITORY, PRIVACY_POLICY_LINK } from '../../helpers/constants'; import { LANGUAGES } from '../../helpers/twosky'; </s> add }, "import/resolver": { "webpack": { "config": "webpack.common.js" } </s> add whitelist: availableLanguages, backend: { loadPath: '/__locales/{{lng}}.json', }, </s> add alias: { MainRoot: path.resolve(__dirname, '../'), ClientRoot: path.resolve(__dirname, './src'), },
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/src/i18n.js
keep keep keep add keep keep keep keep keep keep
<mask> const availableLanguages = Object.keys(LANGUAGES); <mask> <mask> i18n <mask> .use(langDetect) <mask> .use(initReactI18n) <mask> .use(reactI18nextModule) <mask> .init({ <mask> lowerCaseLng: true, <mask> fallbackLng: BASE_LOCALE, <mask> keySeparator: false, </s> + client: remove locales from js bundle </s> remove resources, </s> add </s> remove fallbackLng: DEFAULT_LANGUAGE, </s> add fallbackLng: BASE_LOCALE, </s> add const LOCALES_PATH = path.resolve(RESOURCES_PATH, 'src/__locales/*.json'); </s> remove import vi from './__locales/vi.json'; import en from './__locales/en.json'; import ru from './__locales/ru.json'; import es from './__locales/es.json'; import fr from './__locales/fr.json'; import ja from './__locales/ja.json'; import sv from './__locales/sv.json'; import ptBR from './__locales/pt-br.json'; import zhTW from './__locales/zh-tw.json'; import bg from './__locales/bg.json'; import zhCN from './__locales/zh-cn.json'; import cs from './__locales/cs.json'; import da from './__locales/da.json'; import de from './__locales/de.json'; import id from './__locales/id.json'; import it from './__locales/it.json'; import ko from './__locales/ko.json'; import no from './__locales/no.json'; import nl from './__locales/nl.json'; import pl from './__locales/pl.json'; import ptPT from './__locales/pt-pt.json'; import sk from './__locales/sk.json'; import sl from './__locales/sl.json'; import tr from './__locales/tr.json'; import srCS from './__locales/sr-cs.json'; import hr from './__locales/hr.json'; import fa from './__locales/fa.json'; const resources = { en: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, fa: { translation: fa, }, }; const availableLanguages = Object.keys(resources); </s> add const availableLanguages = Object.keys(LANGUAGES); </s> remove new CleanWebpackPlugin(['*.*'], { </s> add new CleanWebpackPlugin(['**/*.*'], { </s> add new CopyPlugin([ { from: LOCALES_PATH, to: PUBLIC_PATH, context: 'src/', }, ]),
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/src/i18n.js
keep keep keep keep replace keep replace keep keep
<mask> .use(langDetect) <mask> .use(initReactI18n) <mask> .use(reactI18nextModule) <mask> .init({ <mask> resources, <mask> lowerCaseLng: true, <mask> fallbackLng: DEFAULT_LANGUAGE, <mask> keySeparator: false, <mask> nsSeparator: false, </s> + client: remove locales from js bundle </s> add .use(XHR) </s> remove new CleanWebpackPlugin(['*.*'], { </s> add new CleanWebpackPlugin(['**/*.*'], { </s> add "optional": true, </s> remove "dev": true </s> add "dev": true, "optional": true </s> remove "dev": true </s> add "dev": true, "optional": true
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/src/i18n.js
keep add keep keep keep keep keep keep
<mask> wait: true, <mask> }, <mask> }, () => { <mask> if (!availableLanguages.includes(i18n.language)) { <mask> i18n.changeLanguage(BASE_LOCALE); <mask> } <mask> }); <mask> </s> + client: remove locales from js bundle </s> remove i18n.changeLanguage(DEFAULT_LANGUAGE); </s> add i18n.changeLanguage(BASE_LOCALE); </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/src/i18n.js
keep keep keep keep replace keep keep keep keep
<mask> wait: true, <mask> }, <mask> }, () => { <mask> if (!availableLanguages.includes(i18n.language)) { <mask> i18n.changeLanguage(DEFAULT_LANGUAGE); <mask> } <mask> }); <mask> <mask> export default i18n; </s> + client: remove locales from js bundle </s> add whitelist: availableLanguages, backend: { loadPath: '/__locales/{{lng}}.json', }, </s> remove "dev": true </s> add "dev": true, "optional": true </s> add "optional": true, </s> add "optional": true, </s> add "optional": true, </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/src/i18n.js
keep keep add keep keep keep keep keep keep
<mask> const HTML_INSTALL_PATH = path.resolve(RESOURCES_PATH, 'public/install.html'); <mask> const HTML_LOGIN_PATH = path.resolve(RESOURCES_PATH, 'public/login.html'); <mask> const FAVICON_PATH = path.resolve(RESOURCES_PATH, 'public/favicon.png'); <mask> <mask> const PUBLIC_PATH = path.resolve(__dirname, '../build/static'); <mask> <mask> const config = { <mask> target: 'web', <mask> context: RESOURCES_PATH, </s> + client: remove locales from js bundle </s> add .use(XHR) </s> add new CopyPlugin([ { from: LOCALES_PATH, to: PUBLIC_PATH, context: 'src/', }, ]), </s> remove import vi from './__locales/vi.json'; import en from './__locales/en.json'; import ru from './__locales/ru.json'; import es from './__locales/es.json'; import fr from './__locales/fr.json'; import ja from './__locales/ja.json'; import sv from './__locales/sv.json'; import ptBR from './__locales/pt-br.json'; import zhTW from './__locales/zh-tw.json'; import bg from './__locales/bg.json'; import zhCN from './__locales/zh-cn.json'; import cs from './__locales/cs.json'; import da from './__locales/da.json'; import de from './__locales/de.json'; import id from './__locales/id.json'; import it from './__locales/it.json'; import ko from './__locales/ko.json'; import no from './__locales/no.json'; import nl from './__locales/nl.json'; import pl from './__locales/pl.json'; import ptPT from './__locales/pt-pt.json'; import sk from './__locales/sk.json'; import sl from './__locales/sl.json'; import tr from './__locales/tr.json'; import srCS from './__locales/sr-cs.json'; import hr from './__locales/hr.json'; import fa from './__locales/fa.json'; const resources = { en: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, fa: { translation: fa, }, }; const availableLanguages = Object.keys(resources); </s> add const availableLanguages = Object.keys(LANGUAGES); </s> add alias: { MainRoot: path.resolve(__dirname, '../'), ClientRoot: path.resolve(__dirname, './src'), }, </s> add }, "import/resolver": { "webpack": { "config": "webpack.common.js" } </s> add "optional": true,
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/webpack.common.js
keep add keep keep keep keep keep
<mask> resolve: { <mask> modules: ['node_modules'], <mask> }, <mask> module: { <mask> rules: [ <mask> { <mask> test: /\.css$/, </s> + client: remove locales from js bundle </s> remove new CleanWebpackPlugin(['*.*'], { </s> add new CleanWebpackPlugin(['**/*.*'], { </s> add }, "import/resolver": { "webpack": { "config": "webpack.common.js" } </s> remove import vi from './__locales/vi.json'; import en from './__locales/en.json'; import ru from './__locales/ru.json'; import es from './__locales/es.json'; import fr from './__locales/fr.json'; import ja from './__locales/ja.json'; import sv from './__locales/sv.json'; import ptBR from './__locales/pt-br.json'; import zhTW from './__locales/zh-tw.json'; import bg from './__locales/bg.json'; import zhCN from './__locales/zh-cn.json'; import cs from './__locales/cs.json'; import da from './__locales/da.json'; import de from './__locales/de.json'; import id from './__locales/id.json'; import it from './__locales/it.json'; import ko from './__locales/ko.json'; import no from './__locales/no.json'; import nl from './__locales/nl.json'; import pl from './__locales/pl.json'; import ptPT from './__locales/pt-pt.json'; import sk from './__locales/sk.json'; import sl from './__locales/sl.json'; import tr from './__locales/tr.json'; import srCS from './__locales/sr-cs.json'; import hr from './__locales/hr.json'; import fa from './__locales/fa.json'; const resources = { en: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, fa: { translation: fa, }, }; const availableLanguages = Object.keys(resources); </s> add const availableLanguages = Object.keys(LANGUAGES); </s> add whitelist: availableLanguages, backend: { loadPath: '/__locales/{{lng}}.json', }, </s> add "optional": true, </s> remove i18n.changeLanguage(DEFAULT_LANGUAGE); </s> add i18n.changeLanguage(BASE_LOCALE);
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/webpack.common.js
keep keep keep keep replace keep keep keep keep keep
<mask> plugins: [ <mask> new webpack.DefinePlugin({ <mask> 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), <mask> }), <mask> new CleanWebpackPlugin(['*.*'], { <mask> root: PUBLIC_PATH, <mask> verbose: false, <mask> dry: false, <mask> }), <mask> new HtmlWebpackPlugin({ </s> + client: remove locales from js bundle </s> add new CopyPlugin([ { from: LOCALES_PATH, to: PUBLIC_PATH, context: 'src/', }, ]), </s> remove fallbackLng: DEFAULT_LANGUAGE, </s> add fallbackLng: BASE_LOCALE, </s> remove resources, </s> add </s> add .use(XHR) </s> add alias: { MainRoot: path.resolve(__dirname, '../'), ClientRoot: path.resolve(__dirname, './src'), }, </s> add }, "import/resolver": { "webpack": { "config": "webpack.common.js" }
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/webpack.common.js
keep add keep keep keep keep
<mask> { from: FAVICON_PATH, to: PUBLIC_PATH }, <mask> ]), <mask> ], <mask> }; <mask> <mask> module.exports = config; </s> + client: remove locales from js bundle </s> add const LOCALES_PATH = path.resolve(RESOURCES_PATH, 'src/__locales/*.json'); </s> remove import vi from './__locales/vi.json'; import en from './__locales/en.json'; import ru from './__locales/ru.json'; import es from './__locales/es.json'; import fr from './__locales/fr.json'; import ja from './__locales/ja.json'; import sv from './__locales/sv.json'; import ptBR from './__locales/pt-br.json'; import zhTW from './__locales/zh-tw.json'; import bg from './__locales/bg.json'; import zhCN from './__locales/zh-cn.json'; import cs from './__locales/cs.json'; import da from './__locales/da.json'; import de from './__locales/de.json'; import id from './__locales/id.json'; import it from './__locales/it.json'; import ko from './__locales/ko.json'; import no from './__locales/no.json'; import nl from './__locales/nl.json'; import pl from './__locales/pl.json'; import ptPT from './__locales/pt-pt.json'; import sk from './__locales/sk.json'; import sl from './__locales/sl.json'; import tr from './__locales/tr.json'; import srCS from './__locales/sr-cs.json'; import hr from './__locales/hr.json'; import fa from './__locales/fa.json'; const resources = { en: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, fa: { translation: fa, }, }; const availableLanguages = Object.keys(resources); </s> add const availableLanguages = Object.keys(LANGUAGES); </s> add whitelist: availableLanguages, backend: { loadPath: '/__locales/{{lng}}.json', }, </s> add }, "import/resolver": { "webpack": { "config": "webpack.common.js" } </s> add alias: { MainRoot: path.resolve(__dirname, '../'), ClientRoot: path.resolve(__dirname, './src'), }, </s> add .use(XHR)
https://github.com/AdguardTeam/AdGuardHome/commit/4d55f51feeb50a8fdf36f1345ba5063b5d27afc5
client/webpack.common.js
keep keep keep keep replace replace keep keep keep keep keep
<mask> Certificates: []tls.Certificate{cert}, <mask> }, <mask> } <mask> <mask> URL := fmt.Sprintf("https://%s", address) <mask> log.Println("Go to " + URL) <mask> err = httpsServer.server.ListenAndServeTLS("", "") <mask> if err != http.ErrServerClosed { <mask> log.Fatal(err) <mask> os.Exit(1) <mask> } </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> remove address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("http") </s> add ifaces, err := getValidNetInterfacesForWeb() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } </s> remove addrs, e := iface.Addrs() if e != nil { httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) return } jsonIface := netInterface{ Name: iface.Name, MTU: iface.MTU, HardwareAddr: iface.HardwareAddr.String(), } if iface.Flags != 0 { jsonIface.Flags = iface.Flags.String() } // we don't want link-local addresses in json, so skip them for _, addr := range addrs { ipnet, ok := addr.(*net.IPNet) if !ok { // not an IPNet, should not happen httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) } if len(jsonIface.Addresses) != 0 { data.Interfaces[iface.Name] = jsonIface } </s> add data.Interfaces[iface.Name] = iface </s> remove ifaces, err := getValidNetInterfaces() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } if len(ifaces) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") return } // fill out the fields </s> add </s> remove httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err) </s> add httpError(w, http.StatusBadRequest, "Failed to parse new config json: %s", err) </s> add address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
app.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> }() <mask> <mask> // this loop is used as an ability to change listening host and/or port <mask> for { <mask> address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) <mask> URL := fmt.Sprintf("http://%s", address) <mask> log.Println("Go to " + URL) <mask> // we need to have new instance, because after Shutdown() the Server is not usable <mask> httpServer = &http.Server{ <mask> Addr: address, <mask> } <mask> err := httpServer.ListenAndServe() </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> add address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) </s> remove URL := fmt.Sprintf("https://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("https") </s> remove addrs, e := iface.Addrs() if e != nil { httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) return } jsonIface := netInterface{ Name: iface.Name, MTU: iface.MTU, HardwareAddr: iface.HardwareAddr.String(), } if iface.Flags != 0 { jsonIface.Flags = iface.Flags.String() } // we don't want link-local addresses in json, so skip them for _, addr := range addrs { ipnet, ok := addr.(*net.IPNet) if !ok { // not an IPNet, should not happen httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) } if len(jsonIface.Addresses) != 0 { data.Interfaces[iface.Name] = jsonIface } </s> add data.Interfaces[iface.Name] = iface </s> add ifaces, err := getValidNetInterfacesForWeb() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } </s> remove ifaces, err := getValidNetInterfaces() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } if len(ifaces) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") return } // fill out the fields </s> add </s> remove httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err) </s> add httpError(w, http.StatusBadRequest, "Failed to parse new config json: %s", err)
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
app.go
keep add keep keep keep keep
<mask> <mask> // we need to have new instance, because after Shutdown() the Server is not usable <mask> httpServer = &http.Server{ <mask> Addr: address, <mask> } <mask> err := httpServer.ListenAndServe() </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> remove address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("http") </s> remove addrs, e := iface.Addrs() if e != nil { httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) return } jsonIface := netInterface{ Name: iface.Name, MTU: iface.MTU, HardwareAddr: iface.HardwareAddr.String(), } if iface.Flags != 0 { jsonIface.Flags = iface.Flags.String() } // we don't want link-local addresses in json, so skip them for _, addr := range addrs { ipnet, ok := addr.(*net.IPNet) if !ok { // not an IPNet, should not happen httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) } if len(jsonIface.Addresses) != 0 { data.Interfaces[iface.Name] = jsonIface } </s> add data.Interfaces[iface.Name] = iface </s> add ifaces, err := getValidNetInterfacesForWeb() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } </s> remove httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err) </s> add httpError(w, http.StatusBadRequest, "Failed to parse new config json: %s", err) </s> remove ifaces, err := getValidNetInterfaces() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } if len(ifaces) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") return } // fill out the fields </s> add </s> remove URL := fmt.Sprintf("https://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("https")
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
app.go
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
<mask> ourConfigFilename string // Config filename (can be overridden via the command line arguments) <mask> ourWorkingDir string // Location of our directory, used to protect against CWD being somewhere else <mask> firstRun bool // if set to true, don't run any services except HTTP web inteface, and serve only first-run html <mask> <mask> BindHost string `yaml:"bind_host"` <mask> BindPort int `yaml:"bind_port"` <mask> AuthName string `yaml:"auth_name"` <mask> AuthPass string `yaml:"auth_pass"` <mask> Language string `yaml:"language"` // two-letter ISO 639-1 language code <mask> DNS dnsConfig `yaml:"dns"` <mask> TLS tlsConfig `yaml:"tls"` <mask> Filters []filter `yaml:"filters"` <mask> UserRules []string `yaml:"user_rules"` <mask> DHCP dhcpd.ServerConfig `yaml:"dhcp"` </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> remove ifaces, err := getValidNetInterfaces() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } if len(ifaces) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") return } // fill out the fields </s> add </s> remove address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("http") </s> remove addrs, e := iface.Addrs() if e != nil { httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) return } jsonIface := netInterface{ Name: iface.Name, MTU: iface.MTU, HardwareAddr: iface.HardwareAddr.String(), } if iface.Flags != 0 { jsonIface.Flags = iface.Flags.String() } // we don't want link-local addresses in json, so skip them for _, addr := range addrs { ipnet, ok := addr.(*net.IPNet) if !ok { // not an IPNet, should not happen httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) } if len(jsonIface.Addresses) != 0 { data.Interfaces[iface.Name] = jsonIface } </s> add data.Interfaces[iface.Name] = iface </s> add address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) </s> add "github.com/joomcode/errorx" </s> remove httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err) </s> add httpError(w, http.StatusBadRequest, "Failed to parse new config json: %s", err)
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
config.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> } <mask> <mask> func handleInstallGetAddresses(w http.ResponseWriter, r *http.Request) { <mask> data := firstRunData{} <mask> ifaces, err := getValidNetInterfaces() <mask> if err != nil { <mask> httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) <mask> return <mask> } <mask> if len(ifaces) == 0 { <mask> httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") <mask> return <mask> } <mask> <mask> // fill out the fields <mask> <mask> // find out if port 80 is available -- if not, fall back to 3000 <mask> if checkPortAvailable("", 80) == nil { <mask> data.Web.Port = 80 <mask> } else { </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> remove httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err) </s> add httpError(w, http.StatusBadRequest, "Failed to parse new config json: %s", err) </s> add ifaces, err := getValidNetInterfacesForWeb() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } </s> remove addrs, e := iface.Addrs() if e != nil { httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) return } jsonIface := netInterface{ Name: iface.Name, MTU: iface.MTU, HardwareAddr: iface.HardwareAddr.String(), } if iface.Flags != 0 { jsonIface.Flags = iface.Flags.String() } // we don't want link-local addresses in json, so skip them for _, addr := range addrs { ipnet, ok := addr.(*net.IPNet) if !ok { // not an IPNet, should not happen httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) } if len(jsonIface.Addresses) != 0 { data.Interfaces[iface.Name] = jsonIface } </s> add data.Interfaces[iface.Name] = iface </s> remove URL := fmt.Sprintf("https://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("https") </s> remove address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("http") </s> add address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
control.go
keep keep add keep keep keep keep
<mask> data.DNS.Warning = "Port 53 is not available for binding -- this will make DNS clients unable to contact AdGuard Home." <mask> } <mask> <mask> data.Interfaces = make(map[string]interface{}) <mask> for _, iface := range ifaces { <mask> data.Interfaces[iface.Name] = iface <mask> } </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> remove addrs, e := iface.Addrs() if e != nil { httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) return } jsonIface := netInterface{ Name: iface.Name, MTU: iface.MTU, HardwareAddr: iface.HardwareAddr.String(), } if iface.Flags != 0 { jsonIface.Flags = iface.Flags.String() } // we don't want link-local addresses in json, so skip them for _, addr := range addrs { ipnet, ok := addr.(*net.IPNet) if !ok { // not an IPNet, should not happen httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) } if len(jsonIface.Addresses) != 0 { data.Interfaces[iface.Name] = jsonIface } </s> add data.Interfaces[iface.Name] = iface </s> remove address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("http") </s> remove ifaces, err := getValidNetInterfaces() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } if len(ifaces) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") return } // fill out the fields </s> add </s> add address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) </s> remove URL := fmt.Sprintf("https://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("https") </s> remove httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err) </s> add httpError(w, http.StatusBadRequest, "Failed to parse new config json: %s", err)
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
control.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> } <mask> <mask> data.Interfaces = make(map[string]interface{}) <mask> for _, iface := range ifaces { <mask> addrs, e := iface.Addrs() <mask> if e != nil { <mask> httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) <mask> return <mask> } <mask> <mask> jsonIface := netInterface{ <mask> Name: iface.Name, <mask> MTU: iface.MTU, <mask> HardwareAddr: iface.HardwareAddr.String(), <mask> } <mask> <mask> if iface.Flags != 0 { <mask> jsonIface.Flags = iface.Flags.String() <mask> } <mask> <mask> // we don't want link-local addresses in json, so skip them <mask> for _, addr := range addrs { <mask> ipnet, ok := addr.(*net.IPNet) <mask> if !ok { <mask> // not an IPNet, should not happen <mask> httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) <mask> return <mask> } <mask> // ignore link-local <mask> if ipnet.IP.IsLinkLocalUnicast() { <mask> continue <mask> } <mask> jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) <mask> } <mask> if len(jsonIface.Addresses) != 0 { <mask> data.Interfaces[iface.Name] = jsonIface <mask> } <mask> } <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> err = json.NewEncoder(w).Encode(data) <mask> if err != nil { </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> add ifaces, err := getValidNetInterfacesForWeb() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } </s> remove ifaces, err := getValidNetInterfaces() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } if len(ifaces) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") return } // fill out the fields </s> add </s> remove httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err) </s> add httpError(w, http.StatusBadRequest, "Failed to parse new config json: %s", err) </s> remove URL := fmt.Sprintf("https://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("https") </s> remove address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("http") </s> add address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
control.go
keep keep keep keep replace keep keep keep keep keep
<mask> func handleInstallConfigure(w http.ResponseWriter, r *http.Request) { <mask> newSettings := firstRunData{} <mask> err := json.NewDecoder(r.Body).Decode(&newSettings) <mask> if err != nil { <mask> httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err) <mask> return <mask> } <mask> <mask> restartHTTP := true <mask> if config.BindHost == newSettings.Web.IP && config.BindPort == newSettings.Web.Port { </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> remove ifaces, err := getValidNetInterfaces() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } if len(ifaces) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") return } // fill out the fields </s> add </s> remove addrs, e := iface.Addrs() if e != nil { httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) return } jsonIface := netInterface{ Name: iface.Name, MTU: iface.MTU, HardwareAddr: iface.HardwareAddr.String(), } if iface.Flags != 0 { jsonIface.Flags = iface.Flags.String() } // we don't want link-local addresses in json, so skip them for _, addr := range addrs { ipnet, ok := addr.(*net.IPNet) if !ok { // not an IPNet, should not happen httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) } if len(jsonIface.Addresses) != 0 { data.Interfaces[iface.Name] = jsonIface } </s> add data.Interfaces[iface.Name] = iface </s> add ifaces, err := getValidNetInterfacesForWeb() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } </s> remove URL := fmt.Sprintf("https://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("https") </s> remove address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("http") </s> add address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
control.go
keep keep add keep keep keep keep
<mask> "runtime" <mask> "strconv" <mask> "strings" <mask> ) <mask> <mask> // ---------------------------------- <mask> // helper functions for working with files </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> remove address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("http") </s> remove description: "warning_validation is a validation warning message with the issue description" </s> add </s> remove addrs, e := iface.Addrs() if e != nil { httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) return } jsonIface := netInterface{ Name: iface.Name, MTU: iface.MTU, HardwareAddr: iface.HardwareAddr.String(), } if iface.Flags != 0 { jsonIface.Flags = iface.Flags.String() } // we don't want link-local addresses in json, so skip them for _, addr := range addrs { ipnet, ok := addr.(*net.IPNet) if !ok { // not an IPNet, should not happen httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) } if len(jsonIface.Addresses) != 0 { data.Interfaces[iface.Name] = jsonIface } </s> add data.Interfaces[iface.Name] = iface </s> remove BindHost string `yaml:"bind_host"` BindPort int `yaml:"bind_port"` AuthName string `yaml:"auth_name"` AuthPass string `yaml:"auth_pass"` Language string `yaml:"language"` // two-letter ISO 639-1 language code </s> add BindHost string `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to BindPort int `yaml:"bind_port"` // BindPort is the port the HTTP server AuthName string `yaml:"auth_name"` // AuthName is the basic auth username AuthPass string `yaml:"auth_pass"` // AuthPass is the basic auth password Language string `yaml:"language"` // two-letter ISO 639-1 language code </s> add address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) </s> remove ifaces, err := getValidNetInterfaces() if err != nil { httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) return } if len(ifaces) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") return } // fill out the fields </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
helpers.go
keep keep add keep keep keep keep
<mask> - <mask> name: dhcp <mask> description: 'Built-in DHCP server controls' <mask> paths: <mask> <mask> # API TO-DO LIST <mask> # TODO: Use JSON where it is possible </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> remove description: "warning_validation is a validation warning message with the issue description" </s> add </s> remove BindHost string `yaml:"bind_host"` BindPort int `yaml:"bind_port"` AuthName string `yaml:"auth_name"` AuthPass string `yaml:"auth_pass"` Language string `yaml:"language"` // two-letter ISO 639-1 language code </s> add BindHost string `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to BindPort int `yaml:"bind_port"` // BindPort is the port the HTTP server AuthName string `yaml:"auth_name"` // AuthName is the basic auth username AuthPass string `yaml:"auth_pass"` // AuthPass is the basic auth password Language string `yaml:"language"` // two-letter ISO 639-1 language code </s> remove addrs, e := iface.Addrs() if e != nil { httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) return } jsonIface := netInterface{ Name: iface.Name, MTU: iface.MTU, HardwareAddr: iface.HardwareAddr.String(), } if iface.Flags != 0 { jsonIface.Flags = iface.Flags.String() } // we don't want link-local addresses in json, so skip them for _, addr := range addrs { ipnet, ok := addr.(*net.IPNet) if !ok { // not an IPNet, should not happen httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) } if len(jsonIface.Addresses) != 0 { data.Interfaces[iface.Name] = jsonIface } </s> add data.Interfaces[iface.Name] = iface </s> remove httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config json: %s", err) </s> add httpError(w, http.StatusBadRequest, "Failed to parse new config json: %s", err) </s> remove address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("http") </s> add address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
openapi/openapi.yaml
keep keep keep keep replace
<mask> description: "key_type is either RSA or ECDSA" <mask> warning_validation: <mask> type: "string" <mask> example: "You have specified an empty certificate" <mask> description: "warning_validation is a validation warning message with the issue description" </s> Added install methods to openapi.yaml Print all net interfaces when bind_host is 0.0.0.0 </s> add - name: install description: 'First-time install configuration handlers' </s> remove address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) URL := fmt.Sprintf("http://%s", address) log.Println("Go to " + URL) </s> add printHTTPAddresses("http") </s> add address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) </s> add "github.com/joomcode/errorx" </s> remove BindHost string `yaml:"bind_host"` BindPort int `yaml:"bind_port"` AuthName string `yaml:"auth_name"` AuthPass string `yaml:"auth_pass"` Language string `yaml:"language"` // two-letter ISO 639-1 language code </s> add BindHost string `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to BindPort int `yaml:"bind_port"` // BindPort is the port the HTTP server AuthName string `yaml:"auth_name"` // AuthName is the basic auth username AuthPass string `yaml:"auth_pass"` // AuthPass is the basic auth password Language string `yaml:"language"` // two-letter ISO 639-1 language code </s> remove addrs, e := iface.Addrs() if e != nil { httpError(w, http.StatusInternalServerError, "Failed to get addresses for interface %s: %s", iface.Name, err) return } jsonIface := netInterface{ Name: iface.Name, MTU: iface.MTU, HardwareAddr: iface.HardwareAddr.String(), } if iface.Flags != 0 { jsonIface.Flags = iface.Flags.String() } // we don't want link-local addresses in json, so skip them for _, addr := range addrs { ipnet, ok := addr.(*net.IPNet) if !ok { // not an IPNet, should not happen httpError(w, http.StatusInternalServerError, "SHOULD NOT HAPPEN: got iface.Addrs() element %s that is not net.IPNet, it is %T", addr, addr) return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } jsonIface.Addresses = append(jsonIface.Addresses, ipnet.IP.String()) } if len(jsonIface.Addresses) != 0 { data.Interfaces[iface.Name] = jsonIface } </s> add data.Interfaces[iface.Name] = iface
https://github.com/AdguardTeam/AdGuardHome/commit/4e1c1618cb62153510fb0c538438e9e39c979923
openapi/openapi.yaml
keep replace keep replace keep keep keep
<mask> "os" <mask> "strings" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter" <mask> "github.com/AdguardTeam/AdGuardHome/dnsforward" </s> * rDNS: refactor: move code to a separate file </s> remove func beginAsyncRDNS(ip string) { if config.clients.Exists(ip) { return } // add IP to rdnsIP, if not exists config.dnsctx.rdnsLock.Lock() defer config.dnsctx.rdnsLock.Unlock() _, ok := config.dnsctx.rdnsIP[ip] if ok { return } config.dnsctx.rdnsIP[ip] = true log.Tracef("Adding %s for rDNS resolve", ip) select { case config.dnsctx.rdnsChannel <- ip: // default: log.Tracef("rDNS queue is full") } } // Use rDNS to get hostname by IP address func resolveRDNS(ip string) string { log.Tracef("Resolving host for %s", ip) req := dns.Msg{} req.Id = dns.Id() req.RecursionDesired = true req.Question = []dns.Question{ { Qtype: dns.TypePTR, Qclass: dns.ClassINET, }, } var err error req.Question[0].Name, err = dns.ReverseAddr(ip) if err != nil { log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err) return "" } resp, err := config.dnsctx.upstream.Exchange(&req) if err != nil { log.Error("Error while making an rDNS lookup for %s: %s", ip, err) return "" } if len(resp.Answer) != 1 { log.Debug("No answer for rDNS lookup of %s", ip) return "" } ptr, ok := resp.Answer[0].(*dns.PTR) if !ok { log.Error("not a PTR response for %s", ip) return "" } log.Tracef("PTR response for %s: %s", ip, ptr.String()) if strings.HasSuffix(ptr.Ptr, ".") { ptr.Ptr = ptr.Ptr[:len(ptr.Ptr)-1] } return ptr.Ptr } // Wait for a signal and then synchronously resolve hostname by IP address // Add the hostname:IP pair to "Clients" array func asyncRDNSLoop() { for { var ip string ip = <-config.dnsctx.rdnsChannel host := resolveRDNS(ip) if len(host) == 0 { continue } config.dnsctx.rdnsLock.Lock() delete(config.dnsctx.rdnsIP, ip) config.dnsctx.rdnsLock.Unlock() _, _ = config.clients.AddHost(ip, host, ClientSourceRDNS) } } </s> add </s> remove bindhost := config.DNS.BindHost if config.DNS.BindHost == "0.0.0.0" { bindhost = "127.0.0.1" } resolverAddress := fmt.Sprintf("%s:%d", bindhost, config.DNS.Port) opts := upstream.Options{ Timeout: rdnsTimeout, } config.dnsctx.upstream, err = upstream.AddressToUpstream(resolverAddress, opts) if err != nil { log.Error("upstream.AddressToUpstream: %s", err) return } config.dnsctx.rdnsIP = make(map[string]bool) config.dnsctx.rdnsChannel = make(chan string, 256) go asyncRDNSLoop() </s> add initRDNS() </s> remove const ( rdnsTimeout = 3 * time.Second // max time to wait for rDNS response ) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4f08f96607e60719586a041329d9622c4bd00f6f
home/dns.go
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> "github.com/joomcode/errorx" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> const ( <mask> rdnsTimeout = 3 * time.Second // max time to wait for rDNS response <mask> ) <mask> <mask> type dnsContext struct { <mask> rdnsChannel chan string // pass data from DNS request handling thread to rDNS thread <mask> // contains IP addresses of clients to be resolved by rDNS <mask> // if IP address couldn't be resolved, it stays here forever to prevent further attempts to resolve the same IP <mask> rdnsIP map[string]bool </s> * rDNS: refactor: move code to a separate file </s> remove func beginAsyncRDNS(ip string) { if config.clients.Exists(ip) { return } // add IP to rdnsIP, if not exists config.dnsctx.rdnsLock.Lock() defer config.dnsctx.rdnsLock.Unlock() _, ok := config.dnsctx.rdnsIP[ip] if ok { return } config.dnsctx.rdnsIP[ip] = true log.Tracef("Adding %s for rDNS resolve", ip) select { case config.dnsctx.rdnsChannel <- ip: // default: log.Tracef("rDNS queue is full") } } // Use rDNS to get hostname by IP address func resolveRDNS(ip string) string { log.Tracef("Resolving host for %s", ip) req := dns.Msg{} req.Id = dns.Id() req.RecursionDesired = true req.Question = []dns.Question{ { Qtype: dns.TypePTR, Qclass: dns.ClassINET, }, } var err error req.Question[0].Name, err = dns.ReverseAddr(ip) if err != nil { log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err) return "" } resp, err := config.dnsctx.upstream.Exchange(&req) if err != nil { log.Error("Error while making an rDNS lookup for %s: %s", ip, err) return "" } if len(resp.Answer) != 1 { log.Debug("No answer for rDNS lookup of %s", ip) return "" } ptr, ok := resp.Answer[0].(*dns.PTR) if !ok { log.Error("not a PTR response for %s", ip) return "" } log.Tracef("PTR response for %s: %s", ip, ptr.String()) if strings.HasSuffix(ptr.Ptr, ".") { ptr.Ptr = ptr.Ptr[:len(ptr.Ptr)-1] } return ptr.Ptr } // Wait for a signal and then synchronously resolve hostname by IP address // Add the hostname:IP pair to "Clients" array func asyncRDNSLoop() { for { var ip string ip = <-config.dnsctx.rdnsChannel host := resolveRDNS(ip) if len(host) == 0 { continue } config.dnsctx.rdnsLock.Lock() delete(config.dnsctx.rdnsIP, ip) config.dnsctx.rdnsLock.Unlock() _, _ = config.clients.AddHost(ip, host, ClientSourceRDNS) } } </s> add </s> remove bindhost := config.DNS.BindHost if config.DNS.BindHost == "0.0.0.0" { bindhost = "127.0.0.1" } resolverAddress := fmt.Sprintf("%s:%d", bindhost, config.DNS.Port) opts := upstream.Options{ Timeout: rdnsTimeout, } config.dnsctx.upstream, err = upstream.AddressToUpstream(resolverAddress, opts) if err != nil { log.Error("upstream.AddressToUpstream: %s", err) return } config.dnsctx.rdnsIP = make(map[string]bool) config.dnsctx.rdnsChannel = make(chan string, 256) go asyncRDNSLoop() </s> add initRDNS() </s> remove "strings" </s> add </s> remove "time" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4f08f96607e60719586a041329d9622c4bd00f6f
home/dns.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> } <mask> <mask> config.dnsServer = dnsforward.NewServer(baseDir) <mask> <mask> bindhost := config.DNS.BindHost <mask> if config.DNS.BindHost == "0.0.0.0" { <mask> bindhost = "127.0.0.1" <mask> } <mask> resolverAddress := fmt.Sprintf("%s:%d", bindhost, config.DNS.Port) <mask> opts := upstream.Options{ <mask> Timeout: rdnsTimeout, <mask> } <mask> config.dnsctx.upstream, err = upstream.AddressToUpstream(resolverAddress, opts) <mask> if err != nil { <mask> log.Error("upstream.AddressToUpstream: %s", err) <mask> return <mask> } <mask> <mask> config.dnsctx.rdnsIP = make(map[string]bool) <mask> config.dnsctx.rdnsChannel = make(chan string, 256) <mask> go asyncRDNSLoop() <mask> } <mask> <mask> func isRunning() bool { <mask> return config.dnsServer != nil && config.dnsServer.IsRunning() <mask> } </s> * rDNS: refactor: move code to a separate file </s> remove func beginAsyncRDNS(ip string) { if config.clients.Exists(ip) { return } // add IP to rdnsIP, if not exists config.dnsctx.rdnsLock.Lock() defer config.dnsctx.rdnsLock.Unlock() _, ok := config.dnsctx.rdnsIP[ip] if ok { return } config.dnsctx.rdnsIP[ip] = true log.Tracef("Adding %s for rDNS resolve", ip) select { case config.dnsctx.rdnsChannel <- ip: // default: log.Tracef("rDNS queue is full") } } // Use rDNS to get hostname by IP address func resolveRDNS(ip string) string { log.Tracef("Resolving host for %s", ip) req := dns.Msg{} req.Id = dns.Id() req.RecursionDesired = true req.Question = []dns.Question{ { Qtype: dns.TypePTR, Qclass: dns.ClassINET, }, } var err error req.Question[0].Name, err = dns.ReverseAddr(ip) if err != nil { log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err) return "" } resp, err := config.dnsctx.upstream.Exchange(&req) if err != nil { log.Error("Error while making an rDNS lookup for %s: %s", ip, err) return "" } if len(resp.Answer) != 1 { log.Debug("No answer for rDNS lookup of %s", ip) return "" } ptr, ok := resp.Answer[0].(*dns.PTR) if !ok { log.Error("not a PTR response for %s", ip) return "" } log.Tracef("PTR response for %s: %s", ip, ptr.String()) if strings.HasSuffix(ptr.Ptr, ".") { ptr.Ptr = ptr.Ptr[:len(ptr.Ptr)-1] } return ptr.Ptr } // Wait for a signal and then synchronously resolve hostname by IP address // Add the hostname:IP pair to "Clients" array func asyncRDNSLoop() { for { var ip string ip = <-config.dnsctx.rdnsChannel host := resolveRDNS(ip) if len(host) == 0 { continue } config.dnsctx.rdnsLock.Lock() delete(config.dnsctx.rdnsIP, ip) config.dnsctx.rdnsLock.Unlock() _, _ = config.clients.AddHost(ip, host, ClientSourceRDNS) } } </s> add </s> remove const ( rdnsTimeout = 3 * time.Second // max time to wait for rDNS response ) </s> add </s> remove "time" </s> add </s> remove "strings" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4f08f96607e60719586a041329d9622c4bd00f6f
home/dns.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> func isRunning() bool { <mask> return config.dnsServer != nil && config.dnsServer.IsRunning() <mask> } <mask> <mask> func beginAsyncRDNS(ip string) { <mask> if config.clients.Exists(ip) { <mask> return <mask> } <mask> <mask> // add IP to rdnsIP, if not exists <mask> config.dnsctx.rdnsLock.Lock() <mask> defer config.dnsctx.rdnsLock.Unlock() <mask> _, ok := config.dnsctx.rdnsIP[ip] <mask> if ok { <mask> return <mask> } <mask> config.dnsctx.rdnsIP[ip] = true <mask> <mask> log.Tracef("Adding %s for rDNS resolve", ip) <mask> select { <mask> case config.dnsctx.rdnsChannel <- ip: <mask> // <mask> default: <mask> log.Tracef("rDNS queue is full") <mask> } <mask> } <mask> <mask> // Use rDNS to get hostname by IP address <mask> func resolveRDNS(ip string) string { <mask> log.Tracef("Resolving host for %s", ip) <mask> <mask> req := dns.Msg{} <mask> req.Id = dns.Id() <mask> req.RecursionDesired = true <mask> req.Question = []dns.Question{ <mask> { <mask> Qtype: dns.TypePTR, <mask> Qclass: dns.ClassINET, <mask> }, <mask> } <mask> var err error <mask> req.Question[0].Name, err = dns.ReverseAddr(ip) <mask> if err != nil { <mask> log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err) <mask> return "" <mask> } <mask> <mask> resp, err := config.dnsctx.upstream.Exchange(&req) <mask> if err != nil { <mask> log.Error("Error while making an rDNS lookup for %s: %s", ip, err) <mask> return "" <mask> } <mask> if len(resp.Answer) != 1 { <mask> log.Debug("No answer for rDNS lookup of %s", ip) <mask> return "" <mask> } <mask> ptr, ok := resp.Answer[0].(*dns.PTR) <mask> if !ok { <mask> log.Error("not a PTR response for %s", ip) <mask> return "" <mask> } <mask> <mask> log.Tracef("PTR response for %s: %s", ip, ptr.String()) <mask> if strings.HasSuffix(ptr.Ptr, ".") { <mask> ptr.Ptr = ptr.Ptr[:len(ptr.Ptr)-1] <mask> } <mask> <mask> return ptr.Ptr <mask> } <mask> <mask> // Wait for a signal and then synchronously resolve hostname by IP address <mask> // Add the hostname:IP pair to "Clients" array <mask> func asyncRDNSLoop() { <mask> for { <mask> var ip string <mask> ip = <-config.dnsctx.rdnsChannel <mask> <mask> host := resolveRDNS(ip) <mask> if len(host) == 0 { <mask> continue <mask> } <mask> <mask> config.dnsctx.rdnsLock.Lock() <mask> delete(config.dnsctx.rdnsIP, ip) <mask> config.dnsctx.rdnsLock.Unlock() <mask> <mask> _, _ = config.clients.AddHost(ip, host, ClientSourceRDNS) <mask> } <mask> } <mask> <mask> func onDNSRequest(d *proxy.DNSContext) { <mask> qType := d.Req.Question[0].Qtype <mask> if qType != dns.TypeA && qType != dns.TypeAAAA { <mask> return <mask> } </s> * rDNS: refactor: move code to a separate file </s> remove bindhost := config.DNS.BindHost if config.DNS.BindHost == "0.0.0.0" { bindhost = "127.0.0.1" } resolverAddress := fmt.Sprintf("%s:%d", bindhost, config.DNS.Port) opts := upstream.Options{ Timeout: rdnsTimeout, } config.dnsctx.upstream, err = upstream.AddressToUpstream(resolverAddress, opts) if err != nil { log.Error("upstream.AddressToUpstream: %s", err) return } config.dnsctx.rdnsIP = make(map[string]bool) config.dnsctx.rdnsChannel = make(chan string, 256) go asyncRDNSLoop() </s> add initRDNS() </s> remove const ( rdnsTimeout = 3 * time.Second // max time to wait for rDNS response ) </s> add </s> remove "time" </s> add </s> remove "strings" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/4f08f96607e60719586a041329d9622c4bd00f6f
home/dns.go
keep add keep keep keep keep keep keep
<mask> import es from './__locales/es.json'; <mask> import fa from './__locales/fa.json'; <mask> import fr from './__locales/fr.json'; <mask> import hr from './__locales/hr.json'; <mask> import hu from './__locales/hu.json'; <mask> import id from './__locales/id.json'; <mask> import it from './__locales/it.json'; <mask> import ja from './__locales/ja.json'; </s> Pull request: client: add fi, uk locales Merge in DNS/adguard-home from add-fi-uk to master Squashed commit of the following: commit eb293912036ddb4f209827f3e3f87e849c402c6c Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:26:35 2021 +0300 client: fix locale selection commit 077b7ede31dd6ec0a154d38b32d40a3dd39ba383 Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:10:55 2021 +0300 client: add fi, uk locales </s> add import uk from './__locales/uk.json'; </s> remove en: { translation: en, }, enUS: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-hk': { translation: zhHK, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, be: { translation: be, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, hu: { translation: hu, }, fa: { translation: fa, }, th: { translation: th, }, ro: { translation: ro, }, 'si-lk': { translation: siLk, }, </s> add be: { translation: be }, bg: { translation: bg }, cs: { translation: cs }, da: { translation: da }, de: { translation: de }, en: { translation: en }, 'en-us': { translation: en }, es: { translation: es }, fa: { translation: fa }, fi: { translation: fi }, fr: { translation: fr }, hr: { translation: hr }, hu: { translation: hu }, id: { translation: id }, it: { translation: it }, ja: { translation: ja }, ko: { translation: ko }, nl: { translation: nl }, no: { translation: no }, pl: { translation: pl }, 'pt-br': { translation: ptBR }, 'pt-pt': { translation: ptPT }, ro: { translation: ro }, ru: { translation: ru }, 'si-lk': { translation: siLk }, sk: { translation: sk }, sl: { translation: sl }, 'sr-cs': { translation: srCS }, sv: { translation: sv }, th: { translation: th }, tr: { translation: tr }, uk: { translation: uk }, vi: { translation: vi }, 'zh-cn': { translation: zhCN }, 'zh-hk': { translation: zhHK }, 'zh-tw': { translation: zhTW }, </s> remove // TODO(a.garipov): Get rid of a global variable? </s> add // TODO(a.garipov): Get rid of a global or generate from .twosky.json. </s> add "uk", </s> add "fi",
https://github.com/AdguardTeam/AdGuardHome/commit/4f257a1cfcd2b7f45eb98e955bb0f69656d5bcec
client/src/i18n.js
keep add keep keep keep keep keep keep
<mask> import th from './__locales/th.json'; <mask> import tr from './__locales/tr.json'; <mask> import vi from './__locales/vi.json'; <mask> import zhCN from './__locales/zh-cn.json'; <mask> import zhHK from './__locales/zh-hk.json'; <mask> import zhTW from './__locales/zh-tw.json'; <mask> import { setHtmlLangAttr } from './helpers/helpers'; <mask> </s> Pull request: client: add fi, uk locales Merge in DNS/adguard-home from add-fi-uk to master Squashed commit of the following: commit eb293912036ddb4f209827f3e3f87e849c402c6c Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:26:35 2021 +0300 client: fix locale selection commit 077b7ede31dd6ec0a154d38b32d40a3dd39ba383 Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:10:55 2021 +0300 client: add fi, uk locales </s> remove en: { translation: en, }, enUS: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-hk': { translation: zhHK, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, be: { translation: be, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, hu: { translation: hu, }, fa: { translation: fa, }, th: { translation: th, }, ro: { translation: ro, }, 'si-lk': { translation: siLk, }, </s> add be: { translation: be }, bg: { translation: bg }, cs: { translation: cs }, da: { translation: da }, de: { translation: de }, en: { translation: en }, 'en-us': { translation: en }, es: { translation: es }, fa: { translation: fa }, fi: { translation: fi }, fr: { translation: fr }, hr: { translation: hr }, hu: { translation: hu }, id: { translation: id }, it: { translation: it }, ja: { translation: ja }, ko: { translation: ko }, nl: { translation: nl }, no: { translation: no }, pl: { translation: pl }, 'pt-br': { translation: ptBR }, 'pt-pt': { translation: ptPT }, ro: { translation: ro }, ru: { translation: ru }, 'si-lk': { translation: siLk }, sk: { translation: sk }, sl: { translation: sl }, 'sr-cs': { translation: srCS }, sv: { translation: sv }, th: { translation: th }, tr: { translation: tr }, uk: { translation: uk }, vi: { translation: vi }, 'zh-cn': { translation: zhCN }, 'zh-hk': { translation: zhHK }, 'zh-tw': { translation: zhTW }, </s> add import fi from './__locales/fi.json'; </s> remove // TODO(a.garipov): Get rid of a global variable? </s> add // TODO(a.garipov): Get rid of a global or generate from .twosky.json. </s> add "uk", </s> add "fi",
https://github.com/AdguardTeam/AdGuardHome/commit/4f257a1cfcd2b7f45eb98e955bb0f69656d5bcec
client/src/i18n.js
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> import zhTW from './__locales/zh-tw.json'; <mask> import { setHtmlLangAttr } from './helpers/helpers'; <mask> <mask> const resources = { <mask> en: { <mask> translation: en, <mask> }, <mask> enUS: { <mask> translation: en, <mask> }, <mask> vi: { <mask> translation: vi, <mask> }, <mask> ru: { <mask> translation: ru, <mask> }, <mask> es: { <mask> translation: es, <mask> }, <mask> fr: { <mask> translation: fr, <mask> }, <mask> ja: { <mask> translation: ja, <mask> }, <mask> sv: { <mask> translation: sv, <mask> }, <mask> 'pt-br': { <mask> translation: ptBR, <mask> }, <mask> 'zh-hk': { <mask> translation: zhHK, <mask> }, <mask> 'zh-tw': { <mask> translation: zhTW, <mask> }, <mask> bg: { <mask> translation: bg, <mask> }, <mask> be: { <mask> translation: be, <mask> }, <mask> 'zh-cn': { <mask> translation: zhCN, <mask> }, <mask> cs: { <mask> translation: cs, <mask> }, <mask> da: { <mask> translation: da, <mask> }, <mask> de: { <mask> translation: de, <mask> }, <mask> id: { <mask> translation: id, <mask> }, <mask> it: { <mask> translation: it, <mask> }, <mask> ko: { <mask> translation: ko, <mask> }, <mask> no: { <mask> translation: no, <mask> }, <mask> nl: { <mask> translation: nl, <mask> }, <mask> pl: { <mask> translation: pl, <mask> }, <mask> 'pt-pt': { <mask> translation: ptPT, <mask> }, <mask> sk: { <mask> translation: sk, <mask> }, <mask> sl: { <mask> translation: sl, <mask> }, <mask> tr: { <mask> translation: tr, <mask> }, <mask> 'sr-cs': { <mask> translation: srCS, <mask> }, <mask> hr: { <mask> translation: hr, <mask> }, <mask> hu: { <mask> translation: hu, <mask> }, <mask> fa: { <mask> translation: fa, <mask> }, <mask> th: { <mask> translation: th, <mask> }, <mask> ro: { <mask> translation: ro, <mask> }, <mask> 'si-lk': { <mask> translation: siLk, <mask> }, <mask> }; <mask> <mask> const availableLanguages = Object.keys(LANGUAGES); <mask> <mask> i18n </s> Pull request: client: add fi, uk locales Merge in DNS/adguard-home from add-fi-uk to master Squashed commit of the following: commit eb293912036ddb4f209827f3e3f87e849c402c6c Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:26:35 2021 +0300 client: fix locale selection commit 077b7ede31dd6ec0a154d38b32d40a3dd39ba383 Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:10:55 2021 +0300 client: add fi, uk locales </s> add import uk from './__locales/uk.json'; </s> remove // TODO(a.garipov): Get rid of a global variable? </s> add // TODO(a.garipov): Get rid of a global or generate from .twosky.json. </s> add import fi from './__locales/fi.json'; </s> add "uk", </s> add "fi",
https://github.com/AdguardTeam/AdGuardHome/commit/4f257a1cfcd2b7f45eb98e955bb0f69656d5bcec
client/src/i18n.js
keep keep keep keep replace keep keep keep keep keep
<mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/stringutil" <mask> ) <mask> <mask> // TODO(a.garipov): Get rid of a global variable? <mask> var allowedLanguages = stringutil.NewSet( <mask> "be", <mask> "bg", <mask> "cs", <mask> "da", </s> Pull request: client: add fi, uk locales Merge in DNS/adguard-home from add-fi-uk to master Squashed commit of the following: commit eb293912036ddb4f209827f3e3f87e849c402c6c Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:26:35 2021 +0300 client: fix locale selection commit 077b7ede31dd6ec0a154d38b32d40a3dd39ba383 Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:10:55 2021 +0300 client: add fi, uk locales </s> add "uk", </s> remove en: { translation: en, }, enUS: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-hk': { translation: zhHK, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, be: { translation: be, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, hu: { translation: hu, }, fa: { translation: fa, }, th: { translation: th, }, ro: { translation: ro, }, 'si-lk': { translation: siLk, }, </s> add be: { translation: be }, bg: { translation: bg }, cs: { translation: cs }, da: { translation: da }, de: { translation: de }, en: { translation: en }, 'en-us': { translation: en }, es: { translation: es }, fa: { translation: fa }, fi: { translation: fi }, fr: { translation: fr }, hr: { translation: hr }, hu: { translation: hu }, id: { translation: id }, it: { translation: it }, ja: { translation: ja }, ko: { translation: ko }, nl: { translation: nl }, no: { translation: no }, pl: { translation: pl }, 'pt-br': { translation: ptBR }, 'pt-pt': { translation: ptPT }, ro: { translation: ro }, ru: { translation: ru }, 'si-lk': { translation: siLk }, sk: { translation: sk }, sl: { translation: sl }, 'sr-cs': { translation: srCS }, sv: { translation: sv }, th: { translation: th }, tr: { translation: tr }, uk: { translation: uk }, vi: { translation: vi }, 'zh-cn': { translation: zhCN }, 'zh-hk': { translation: zhHK }, 'zh-tw': { translation: zhTW }, </s> add "fi", </s> add import uk from './__locales/uk.json'; </s> add import fi from './__locales/fi.json';
https://github.com/AdguardTeam/AdGuardHome/commit/4f257a1cfcd2b7f45eb98e955bb0f69656d5bcec
internal/home/i18n.go
keep add keep keep keep keep keep keep
<mask> "es", <mask> "fa", <mask> "fr", <mask> "hr", <mask> "hu", <mask> "id", <mask> "it", <mask> "ja", </s> Pull request: client: add fi, uk locales Merge in DNS/adguard-home from add-fi-uk to master Squashed commit of the following: commit eb293912036ddb4f209827f3e3f87e849c402c6c Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:26:35 2021 +0300 client: fix locale selection commit 077b7ede31dd6ec0a154d38b32d40a3dd39ba383 Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:10:55 2021 +0300 client: add fi, uk locales </s> add "uk", </s> remove // TODO(a.garipov): Get rid of a global variable? </s> add // TODO(a.garipov): Get rid of a global or generate from .twosky.json. </s> remove en: { translation: en, }, enUS: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-hk': { translation: zhHK, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, be: { translation: be, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, hu: { translation: hu, }, fa: { translation: fa, }, th: { translation: th, }, ro: { translation: ro, }, 'si-lk': { translation: siLk, }, </s> add be: { translation: be }, bg: { translation: bg }, cs: { translation: cs }, da: { translation: da }, de: { translation: de }, en: { translation: en }, 'en-us': { translation: en }, es: { translation: es }, fa: { translation: fa }, fi: { translation: fi }, fr: { translation: fr }, hr: { translation: hr }, hu: { translation: hu }, id: { translation: id }, it: { translation: it }, ja: { translation: ja }, ko: { translation: ko }, nl: { translation: nl }, no: { translation: no }, pl: { translation: pl }, 'pt-br': { translation: ptBR }, 'pt-pt': { translation: ptPT }, ro: { translation: ro }, ru: { translation: ru }, 'si-lk': { translation: siLk }, sk: { translation: sk }, sl: { translation: sl }, 'sr-cs': { translation: srCS }, sv: { translation: sv }, th: { translation: th }, tr: { translation: tr }, uk: { translation: uk }, vi: { translation: vi }, 'zh-cn': { translation: zhCN }, 'zh-hk': { translation: zhHK }, 'zh-tw': { translation: zhTW }, </s> add import uk from './__locales/uk.json'; </s> add import fi from './__locales/fi.json';
https://github.com/AdguardTeam/AdGuardHome/commit/4f257a1cfcd2b7f45eb98e955bb0f69656d5bcec
internal/home/i18n.go
keep keep add keep keep keep keep keep
<mask> "sv", <mask> "th", <mask> "tr", <mask> "vi", <mask> "zh-cn", <mask> "zh-hk", <mask> "zh-tw", <mask> ) </s> Pull request: client: add fi, uk locales Merge in DNS/adguard-home from add-fi-uk to master Squashed commit of the following: commit eb293912036ddb4f209827f3e3f87e849c402c6c Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:26:35 2021 +0300 client: fix locale selection commit 077b7ede31dd6ec0a154d38b32d40a3dd39ba383 Author: Ainar Garipov <[email protected]> Date: Mon Nov 15 14:10:55 2021 +0300 client: add fi, uk locales </s> remove // TODO(a.garipov): Get rid of a global variable? </s> add // TODO(a.garipov): Get rid of a global or generate from .twosky.json. </s> add "fi", </s> remove en: { translation: en, }, enUS: { translation: en, }, vi: { translation: vi, }, ru: { translation: ru, }, es: { translation: es, }, fr: { translation: fr, }, ja: { translation: ja, }, sv: { translation: sv, }, 'pt-br': { translation: ptBR, }, 'zh-hk': { translation: zhHK, }, 'zh-tw': { translation: zhTW, }, bg: { translation: bg, }, be: { translation: be, }, 'zh-cn': { translation: zhCN, }, cs: { translation: cs, }, da: { translation: da, }, de: { translation: de, }, id: { translation: id, }, it: { translation: it, }, ko: { translation: ko, }, no: { translation: no, }, nl: { translation: nl, }, pl: { translation: pl, }, 'pt-pt': { translation: ptPT, }, sk: { translation: sk, }, sl: { translation: sl, }, tr: { translation: tr, }, 'sr-cs': { translation: srCS, }, hr: { translation: hr, }, hu: { translation: hu, }, fa: { translation: fa, }, th: { translation: th, }, ro: { translation: ro, }, 'si-lk': { translation: siLk, }, </s> add be: { translation: be }, bg: { translation: bg }, cs: { translation: cs }, da: { translation: da }, de: { translation: de }, en: { translation: en }, 'en-us': { translation: en }, es: { translation: es }, fa: { translation: fa }, fi: { translation: fi }, fr: { translation: fr }, hr: { translation: hr }, hu: { translation: hu }, id: { translation: id }, it: { translation: it }, ja: { translation: ja }, ko: { translation: ko }, nl: { translation: nl }, no: { translation: no }, pl: { translation: pl }, 'pt-br': { translation: ptBR }, 'pt-pt': { translation: ptPT }, ro: { translation: ro }, ru: { translation: ru }, 'si-lk': { translation: siLk }, sk: { translation: sk }, sl: { translation: sl }, 'sr-cs': { translation: srCS }, sv: { translation: sv }, th: { translation: th }, tr: { translation: tr }, uk: { translation: uk }, vi: { translation: vi }, 'zh-cn': { translation: zhCN }, 'zh-hk': { translation: zhHK }, 'zh-tw': { translation: zhTW }, </s> add import uk from './__locales/uk.json'; </s> add import fi from './__locales/fi.json';
https://github.com/AdguardTeam/AdGuardHome/commit/4f257a1cfcd2b7f45eb98e955bb0f69656d5bcec
internal/home/i18n.go
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> } <mask> </div> <mask> </div> <mask> </div> <mask> <div className="col-12"> <mask> <p className="text-danger"> <mask> { <mask> (certificateChain || privateKey) <mask> && warning_validation <mask> && warning_validation <mask> } <mask> </p> <mask> </div> <mask> </div> <mask> <mask> <div className="btn-list mt-2"> <mask> <button <mask> type="submit" </s> Fix empty values on validate </s> add const { issuer = '', key_type = '', not_after = '', not_before = '', subject = '', warning_validation = '', dns_names = '', ...values } = payload; </s> remove ...payload, </s> add ...values, issuer, key_type, not_after, not_before, subject, warning_validation, dns_names,
https://github.com/AdguardTeam/AdGuardHome/commit/4f45f2c3e3f80a04d6bde0510452bd51337ac0f4
client/src/components/Settings/Encryption/Form.js
keep keep keep add keep keep keep keep keep keep
<mask> <mask> [actions.validateTlsConfigRequest]: state => ({ ...state, processingValidate: true }), <mask> [actions.validateTlsConfigFailure]: state => ({ ...state, processingValidate: false }), <mask> [actions.validateTlsConfigSuccess]: (state, { payload }) => { <mask> const newState = { <mask> ...state, <mask> ...values, <mask> issuer, <mask> key_type, <mask> not_after, </s> Fix empty values on validate </s> remove ...payload, </s> add ...values, issuer, key_type, not_after, not_before, subject, warning_validation, dns_names, </s> remove <div className="col-12"> <p className="text-danger"> { (certificateChain || privateKey) && warning_validation && warning_validation } </p> </div> </s> add {warning_validation && <div className="col-12"> <p className="text-danger"> {warning_validation} </p> </div> }
https://github.com/AdguardTeam/AdGuardHome/commit/4f45f2c3e3f80a04d6bde0510452bd51337ac0f4
client/src/reducers/encryption.js
keep keep keep keep replace keep keep keep keep keep
<mask> [actions.validateTlsConfigFailure]: state => ({ ...state, processingValidate: false }), <mask> [actions.validateTlsConfigSuccess]: (state, { payload }) => { <mask> const newState = { <mask> ...state, <mask> ...payload, <mask> processingValidate: false, <mask> }; <mask> return newState; <mask> }, <mask> }, { </s> Fix empty values on validate </s> add const { issuer = '', key_type = '', not_after = '', not_before = '', subject = '', warning_validation = '', dns_names = '', ...values } = payload; </s> remove <div className="col-12"> <p className="text-danger"> { (certificateChain || privateKey) && warning_validation && warning_validation } </p> </div> </s> add {warning_validation && <div className="col-12"> <p className="text-danger"> {warning_validation} </p> </div> }
https://github.com/AdguardTeam/AdGuardHome/commit/4f45f2c3e3f80a04d6bde0510452bd51337ac0f4
client/src/reducers/encryption.js
keep replace keep replace replace keep keep keep
<mask> <mask> // GetInterfaceByIP returns the name of interface containing provided ip. <mask> // <mask> // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. <mask> func GetInterfaceByIP(ip net.IP) string { <mask> ifaces, err := GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> return "" </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. </s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. </s> remove func TestGetInterfaceByIP(t *testing.T) { </s> add func TestInterfaceByIP(t *testing.T) { </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove interfaceName := aghnet.GetInterfaceByIP(ip) </s> add interfaceName := aghnet.InterfaceByIP(ip) </s> remove SecureAddresses []*netutil.IPPort </s> add SecureAddresses []netip.AddrPort
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/aghnet/net.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // GetSubnet returns pointer to net.IPNet for the specified interface or nil if <mask> // the search fails. <mask> // <mask> // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. <mask> func GetSubnet(ifaceName string) *net.IPNet { <mask> netIfaces, err := GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> log.Error("Could not get network interfaces info: %v", err) <mask> return nil </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove // GetInterfaceByIP returns the name of interface containing provided ip. </s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. func GetInterfaceByIP(ip net.IP) string { </s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one // IP address can be shared by multiple interfaces in some configurations. // // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. func InterfaceByIP(ip net.IP) (ifaceName string) { </s> remove func TestGetInterfaceByIP(t *testing.T) { </s> add func TestInterfaceByIP(t *testing.T) { </s> remove interfaceName := aghnet.GetInterfaceByIP(ip) </s> add interfaceName := aghnet.InterfaceByIP(ip) </s> remove Addresses []*netutil.IPPort </s> add Addresses []netip.AddrPort </s> remove SecureAddresses []*netutil.IPPort </s> add SecureAddresses []netip.AddrPort
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/aghnet/net.go
keep keep keep keep replace keep keep keep keep keep
<mask> }) <mask> } <mask> } <mask> <mask> func TestGetInterfaceByIP(t *testing.T) { <mask> ifaces, err := GetValidNetInterfacesForWeb() <mask> require.NoError(t, err) <mask> require.NotEmpty(t, ifaces) <mask> <mask> for _, iface := range ifaces { </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove ifaceName := GetInterfaceByIP(ip) </s> add ifaceName := InterfaceByIP(ip) </s> remove // GetInterfaceByIP returns the name of interface containing provided ip. </s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. func GetInterfaceByIP(ip net.IP) string { </s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one // IP address can be shared by multiple interfaces in some configurations. // // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. func InterfaceByIP(ip net.IP) (ifaceName string) { </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. </s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. </s> remove TLS: nil, Addresses: []*netutil.IPPort{{ IP: net.IP{127, 0, 0, 1}, Port: 0, }}, </s> add TLS: nil, Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:0")}, </s> remove interfaceName := aghnet.GetInterfaceByIP(ip) </s> add interfaceName := aghnet.InterfaceByIP(ip)
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/aghnet/net_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> t.Run(iface.Name, func(t *testing.T) { <mask> require.NotEmpty(t, iface.Addresses) <mask> <mask> for _, ip := range iface.Addresses { <mask> ifaceName := GetInterfaceByIP(ip) <mask> require.Equal(t, iface.Name, ifaceName) <mask> } <mask> }) <mask> } <mask> } </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove func TestGetInterfaceByIP(t *testing.T) { </s> add func TestInterfaceByIP(t *testing.T) { </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. func GetInterfaceByIP(ip net.IP) string { </s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one // IP address can be shared by multiple interfaces in some configurations. // // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. func InterfaceByIP(ip net.IP) (ifaceName string) { </s> remove TLS: nil, Addresses: []*netutil.IPPort{{ IP: net.IP{127, 0, 0, 1}, Port: 0, }}, </s> add TLS: nil, Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:0")}, </s> remove // GetInterfaceByIP returns the name of interface containing provided ip. </s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove interfaceName := aghnet.GetInterfaceByIP(ip) </s> add interfaceName := aghnet.InterfaceByIP(ip) </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. </s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/aghnet/net_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> // Or if set=true, it tries to set it <mask> func handleStaticIP(ip net.IP, set bool) staticIPJSON { <mask> resp := staticIPJSON{} <mask> <mask> interfaceName := aghnet.GetInterfaceByIP(ip) <mask> resp.Static = "no" <mask> <mask> if len(interfaceName) == 0 { <mask> resp.Static = "error" <mask> resp.Error = fmt.Sprintf("Couldn't find network interface by IP %s", ip) </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. </s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. func GetInterfaceByIP(ip net.IP) string { </s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one // IP address can be shared by multiple interfaces in some configurations. // // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. func InterfaceByIP(ip net.IP) (ifaceName string) { </s> remove // GetInterfaceByIP returns the name of interface containing provided ip. </s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove Addresses: []*netutil.IPPort{{ IP: net.IP{127, 0, 0, 1}, Port: 3001, }}, Start: start, Timeout: 60 * time.Second, </s> add Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:3001")}, Start: start, Timeout: 60 * time.Second, </s> remove func TestGetInterfaceByIP(t *testing.T) { </s> add func TestInterfaceByIP(t *testing.T) { </s> remove ifaceName := GetInterfaceByIP(ip) </s> add ifaceName := InterfaceByIP(ip)
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/home/controlinstall.go
keep replace keep keep keep keep replace keep
<mask> "math/rand" <mask> "net" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/v1/websvc" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> ) </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> add "net/netip" </s> remove "net" </s> add </s> add "net/netip"
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/v1/cmd/cmd.go
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
<mask> _ = clientBuildFS <mask> <mask> // TODO(a.garipov): Make configurable. <mask> web := websvc.New(&websvc.Config{ <mask> Addresses: []*netutil.IPPort{{ <mask> IP: net.IP{127, 0, 0, 1}, <mask> Port: 3001, <mask> }}, <mask> Start: start, <mask> Timeout: 60 * time.Second, <mask> }) <mask> <mask> err := web.Start() <mask> fatalOnError(err) <mask> </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove TLS: nil, Addresses: []*netutil.IPPort{{ IP: net.IP{127, 0, 0, 1}, Port: 0, }}, </s> add TLS: nil, Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:0")}, </s> remove interfaceName := aghnet.GetInterfaceByIP(ip) </s> add interfaceName := aghnet.InterfaceByIP(ip) </s> remove func TestGetInterfaceByIP(t *testing.T) { </s> add func TestInterfaceByIP(t *testing.T) { </s> remove ifaceName := GetInterfaceByIP(ip) </s> add ifaceName := InterfaceByIP(ip) </s> remove // GetInterfaceByIP returns the name of interface containing provided ip. </s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. </s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/v1/cmd/cmd.go
keep add keep keep keep keep keep
<mask> "net" <mask> "net/http" <mask> "sync" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/v1/agh" <mask> "github.com/AdguardTeam/golibs/errors" </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove "net" </s> add </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> add "net/netip" </s> remove "net" </s> add "net/netip" </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/v1/websvc/websvc.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/v1/agh" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> httptreemux "github.com/dimfeld/httptreemux/v5" <mask> ) <mask> <mask> // Config is the AdGuard Home web service configuration structure. <mask> type Config struct { </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> add "net/netip" </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove SecureAddresses []*netutil.IPPort </s> add SecureAddresses []netip.AddrPort </s> remove "net" </s> add "net/netip" </s> remove 'force_https': 'description': > If `true`, enabled the HTTP-to-HTTPS redirect. 'type': 'boolean' </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/v1/websvc/websvc.go
keep keep keep keep replace keep keep keep replace keep keep
<mask> // SecureAddresses must not be empty. <mask> TLS *tls.Config <mask> <mask> // Addresses are the addresses on which to serve the plain HTTP API. <mask> Addresses []*netutil.IPPort <mask> <mask> // SecureAddresses are the addresses on which to serve the HTTPS API. If <mask> // SecureAddresses is not empty, TLS must not be nil. <mask> SecureAddresses []*netutil.IPPort <mask> <mask> // Start is the time of start of AdGuard Home. </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> add 'addresses': 'description': > Addresses on which to serve plain DNS, in ip:port format. Empty array disables plain DNS. 'items': 'type': 'string' 'type': 'array' </s> remove // GetInterfaceByIP returns the name of interface containing provided ip. </s> add // InterfaceByIP returns the name of the interface bound to ip. </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. </s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. func GetInterfaceByIP(ip net.IP) string { </s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one // IP address can be shared by multiple interfaces in some configurations. // // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. func InterfaceByIP(ip net.IP) (ifaceName string) { </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/v1/websvc/websvc.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> import ( <mask> "context" <mask> "io" <mask> "net" <mask> "net/http" <mask> "net/url" <mask> "testing" <mask> "time" <mask> </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> add "net/netip" </s> remove "net" </s> add "net/netip" </s> add "net/netip" </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove - 'force_https' </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/v1/websvc/websvc_test.go
keep add keep keep keep keep
<mask> "io" <mask> "net/http" <mask> "net/url" <mask> "testing" <mask> "time" <mask> </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove "net" </s> add </s> add "net/netip" </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove "net" </s> add "net/netip" </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove - 'force_https' </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/v1/websvc/websvc_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> "testing" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/internal/v1/websvc" <mask> "github.com/AdguardTeam/golibs/netutil" <mask> "github.com/AdguardTeam/golibs/testutil" <mask> "github.com/stretchr/testify/assert" <mask> "github.com/stretchr/testify/require" <mask> ) <mask> </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove "net" </s> add "net/netip" </s> add "net/netip" </s> remove "net" </s> add </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> add "net/netip"
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/v1/websvc/websvc_test.go
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
<mask> func newTestServer(t testing.TB) (svc *websvc.Service, addr string) { <mask> t.Helper() <mask> <mask> c := &websvc.Config{ <mask> TLS: nil, <mask> Addresses: []*netutil.IPPort{{ <mask> IP: net.IP{127, 0, 0, 1}, <mask> Port: 0, <mask> }}, <mask> SecureAddresses: nil, <mask> Timeout: testTimeout, <mask> Start: testStart, <mask> } <mask> </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> remove Addresses: []*netutil.IPPort{{ IP: net.IP{127, 0, 0, 1}, Port: 3001, }}, Start: start, Timeout: 60 * time.Second, </s> add Addresses: []netip.AddrPort{netip.MustParseAddrPort("127.0.0.1:3001")}, Start: start, Timeout: 60 * time.Second, </s> remove func TestGetInterfaceByIP(t *testing.T) { </s> add func TestInterfaceByIP(t *testing.T) { </s> remove ifaceName := GetInterfaceByIP(ip) </s> add ifaceName := InterfaceByIP(ip) </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. func GetInterfaceByIP(ip net.IP) string { </s> add // TODO(a.garipov, e.burkov): This function is technically incorrect, since one // IP address can be shared by multiple interfaces in some configurations. // // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. func InterfaceByIP(ip net.IP) (ifaceName string) { </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. </s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb. </s> remove // GetInterfaceByIP returns the name of interface containing provided ip. </s> add // InterfaceByIP returns the name of the interface bound to ip.
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
internal/v1/websvc/websvc_test.go
keep keep add keep keep keep keep
<mask> '/health-check': <mask> 'get': <mask> 'operationId': 'HealthCheck' <mask> 'servers': <mask> - 'url': '/' <mask> 'summary': 'Check if the server is up.' <mask> 'tags': </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> add 'addresses': - '127.0.0.1:53' - '192.168.1.1:53' </s> add - 'upstream_timeout' </s> remove SecureAddresses []*netutil.IPPort </s> add SecureAddresses []netip.AddrPort </s> remove 'force_https': 'description': > If `true`, enabled the HTTP-to-HTTPS redirect. 'type': 'boolean' </s> add </s> add 'addresses': 'description': > Addresses on which to serve plain DNS, in ip:port format. Empty array disables plain DNS. 'items': 'type': 'string' 'type': 'array' </s> remove // TODO(e.burkov): See TODO on GetValidInterfacesForWeb. </s> add // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
openapi/v1.yaml
keep keep add keep keep keep keep keep keep
<mask> '$ref': '#/components/schemas/PatchV1SettingsDnsReq' <mask> 'required': true <mask> <mask> 'PatchV1SettingsLogReq': <mask> 'content': <mask> 'application/json': <mask> 'schema': <mask> '$ref': '#/components/schemas/PatchV1SettingsLogReq' <mask> 'required': true </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> add 'PatchV1SettingsHttpResp': 'content': 'application/json': 'schema': '$ref': '#/components/schemas/PatchV1SettingsHttpResp' 'description': > A successful response to a `PATCH /api/v1/settings/http` request. </s> add 'PatchV1SettingsHttpReq': '$ref': '#/components/schemas/HttpSettingsPatch' 'PatchV1SettingsHttpResp': '$ref': '#/components/schemas/HttpSettings' </s> remove 'force_https': true </s> add </s> add 'http': '$ref': '#/components/schemas/HttpSettings' </s> add - 'addresses' </s> remove - 'force_https' </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
openapi/v1.yaml
keep keep keep add keep keep keep keep
<mask> '$ref': '#/components/schemas/PatchV1SettingsDnsResp' <mask> 'description': > <mask> A successful response to a `PATCH /api/v1/settings/dns` request. <mask> <mask> 'PatchV1SettingsLogResp': <mask> 'content': <mask> 'application/json': <mask> 'schema': </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> add 'PatchV1SettingsHttpReq': 'content': 'application/json': 'schema': '$ref': '#/components/schemas/PatchV1SettingsHttpReq' 'required': true </s> add 'upstream_timeout': 'description': > Upstream request timeout, as a human readable duration. 'type': 'string' </s> add 'PatchV1SettingsHttpReq': '$ref': '#/components/schemas/HttpSettingsPatch' 'PatchV1SettingsHttpResp': '$ref': '#/components/schemas/HttpSettings' </s> add 'responses': '200': 'description': > An OK response. 'content': 'text/plain': 'example': 'OK' </s> add 'addresses': - '127.0.0.1:53' - '192.168.1.1:53' </s> add 'addresses': 'description': > Addresses on which to serve plain DNS, in ip:port format. Empty array disables plain DNS. 'items': 'type': 'string' 'type': 'array'
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
openapi/v1.yaml
keep keep keep add keep keep keep keep
<mask> - '$ref': '#/components/schemas/DnsSettingsPatch' <mask> - 'description': > <mask> DNS server settings. <mask> 'example': <mask> 'blocking_mode': 'default' <mask> 'bootstrap_servers': <mask> - '9.9.9.10' <mask> - '149.112.112.10' </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> add - 'upstream_timeout' </s> add 'responses': '200': 'description': > An OK response. 'content': 'text/plain': 'example': 'OK' </s> add - 'http' </s> add - 'addresses' </s> remove - 'force_https' </s> add </s> add 'upstream_timeout': '1s'
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
openapi/v1.yaml
keep keep keep add keep keep keep keep keep
<mask> 'upstream_mode': 'load_balancing' <mask> 'upstream_servers': <mask> - '1.1.1.1' <mask> - '8.8.8.8' <mask> 'required': <mask> - 'addresses' <mask> - 'blocking_mode' <mask> - 'bootstrap_servers' <mask> - 'cache_size' </s> Pull request: upd-websvc Merge in DNS/adguard-home from upd-websvc to master Squashed commit of the following: commit 30d6a2dc5083efd91479bcbe20f03c37baddbf94 Author: Ainar Garipov <[email protected]> Date: Tue Aug 9 18:55:42 2022 +0300 all: upd openapi, websvc </s> add - 'addresses' </s> remove - 'force_https' </s> add </s> add - 'http' </s> add 'addresses': - '127.0.0.1:53' - '192.168.1.1:53' </s> add - 'upstream_timeout' </s> add 'addresses': 'description': > Addresses on which to serve plain DNS, in ip:port format. Empty array disables plain DNS. 'items': 'type': 'string' 'type': 'array'
https://github.com/AdguardTeam/AdGuardHome/commit/50565bed3b5bcd934781940d398571a4ecb9b593
openapi/v1.yaml