code_before
stringlengths
16
1.81M
edits
stringlengths
4
328k
next_edit
stringlengths
0
76.5k
code_after
stringlengths
3
49.9M
label_window
sequencelengths
4
1.81k
instruction
stringlengths
20
51.9k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
return } err := writeCoreDNSConfig() if err != nil { errortext := fmt.Sprintf("Unable to write coredns config: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) return } err = writeFilterFile()
</s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400) return </s> add return fmt.Errorf("Unable to start coreDNS: Already running") </s> remove errortext := fmt.Sprintf("Couldn't write filter file: %s", err) </s> add errortext := fmt.Errorf("Couldn't write filter file: %s", err) </s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove errortext := fmt.Sprintf("Unable to start coreDNS: %s", err) </s> add errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
errortext := fmt.Errorf("Unable to write coredns config: %s", err)
return } err := writeCoreDNSConfig() if err != nil { errortext := fmt.Errorf("Unable to write coredns config: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) return } err = writeFilterFile()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move starting of coredns server into separate function
https://github.com/AdguardTeam/AdGuardHome/commit/33fbccf0badee8a4c5f790d850d85e161536779f
control.go
err := writeCoreDNSConfig() if err != nil { errortext := fmt.Sprintf("Unable to write coredns config: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) return } err = writeFilterFile() if err != nil { errortext := fmt.Sprintf("Couldn't write filter file: %s", err) log.Println(errortext)
</s> remove errortext := fmt.Sprintf("Couldn't write filter file: %s", err) </s> add errortext := fmt.Errorf("Couldn't write filter file: %s", err) </s> remove errortext := fmt.Sprintf("Unable to write coredns config: %s", err) </s> add errortext := fmt.Errorf("Unable to write coredns config: %s", err) </s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400) return </s> add return fmt.Errorf("Unable to start coreDNS: Already running") </s> remove errortext := fmt.Sprintf("Unable to start coreDNS: %s", err) </s> add errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
return errortext
err := writeCoreDNSConfig() if err != nil { errortext := fmt.Sprintf("Unable to write coredns config: %s", err) log.Println(errortext) return errortext return errortext } err = writeFilterFile() if err != nil { errortext := fmt.Sprintf("Couldn't write filter file: %s", err) log.Println(errortext)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move starting of coredns server into separate function
https://github.com/AdguardTeam/AdGuardHome/commit/33fbccf0badee8a4c5f790d850d85e161536779f
control.go
return } err = writeFilterFile() if err != nil { errortext := fmt.Sprintf("Couldn't write filter file: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) return } binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile)
</s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove errortext := fmt.Sprintf("Unable to write coredns config: %s", err) </s> add errortext := fmt.Errorf("Unable to write coredns config: %s", err) </s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove errortext := fmt.Sprintf("Unable to start coreDNS: %s", err) </s> add errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
errortext := fmt.Errorf("Couldn't write filter file: %s", err)
return } err = writeFilterFile() if err != nil { errortext := fmt.Errorf("Couldn't write filter file: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) return } binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move starting of coredns server into separate function
https://github.com/AdguardTeam/AdGuardHome/commit/33fbccf0badee8a4c5f790d850d85e161536779f
control.go
err = writeFilterFile() if err != nil { errortext := fmt.Sprintf("Couldn't write filter file: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) return } binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile) configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile) coreDNSCommand = exec.Command(binarypath, "-conf", configpath, "-dns.port", fmt.Sprintf("%d", config.CoreDNS.Port)) coreDNSCommand.Stdout = os.Stdout
</s> remove errortext := fmt.Sprintf("Couldn't write filter file: %s", err) </s> add errortext := fmt.Errorf("Couldn't write filter file: %s", err) </s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove errortext := fmt.Sprintf("Unable to start coreDNS: %s", err) </s> add errortext := fmt.Errorf("Unable to start coreDNS: %s", err) </s> remove errortext := fmt.Sprintf("Unable to write coredns config: %s", err) </s> add errortext := fmt.Errorf("Unable to write coredns config: %s", err) </s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext
return errortext
err = writeFilterFile() if err != nil { errortext := fmt.Sprintf("Couldn't write filter file: %s", err) log.Println(errortext) return errortext return errortext } binarypath := filepath.Join(config.ourBinaryDir, config.CoreDNS.binaryFile) configpath := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile) coreDNSCommand = exec.Command(binarypath, "-conf", configpath, "-dns.port", fmt.Sprintf("%d", config.CoreDNS.Port)) coreDNSCommand.Stdout = os.Stdout
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move starting of coredns server into separate function
https://github.com/AdguardTeam/AdGuardHome/commit/33fbccf0badee8a4c5f790d850d85e161536779f
control.go
coreDNSCommand.Stdout = os.Stdout coreDNSCommand.Stderr = os.Stderr err = coreDNSCommand.Start() if err != nil { errortext := fmt.Sprintf("Unable to start coreDNS: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) return } log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid)
</s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid) </s> add </s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext
errortext := fmt.Errorf("Unable to start coreDNS: %s", err)
coreDNSCommand.Stdout = os.Stdout coreDNSCommand.Stderr = os.Stderr err = coreDNSCommand.Start() if err != nil { errortext := fmt.Errorf("Unable to start coreDNS: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) return } log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move starting of coredns server into separate function
https://github.com/AdguardTeam/AdGuardHome/commit/33fbccf0badee8a4c5f790d850d85e161536779f
control.go
err = coreDNSCommand.Start() if err != nil { errortext := fmt.Sprintf("Unable to start coreDNS: %s", err) log.Println(errortext) http.Error(w, errortext, http.StatusInternalServerError) return } log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid) fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid) go childwaiter() }
</s> remove fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid) </s> add </s> remove errortext := fmt.Sprintf("Unable to start coreDNS: %s", err) </s> add errortext := fmt.Errorf("Unable to start coreDNS: %s", err) </s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove errortext := fmt.Sprintf("Unable to write coredns config: %s", err) </s> add errortext := fmt.Errorf("Unable to write coredns config: %s", err)
return errortext
err = coreDNSCommand.Start() if err != nil { errortext := fmt.Sprintf("Unable to start coreDNS: %s", err) log.Println(errortext) return errortext return errortext } log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid) fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid) go childwaiter() }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move starting of coredns server into separate function
https://github.com/AdguardTeam/AdGuardHome/commit/33fbccf0badee8a4c5f790d850d85e161536779f
control.go
http.Error(w, errortext, http.StatusInternalServerError) return } log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid) fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid) go childwaiter() } func childwaiter() { err := coreDNSCommand.Wait()
</s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove errortext := fmt.Sprintf("Unable to start coreDNS: %s", err) </s> add errortext := fmt.Errorf("Unable to start coreDNS: %s", err) </s> remove func handleStart(w http.ResponseWriter, r *http.Request) { </s> add func startDNSServer() error { </s> remove http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400) return </s> add return fmt.Errorf("Unable to start coreDNS: Already running")
http.Error(w, errortext, http.StatusInternalServerError) return } log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid) go childwaiter() } func childwaiter() { err := coreDNSCommand.Wait()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Move starting of coredns server into separate function
https://github.com/AdguardTeam/AdGuardHome/commit/33fbccf0badee8a4c5f790d850d85e161536779f
control.go
} log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid) go childwaiter() } func childwaiter() { err := coreDNSCommand.Wait() log.Printf("coredns terminated: %s\n", err) err = coreDNSCommand.Process.Release()
</s> remove fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid) </s> add </s> remove http.Error(w, errortext, http.StatusInternalServerError) return </s> add return errortext </s> remove errortext := fmt.Sprintf("Unable to start coreDNS: %s", err) </s> add errortext := fmt.Errorf("Unable to start coreDNS: %s", err) </s> remove func handleStart(w http.ResponseWriter, r *http.Request) { </s> add func startDNSServer() error { </s> remove http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400) return </s> add return fmt.Errorf("Unable to start coreDNS: Already running")
return nil } func handleStart(w http.ResponseWriter, r *http.Request) { if isRunning() { http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400) return } err := startDNSServer() if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid)
} log.Printf("coredns PID: %v\n", coreDNSCommand.Process.Pid) go childwaiter() return nil } func handleStart(w http.ResponseWriter, r *http.Request) { if isRunning() { http.Error(w, fmt.Sprintf("Unable to start coreDNS: Already running"), 400) return } err := startDNSServer() if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } fmt.Fprintf(w, "OK, PID %d\n", coreDNSCommand.Process.Pid) } func childwaiter() { err := coreDNSCommand.Wait() log.Printf("coredns terminated: %s\n", err) err = coreDNSCommand.Process.Release()
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Move starting of coredns server into separate function
https://github.com/AdguardTeam/AdGuardHome/commit/33fbccf0badee8a4c5f790d850d85e161536779f
control.go
"updated_upstream_dns_toast": "Servidores DNS de subida guardados correctamente", "dns_test_ok_toast": "Los servidores DNS especificados funcionan correctamente", "dns_test_not_ok_toast": "Servidor \"{{key}}\": no se puede utilizar, por favor revisa si lo has escrito correctamente", "unblock": "Desbloquear", "block": "Bloquear", "disallow_this_client": "No permitir a este cliente", "allow_this_client": "Permitir a este cliente", "block_for_this_client_only": "Bloquear solo para este cliente", "unblock_for_this_client_only": "Desbloquear solo para este cliente",
</s> remove "encryption_server_desc": "Om HTTPS te gebruiken, moet je de servernaam invoeren die overeenkomt met je SSL-certificaat of jokerteken-certificaat. Als het veld niet is ingesteld, accepteert het TLS-verbindingen voor elk domein.", </s> add "encryption_server_desc": "Indien ingesteld, detecteert AdGuard Home Client-ID's, reageert op DDR-zoekopdrachten en voert aanvullende verbindingsvalidaties uit. Indien niet ingesteld, zijn deze functies uitgeschakeld. Moet overeenkomen met een van de DNS-namen in het certificaat.", </s> remove "encryption_server_desc": "Untuk menggunakan HTTPS, Anda harus memasukkan nama server yang cocok dengan sertifikat SSL Anda. Bila ruas tak ditata, akan menerima koneksi TLS bagi domain manapun.", </s> add "encryption_server_desc": "Jika disetel, AdGuard Home mendeteksi ClientID, merespons kueri DDR, dan melakukan validasi koneksi tambahan. Jika tidak disetel, fitur-fitur ini dinonaktifkan. Harus cocok dengan salah satu Nama DNS dalam sertifikat.",
"dns_test_warning_toast": "Upstream \"{{key}}\" no responde a las peticiones de prueba y es posible que no funcione correctamente",
"updated_upstream_dns_toast": "Servidores DNS de subida guardados correctamente", "dns_test_ok_toast": "Los servidores DNS especificados funcionan correctamente", "dns_test_not_ok_toast": "Servidor \"{{key}}\": no se puede utilizar, por favor revisa si lo has escrito correctamente", "dns_test_warning_toast": "Upstream \"{{key}}\" no responde a las peticiones de prueba y es posible que no funcione correctamente", "unblock": "Desbloquear", "block": "Bloquear", "disallow_this_client": "No permitir a este cliente", "allow_this_client": "Permitir a este cliente", "block_for_this_client_only": "Bloquear solo para este cliente", "unblock_for_this_client_only": "Desbloquear solo para este cliente",
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit 366600a32ecbb163ab43b43145898bbadcfbc2e9 Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:09:16 2022 +0300 client: fix si-lk commit 2a55ee3846251e53529f4ef6562e5f4939381eae Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:03:45 2022 +0300 client: upd i18n
https://github.com/AdguardTeam/AdGuardHome/commit/3420becce38e72ef3870f086a86342788ba9a8f8
client/src/__locales/es.json
"form_error_server_name": "Nama server tidak valid", "form_error_subnet": "Subnet \"{{cidr}}\" tidak berisi alamat IP \"{{ip}}\"", "form_error_positive": "Harus lebih dari 0", "out_of_range_error": "Harus di luar rentang \"{{start}}\"-\"{{end}}\"", "lower_range_start_error": "Harus lebih rendah dari rentang awal", "greater_range_start_error": "Harus lebih besar dari rentang awal", "greater_range_end_error": "Harus lebih besar dari rentang akhir", "subnet_error": "Alamat harus dalam satu subnet",
</s> remove "encryption_server_desc": "Untuk menggunakan HTTPS, Anda harus memasukkan nama server yang cocok dengan sertifikat SSL Anda. Bila ruas tak ditata, akan menerima koneksi TLS bagi domain manapun.", </s> add "encryption_server_desc": "Jika disetel, AdGuard Home mendeteksi ClientID, merespons kueri DDR, dan melakukan validasi koneksi tambahan. Jika tidak disetel, fitur-fitur ini dinonaktifkan. Harus cocok dengan salah satu Nama DNS dalam sertifikat.", </s> remove "encryption_server_desc": "Om HTTPS te gebruiken, moet je de servernaam invoeren die overeenkomt met je SSL-certificaat of jokerteken-certificaat. Als het veld niet is ingesteld, accepteert het TLS-verbindingen voor elk domein.", </s> add "encryption_server_desc": "Indien ingesteld, detecteert AdGuard Home Client-ID's, reageert op DDR-zoekopdrachten en voert aanvullende verbindingsvalidaties uit. Indien niet ingesteld, zijn deze functies uitgeschakeld. Moet overeenkomen met een van de DNS-namen in het certificaat.",
"form_error_gateway_ip": "Sewa tidak dapat memiliki alamat IP gateway",
"form_error_server_name": "Nama server tidak valid", "form_error_subnet": "Subnet \"{{cidr}}\" tidak berisi alamat IP \"{{ip}}\"", "form_error_positive": "Harus lebih dari 0", "form_error_gateway_ip": "Sewa tidak dapat memiliki alamat IP gateway", "out_of_range_error": "Harus di luar rentang \"{{start}}\"-\"{{end}}\"", "lower_range_start_error": "Harus lebih rendah dari rentang awal", "greater_range_start_error": "Harus lebih besar dari rentang awal", "greater_range_end_error": "Harus lebih besar dari rentang akhir", "subnet_error": "Alamat harus dalam satu subnet",
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit 366600a32ecbb163ab43b43145898bbadcfbc2e9 Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:09:16 2022 +0300 client: fix si-lk commit 2a55ee3846251e53529f4ef6562e5f4939381eae Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:03:45 2022 +0300 client: upd i18n
https://github.com/AdguardTeam/AdGuardHome/commit/3420becce38e72ef3870f086a86342788ba9a8f8
client/src/__locales/id.json
"all_lists_up_to_date_toast": "Semua daftar sudah diperbarui", "updated_upstream_dns_toast": "Server upstream berhasil disimpan", "dns_test_ok_toast": "Server DNS yang ditentukan bekerja dengan benar", "dns_test_not_ok_toast": "Server \"{{key}}\": tidak dapat digunakan, mohon cek bahwa Anda telah menulisnya dengan benar", "unblock": "Buka Blokir", "block": "Blok", "disallow_this_client": "Cabut ijin untuk klien ini", "allow_this_client": "Ijinkan klien ini", "block_for_this_client_only": "Blok hanya untuk klien ini", "unblock_for_this_client_only": "Jangan diblok hanya untuk klien ini",
</s> remove "encryption_server_desc": "Untuk menggunakan HTTPS, Anda harus memasukkan nama server yang cocok dengan sertifikat SSL Anda. Bila ruas tak ditata, akan menerima koneksi TLS bagi domain manapun.", </s> add "encryption_server_desc": "Jika disetel, AdGuard Home mendeteksi ClientID, merespons kueri DDR, dan melakukan validasi koneksi tambahan. Jika tidak disetel, fitur-fitur ini dinonaktifkan. Harus cocok dengan salah satu Nama DNS dalam sertifikat.", </s> remove "encryption_server_desc": "Om HTTPS te gebruiken, moet je de servernaam invoeren die overeenkomt met je SSL-certificaat of jokerteken-certificaat. Als het veld niet is ingesteld, accepteert het TLS-verbindingen voor elk domein.", </s> add "encryption_server_desc": "Indien ingesteld, detecteert AdGuard Home Client-ID's, reageert op DDR-zoekopdrachten en voert aanvullende verbindingsvalidaties uit. Indien niet ingesteld, zijn deze functies uitgeschakeld. Moet overeenkomen met een van de DNS-namen in het certificaat.",
"dns_test_warning_toast": "Upstream \"{{key}}\" tidak menanggapi permintaan pengujian dan mungkin tidak berfungsi dengan baik",
"all_lists_up_to_date_toast": "Semua daftar sudah diperbarui", "updated_upstream_dns_toast": "Server upstream berhasil disimpan", "dns_test_ok_toast": "Server DNS yang ditentukan bekerja dengan benar", "dns_test_not_ok_toast": "Server \"{{key}}\": tidak dapat digunakan, mohon cek bahwa Anda telah menulisnya dengan benar", "dns_test_warning_toast": "Upstream \"{{key}}\" tidak menanggapi permintaan pengujian dan mungkin tidak berfungsi dengan baik", "unblock": "Buka Blokir", "block": "Blok", "disallow_this_client": "Cabut ijin untuk klien ini", "allow_this_client": "Ijinkan klien ini", "block_for_this_client_only": "Blok hanya untuk klien ini", "unblock_for_this_client_only": "Jangan diblok hanya untuk klien ini",
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit 366600a32ecbb163ab43b43145898bbadcfbc2e9 Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:09:16 2022 +0300 client: fix si-lk commit 2a55ee3846251e53529f4ef6562e5f4939381eae Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:03:45 2022 +0300 client: upd i18n
https://github.com/AdguardTeam/AdGuardHome/commit/3420becce38e72ef3870f086a86342788ba9a8f8
client/src/__locales/id.json
"encryption_desc": "Enkripsi (HTTPS/QUIC/TLS) untuk DNS dan antarmuka admin", "encryption_config_saved": "Pengaturan enkripsi telah tersimpan", "encryption_server": "Nama server", "encryption_server_enter": "Masukkan nama domain anda", "encryption_server_desc": "Untuk menggunakan HTTPS, Anda harus memasukkan nama server yang cocok dengan sertifikat SSL Anda. Bila ruas tak ditata, akan menerima koneksi TLS bagi domain manapun.", "encryption_redirect": "Alihkan ke HTTPS secara otomatis", "encryption_redirect_desc": "Jika dicentang, AdGuard Home akan secara otomatis mengarahkan anda dari HTTP ke alamat HTTPS.", "encryption_https": "Port HTTPS", "encryption_https_desc": "Jika port HTTPS dikonfigurasi, antarmuka admin Home AdGuard akan dapat diakses melalui HTTPS, dan itu juga akan memberikan DNS-over-HTTPS di lokasi '/ dns-query'.", "encryption_dot": "Port DNS-over-TLS",
</s> remove "encryption_server_desc": "Om HTTPS te gebruiken, moet je de servernaam invoeren die overeenkomt met je SSL-certificaat of jokerteken-certificaat. Als het veld niet is ingesteld, accepteert het TLS-verbindingen voor elk domein.", </s> add "encryption_server_desc": "Indien ingesteld, detecteert AdGuard Home Client-ID's, reageert op DDR-zoekopdrachten en voert aanvullende verbindingsvalidaties uit. Indien niet ingesteld, zijn deze functies uitgeschakeld. Moet overeenkomen met een van de DNS-namen in het certificaat.",
"encryption_server_desc": "Jika disetel, AdGuard Home mendeteksi ClientID, merespons kueri DDR, dan melakukan validasi koneksi tambahan. Jika tidak disetel, fitur-fitur ini dinonaktifkan. Harus cocok dengan salah satu Nama DNS dalam sertifikat.",
"encryption_desc": "Enkripsi (HTTPS/QUIC/TLS) untuk DNS dan antarmuka admin", "encryption_config_saved": "Pengaturan enkripsi telah tersimpan", "encryption_server": "Nama server", "encryption_server_enter": "Masukkan nama domain anda", "encryption_server_desc": "Jika disetel, AdGuard Home mendeteksi ClientID, merespons kueri DDR, dan melakukan validasi koneksi tambahan. Jika tidak disetel, fitur-fitur ini dinonaktifkan. Harus cocok dengan salah satu Nama DNS dalam sertifikat.", "encryption_redirect": "Alihkan ke HTTPS secara otomatis", "encryption_redirect_desc": "Jika dicentang, AdGuard Home akan secara otomatis mengarahkan anda dari HTTP ke alamat HTTPS.", "encryption_https": "Port HTTPS", "encryption_https_desc": "Jika port HTTPS dikonfigurasi, antarmuka admin Home AdGuard akan dapat diakses melalui HTTPS, dan itu juga akan memberikan DNS-over-HTTPS di lokasi '/ dns-query'.", "encryption_dot": "Port DNS-over-TLS",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit 366600a32ecbb163ab43b43145898bbadcfbc2e9 Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:09:16 2022 +0300 client: fix si-lk commit 2a55ee3846251e53529f4ef6562e5f4939381eae Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:03:45 2022 +0300 client: upd i18n
https://github.com/AdguardTeam/AdGuardHome/commit/3420becce38e72ef3870f086a86342788ba9a8f8
client/src/__locales/id.json
"updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen", "dns_test_ok_toast": "Opgegeven DNS-servers werken correct", "dns_test_not_ok_toast": "Server \"{{key}}\": kon niet worden gebruikt, controleer of je het correct hebt geschreven", "unblock": "Deblokkeren", "block": "Blokkeren", "disallow_this_client": "Toepassing/systeem niet toelaten", "allow_this_client": "Toepassing/systeem toelaten",
</s> remove "encryption_server_desc": "Om HTTPS te gebruiken, moet je de servernaam invoeren die overeenkomt met je SSL-certificaat of jokerteken-certificaat. Als het veld niet is ingesteld, accepteert het TLS-verbindingen voor elk domein.", </s> add "encryption_server_desc": "Indien ingesteld, detecteert AdGuard Home Client-ID's, reageert op DDR-zoekopdrachten en voert aanvullende verbindingsvalidaties uit. Indien niet ingesteld, zijn deze functies uitgeschakeld. Moet overeenkomen met een van de DNS-namen in het certificaat.", </s> remove "encryption_server_desc": "Untuk menggunakan HTTPS, Anda harus memasukkan nama server yang cocok dengan sertifikat SSL Anda. Bila ruas tak ditata, akan menerima koneksi TLS bagi domain manapun.", </s> add "encryption_server_desc": "Jika disetel, AdGuard Home mendeteksi ClientID, merespons kueri DDR, dan melakukan validasi koneksi tambahan. Jika tidak disetel, fitur-fitur ini dinonaktifkan. Harus cocok dengan salah satu Nama DNS dalam sertifikat.",
"dns_test_warning_toast": "Upstream \"{{key}}\" reageert niet op testverzoeken en werkt mogelijk niet goed",
"updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen", "dns_test_ok_toast": "Opgegeven DNS-servers werken correct", "dns_test_not_ok_toast": "Server \"{{key}}\": kon niet worden gebruikt, controleer of je het correct hebt geschreven", "dns_test_warning_toast": "Upstream \"{{key}}\" reageert niet op testverzoeken en werkt mogelijk niet goed", "unblock": "Deblokkeren", "block": "Blokkeren", "disallow_this_client": "Toepassing/systeem niet toelaten", "allow_this_client": "Toepassing/systeem toelaten",
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit 366600a32ecbb163ab43b43145898bbadcfbc2e9 Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:09:16 2022 +0300 client: fix si-lk commit 2a55ee3846251e53529f4ef6562e5f4939381eae Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:03:45 2022 +0300 client: upd i18n
https://github.com/AdguardTeam/AdGuardHome/commit/3420becce38e72ef3870f086a86342788ba9a8f8
client/src/__locales/nl.json
"encryption_desc": "Encryptie (HTTPS/TLS) ondersteuning voor DNS en admin web interface", "encryption_config_saved": "Versleuteling configuratie opgeslagen", "encryption_server": "Server naam", "encryption_server_enter": "Voer domein naam in", "encryption_server_desc": "Om HTTPS te gebruiken, moet je de servernaam invoeren die overeenkomt met je SSL-certificaat of jokerteken-certificaat. Als het veld niet is ingesteld, accepteert het TLS-verbindingen voor elk domein.", "encryption_redirect": "Herleid automatisch naar HTTPS", "encryption_redirect_desc": "Indien ingeschakeld, zal AdGuard Home je automatisch herleiden van HTTP naar HTTPS.", "encryption_https": "HTTPS poort", "encryption_https_desc": "Als de HTTPS-poort is geconfigureerd, is de AdGuard Home beheerders interface toegankelijk via HTTPS en biedt deze ook DNS-via-HTTPS op de locatie '/ dns-query'.", "encryption_dot": "DNS-via-TLS poort",
</s> remove "encryption_server_desc": "Untuk menggunakan HTTPS, Anda harus memasukkan nama server yang cocok dengan sertifikat SSL Anda. Bila ruas tak ditata, akan menerima koneksi TLS bagi domain manapun.", </s> add "encryption_server_desc": "Jika disetel, AdGuard Home mendeteksi ClientID, merespons kueri DDR, dan melakukan validasi koneksi tambahan. Jika tidak disetel, fitur-fitur ini dinonaktifkan. Harus cocok dengan salah satu Nama DNS dalam sertifikat.",
"encryption_server_desc": "Indien ingesteld, detecteert AdGuard Home Client-ID's, reageert op DDR-zoekopdrachten en voert aanvullende verbindingsvalidaties uit. Indien niet ingesteld, zijn deze functies uitgeschakeld. Moet overeenkomen met een van de DNS-namen in het certificaat.",
"encryption_desc": "Encryptie (HTTPS/TLS) ondersteuning voor DNS en admin web interface", "encryption_config_saved": "Versleuteling configuratie opgeslagen", "encryption_server": "Server naam", "encryption_server_enter": "Voer domein naam in", "encryption_server_desc": "Indien ingesteld, detecteert AdGuard Home Client-ID's, reageert op DDR-zoekopdrachten en voert aanvullende verbindingsvalidaties uit. Indien niet ingesteld, zijn deze functies uitgeschakeld. Moet overeenkomen met een van de DNS-namen in het certificaat.", "encryption_redirect": "Herleid automatisch naar HTTPS", "encryption_redirect_desc": "Indien ingeschakeld, zal AdGuard Home je automatisch herleiden van HTTP naar HTTPS.", "encryption_https": "HTTPS poort", "encryption_https_desc": "Als de HTTPS-poort is geconfigureerd, is de AdGuard Home beheerders interface toegankelijk via HTTPS en biedt deze ook DNS-via-HTTPS op de locatie '/ dns-query'.", "encryption_dot": "DNS-via-TLS poort",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit 366600a32ecbb163ab43b43145898bbadcfbc2e9 Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:09:16 2022 +0300 client: fix si-lk commit 2a55ee3846251e53529f4ef6562e5f4939381eae Author: Ainar Garipov <[email protected]> Date: Wed Aug 3 15:03:45 2022 +0300 client: upd i18n
https://github.com/AdguardTeam/AdGuardHome/commit/3420becce38e72ef3870f086a86342788ba9a8f8
client/src/__locales/nl.json
npm install -g npm curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.23.8 ;; windows) choco install nvm nvm install node npm install -g npm ;; esac install: - |-
</s>
# Using NVS for managing Node.js versions on Windows NVS_HOME="C:\ProgramData" git clone --single-branch https://github.com/jasongin/nvs $NVS_HOME source $NVS_HOME/nvs.sh nvs add latest nvs use latest
npm install -g npm curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.23.8 ;; windows) # Using NVS for managing Node.js versions on Windows NVS_HOME="C:\ProgramData" git clone --single-branch https://github.com/jasongin/nvs $NVS_HOME source $NVS_HOME/nvs.sh nvs add latest nvs use latest # Using NVS for managing Node.js versions on Windows NVS_HOME="C:\ProgramData" git clone --single-branch https://github.com/jasongin/nvs $NVS_HOME source $NVS_HOME/nvs.sh nvs add latest nvs use latest # Using NVS for managing Node.js versions on Windows NVS_HOME="C:\ProgramData" git clone --single-branch https://github.com/jasongin/nvs $NVS_HOME source $NVS_HOME/nvs.sh nvs add latest nvs use latest ;; esac install: - |-
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
*: travis - use nvs on Windows
https://github.com/AdguardTeam/AdGuardHome/commit/344a0336b0f10451eb252c451a8c1e6baa836609
.travis.yml
case $TRAVIS_OS_NAME in linux | osx) npm --prefix client ci ;; windows) node --version
</s> remove choco install nvm nvm install node npm install -g npm </s> add # Using NVS for managing Node.js versions on Windows NVS_HOME="C:\ProgramData" git clone --single-branch https://github.com/jasongin/nvs $NVS_HOME source $NVS_HOME/nvs.sh nvs add latest nvs use latest
node --version npm --version
case $TRAVIS_OS_NAME in linux | osx) node --version npm --version npm --prefix client ci ;; windows) node --version
[ "keep", "add", "keep", "keep", "keep", "keep" ]
*: travis - use nvs on Windows
https://github.com/AdguardTeam/AdGuardHome/commit/344a0336b0f10451eb252c451a8c1e6baa836609
.travis.yml
;; windows) npm --prefix client ci ;; esac
</s> remove choco install nvm nvm install node npm install -g npm </s> add # Using NVS for managing Node.js versions on Windows NVS_HOME="C:\ProgramData" git clone --single-branch https://github.com/jasongin/nvs $NVS_HOME source $NVS_HOME/nvs.sh nvs add latest nvs use latest
node --version npm --version nvs --version
;; windows) node --version npm --version nvs --version npm --prefix client ci ;; esac
[ "keep", "add", "keep", "keep", "keep", "keep" ]
*: travis - use nvs on Windows
https://github.com/AdguardTeam/AdGuardHome/commit/344a0336b0f10451eb252c451a8c1e6baa836609
.travis.yml
"errors" "log" "strconv" "time" // ratelimiting and per-ip buckets "github.com/beefsack/go-rate" "github.com/patrickmn/go-cache"
</s> remove ratelimit int // in requests per second per IP </s> add ratelimit int // in requests per second per IP whitelist []string // a list of whitelisted IP addresses </s> remove func setup(c *caddy.Controller) error { </s> add func setupPlugin(c *caddy.Controller) (*plug, error) { </s> remove p.ratelimit = ratelimit </s> add </s> remove ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() </s> add for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } }
"sort"
"errors" "log" "sort" "strconv" "time" // ratelimiting and per-ip buckets "github.com/beefsack/go-rate" "github.com/patrickmn/go-cache"
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Added ratelimit whitelist and tests
https://github.com/AdguardTeam/AdGuardHome/commit/345e4dc89a18aa0dd0f63458755126cb3f2f4235
coredns_plugin/ratelimit/ratelimit.go
"golang.org/x/net/context" ) const defaultRatelimit = 100 const defaultMaxRateLimitedIPs = 1024 * 1024 var ( tokenBuckets = cache.New(time.Hour, time.Hour) )
</s> remove p.ratelimit = ratelimit </s> add </s> remove ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() </s> add for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } } </s> remove if len(args) <= 0 { continue </s> add if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit
"golang.org/x/net/context" ) const defaultRatelimit = 100 var ( tokenBuckets = cache.New(time.Hour, time.Hour) )
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Added ratelimit whitelist and tests
https://github.com/AdguardTeam/AdGuardHome/commit/345e4dc89a18aa0dd0f63458755126cb3f2f4235
coredns_plugin/ratelimit/ratelimit.go
func (p *plug) allowRequest(ip string) (bool, error) { if _, found := tokenBuckets.Get(ip); !found { tokenBuckets.Set(ip, rate.New(p.ratelimit, time.Second), time.Hour) } value, found := tokenBuckets.Get(ip) if !found {
</s> remove if len(args) <= 0 { continue </s> add if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit </s> remove ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() </s> add for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } } </s> remove func setup(c *caddy.Controller) error { </s> add func setupPlugin(c *caddy.Controller) (*plug, error) { </s> remove config := dnsserver.GetConfig(c) </s> add
if len(p.whitelist) > 0 && sort.SearchStrings(p.whitelist, ip) >= 0 { return true, nil }
func (p *plug) allowRequest(ip string) (bool, error) { if len(p.whitelist) > 0 && sort.SearchStrings(p.whitelist, ip) >= 0 { return true, nil } if _, found := tokenBuckets.Get(ip); !found { tokenBuckets.Set(ip, rate.New(p.ratelimit, time.Second), time.Hour) } value, found := tokenBuckets.Get(ip) if !found {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Added ratelimit whitelist and tests
https://github.com/AdguardTeam/AdGuardHome/commit/345e4dc89a18aa0dd0f63458755126cb3f2f4235
coredns_plugin/ratelimit/ratelimit.go
type plug struct { Next plugin.Handler // configuration for creating above ratelimit int // in requests per second per IP } func setup(c *caddy.Controller) error { p := &plug{ratelimit: defaultRatelimit} config := dnsserver.GetConfig(c)
</s> remove func setup(c *caddy.Controller) error { </s> add func setupPlugin(c *caddy.Controller) (*plug, error) { </s> remove config := dnsserver.GetConfig(c) </s> add </s> remove ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() </s> add for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } } </s> remove if len(args) <= 0 { continue </s> add if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit
ratelimit int // in requests per second per IP whitelist []string // a list of whitelisted IP addresses
type plug struct { Next plugin.Handler // configuration for creating above ratelimit int // in requests per second per IP whitelist []string // a list of whitelisted IP addresses } func setup(c *caddy.Controller) error { p := &plug{ratelimit: defaultRatelimit} config := dnsserver.GetConfig(c)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Added ratelimit whitelist and tests
https://github.com/AdguardTeam/AdGuardHome/commit/345e4dc89a18aa0dd0f63458755126cb3f2f4235
coredns_plugin/ratelimit/ratelimit.go
// configuration for creating above ratelimit int // in requests per second per IP } func setup(c *caddy.Controller) error { p := &plug{ratelimit: defaultRatelimit} config := dnsserver.GetConfig(c) for c.Next() { args := c.RemainingArgs()
</s> remove ratelimit int // in requests per second per IP </s> add ratelimit int // in requests per second per IP whitelist []string // a list of whitelisted IP addresses </s> remove config := dnsserver.GetConfig(c) </s> add </s> remove if len(args) <= 0 { continue </s> add if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit </s> remove ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() </s> add for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } }
func setupPlugin(c *caddy.Controller) (*plug, error) {
// configuration for creating above ratelimit int // in requests per second per IP } func setupPlugin(c *caddy.Controller) (*plug, error) { p := &plug{ratelimit: defaultRatelimit} config := dnsserver.GetConfig(c) for c.Next() { args := c.RemainingArgs()
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Added ratelimit whitelist and tests
https://github.com/AdguardTeam/AdGuardHome/commit/345e4dc89a18aa0dd0f63458755126cb3f2f4235
coredns_plugin/ratelimit/ratelimit.go
} func setup(c *caddy.Controller) error { p := &plug{ratelimit: defaultRatelimit} config := dnsserver.GetConfig(c) for c.Next() { args := c.RemainingArgs() if len(args) <= 0 { continue
</s> remove if len(args) <= 0 { continue </s> add if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit </s> remove func setup(c *caddy.Controller) error { </s> add func setupPlugin(c *caddy.Controller) (*plug, error) { </s> remove ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() </s> add for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } } </s> remove ratelimit int // in requests per second per IP </s> add ratelimit int // in requests per second per IP whitelist []string // a list of whitelisted IP addresses
} func setup(c *caddy.Controller) error { p := &plug{ratelimit: defaultRatelimit} for c.Next() { args := c.RemainingArgs() if len(args) <= 0 { continue
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Added ratelimit whitelist and tests
https://github.com/AdguardTeam/AdGuardHome/commit/345e4dc89a18aa0dd0f63458755126cb3f2f4235
coredns_plugin/ratelimit/ratelimit.go
config := dnsserver.GetConfig(c) for c.Next() { args := c.RemainingArgs() if len(args) <= 0 { continue } ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() }
</s> remove ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() </s> add for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } } </s> remove config := dnsserver.GetConfig(c) </s> add </s> remove p.ratelimit = ratelimit </s> add
if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit
config := dnsserver.GetConfig(c) for c.Next() { args := c.RemainingArgs() if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit } ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Added ratelimit whitelist and tests
https://github.com/AdguardTeam/AdGuardHome/commit/345e4dc89a18aa0dd0f63458755126cb3f2f4235
coredns_plugin/ratelimit/ratelimit.go
args := c.RemainingArgs() if len(args) <= 0 { continue } ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() } p.ratelimit = ratelimit } config.AddPlugin(func(next plugin.Handler) plugin.Handler {
</s> remove if len(args) <= 0 { continue </s> add if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit </s> remove p.ratelimit = ratelimit </s> add </s> remove config := dnsserver.GetConfig(c) </s> add
for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } }
args := c.RemainingArgs() if len(args) <= 0 { continue } for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } } for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } } for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } } } p.ratelimit = ratelimit } config.AddPlugin(func(next plugin.Handler) plugin.Handler {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Added ratelimit whitelist and tests
https://github.com/AdguardTeam/AdGuardHome/commit/345e4dc89a18aa0dd0f63458755126cb3f2f4235
coredns_plugin/ratelimit/ratelimit.go
ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() } p.ratelimit = ratelimit } config.AddPlugin(func(next plugin.Handler) plugin.Handler { p.Next = next return p
</s> remove ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() </s> add for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } } </s> remove if len(args) <= 0 { continue </s> add if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit </s> remove config := dnsserver.GetConfig(c) </s> add
ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() } } config.AddPlugin(func(next plugin.Handler) plugin.Handler { p.Next = next return p
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Added ratelimit whitelist and tests
https://github.com/AdguardTeam/AdGuardHome/commit/345e4dc89a18aa0dd0f63458755126cb3f2f4235
coredns_plugin/ratelimit/ratelimit.go
} } } config.AddPlugin(func(next plugin.Handler) plugin.Handler { p.Next = next return p })
</s> remove p.ratelimit = ratelimit </s> add </s> remove ratelimit, err := strconv.Atoi(args[0]) if err != nil { return c.ArgErr() </s> add for c.NextBlock() { switch c.Val() { case "whitelist": p.whitelist = c.RemainingArgs() if len(p.whitelist) > 0 { sort.Strings(p.whitelist) } } </s> remove if len(args) <= 0 { continue </s> add if len(args) > 0 { ratelimit, err := strconv.Atoi(args[0]) if err != nil { return nil, c.ArgErr() } p.ratelimit = ratelimit </s> remove config := dnsserver.GetConfig(c) </s> add
return p, nil } func setup(c *caddy.Controller) error { p, err := setupPlugin(c) if err != nil { return err } config := dnsserver.GetConfig(c)
} } } return p, nil } func setup(c *caddy.Controller) error { p, err := setupPlugin(c) if err != nil { return err } config := dnsserver.GetConfig(c) config.AddPlugin(func(next plugin.Handler) plugin.Handler { p.Next = next return p })
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Added ratelimit whitelist and tests
https://github.com/AdguardTeam/AdGuardHome/commit/345e4dc89a18aa0dd0f63458755126cb3f2f4235
coredns_plugin/ratelimit/ratelimit.go
// Go memory hacks memoryUsage(args) // print the first message after logger is configured log.Println(version.Full()) log.Debug("Current working directory is %s", Context.workDir) if args.runningAsService { log.Info("AdGuard Home is running as a service") }
</s> remove log.Debug("Current working directory is %s", Context.workDir) </s> add log.Debug("current working directory is %s", Context.workDir) </s> remove // When running as a Windows service, use eventlog by default if nothing else is configured // Otherwise, we'll simply loose the log output </s> add // When running as a Windows service, use eventlog by default if nothing // else is configured. Otherwise, we'll simply lose the log output. </s> remove // Make sure that we see the microseconds in logs, as networking stuff // can happen pretty quickly. </s> add // Make sure that we see the microseconds in logs, as networking stuff can // happen pretty quickly.
// Print the first message after logger is configured.
// Go memory hacks memoryUsage(args) // Print the first message after logger is configured. log.Println(version.Full()) log.Debug("Current working directory is %s", Context.workDir) if args.runningAsService { log.Info("AdGuard Home is running as a service") }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: 4046 darwin service message Merge in DNS/adguard-home from 4046-log-dir to master Closes #4046. Squashed commit of the following: commit 05140550b14f477f52487c575f56428ce9e6fa10 Author: Eugene Burkov <[email protected]> Date: Wed Jan 5 17:54:11 2022 +0500 all: add macOS service msg
https://github.com/AdguardTeam/AdGuardHome/commit/34c95f99f86df9dd8c0dcead98424add0523383f
internal/home/home.go
memoryUsage(args) // print the first message after logger is configured log.Println(version.Full()) log.Debug("Current working directory is %s", Context.workDir) if args.runningAsService { log.Info("AdGuard Home is running as a service") } setupContext(args)
</s> remove // print the first message after logger is configured </s> add // Print the first message after logger is configured. </s> remove // When running as a Windows service, use eventlog by default if nothing else is configured // Otherwise, we'll simply loose the log output </s> add // When running as a Windows service, use eventlog by default if nothing // else is configured. Otherwise, we'll simply lose the log output. </s> remove // Make sure that we see the microseconds in logs, as networking stuff // can happen pretty quickly. </s> add // Make sure that we see the microseconds in logs, as networking stuff can // happen pretty quickly.
log.Debug("current working directory is %s", Context.workDir)
memoryUsage(args) // print the first message after logger is configured log.Println(version.Full()) log.Debug("current working directory is %s", Context.workDir) if args.runningAsService { log.Info("AdGuard Home is running as a service") } setupContext(args)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: 4046 darwin service message Merge in DNS/adguard-home from 4046-log-dir to master Closes #4046. Squashed commit of the following: commit 05140550b14f477f52487c575f56428ce9e6fa10 Author: Eugene Burkov <[email protected]> Date: Wed Jan 5 17:54:11 2022 +0500 all: add macOS service msg
https://github.com/AdguardTeam/AdGuardHome/commit/34c95f99f86df9dd8c0dcead98424add0523383f
internal/home/home.go
if ls.Verbose { log.SetLevel(log.DEBUG) } // Make sure that we see the microseconds in logs, as networking stuff // can happen pretty quickly. log.SetFlags(log.LstdFlags | log.Lmicroseconds) if args.runningAsService && ls.LogFile == "" && runtime.GOOS == "windows" { // When running as a Windows service, use eventlog by default if nothing else is configured // Otherwise, we'll simply loose the log output
</s> remove // When running as a Windows service, use eventlog by default if nothing else is configured // Otherwise, we'll simply loose the log output </s> add // When running as a Windows service, use eventlog by default if nothing // else is configured. Otherwise, we'll simply lose the log output. </s> remove // print the first message after logger is configured </s> add // Print the first message after logger is configured. </s> remove log.Debug("Current working directory is %s", Context.workDir) </s> add log.Debug("current working directory is %s", Context.workDir)
// Make sure that we see the microseconds in logs, as networking stuff can // happen pretty quickly.
if ls.Verbose { log.SetLevel(log.DEBUG) } // Make sure that we see the microseconds in logs, as networking stuff can // happen pretty quickly. // Make sure that we see the microseconds in logs, as networking stuff can // happen pretty quickly. log.SetFlags(log.LstdFlags | log.Lmicroseconds) if args.runningAsService && ls.LogFile == "" && runtime.GOOS == "windows" { // When running as a Windows service, use eventlog by default if nothing else is configured // Otherwise, we'll simply loose the log output
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: 4046 darwin service message Merge in DNS/adguard-home from 4046-log-dir to master Closes #4046. Squashed commit of the following: commit 05140550b14f477f52487c575f56428ce9e6fa10 Author: Eugene Burkov <[email protected]> Date: Wed Jan 5 17:54:11 2022 +0500 all: add macOS service msg
https://github.com/AdguardTeam/AdGuardHome/commit/34c95f99f86df9dd8c0dcead98424add0523383f
internal/home/home.go
// can happen pretty quickly. log.SetFlags(log.LstdFlags | log.Lmicroseconds) if args.runningAsService && ls.LogFile == "" && runtime.GOOS == "windows" { // When running as a Windows service, use eventlog by default if nothing else is configured // Otherwise, we'll simply loose the log output ls.LogFile = configSyslog } // logs are written to stdout (default) if ls.LogFile == "" {
</s> remove // Make sure that we see the microseconds in logs, as networking stuff // can happen pretty quickly. </s> add // Make sure that we see the microseconds in logs, as networking stuff can // happen pretty quickly. </s> remove // print the first message after logger is configured </s> add // Print the first message after logger is configured. </s> remove log.Debug("Current working directory is %s", Context.workDir) </s> add log.Debug("current working directory is %s", Context.workDir)
// When running as a Windows service, use eventlog by default if nothing // else is configured. Otherwise, we'll simply lose the log output.
// can happen pretty quickly. log.SetFlags(log.LstdFlags | log.Lmicroseconds) if args.runningAsService && ls.LogFile == "" && runtime.GOOS == "windows" { // When running as a Windows service, use eventlog by default if nothing // else is configured. Otherwise, we'll simply lose the log output. // When running as a Windows service, use eventlog by default if nothing // else is configured. Otherwise, we'll simply lose the log output. ls.LogFile = configSyslog } // logs are written to stdout (default) if ls.LogFile == "" {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: 4046 darwin service message Merge in DNS/adguard-home from 4046-log-dir to master Closes #4046. Squashed commit of the following: commit 05140550b14f477f52487c575f56428ce9e6fa10 Author: Eugene Burkov <[email protected]> Date: Wed Jan 5 17:54:11 2022 +0500 all: add macOS service msg
https://github.com/AdguardTeam/AdGuardHome/commit/34c95f99f86df9dd8c0dcead98424add0523383f
internal/home/home.go
// On OpenWrt, the service utility may not exist. We use our service script // directly in this case. func svcAction(s service.Service, action string) (err error) { err = service.Control(s, action) if err != nil && service.Platform() == "unix-systemv" && (action == "start" || action == "stop" || action == "restart") { _, err = runInitdCommand(action)
</s> remove // When running as a Windows service, use eventlog by default if nothing else is configured // Otherwise, we'll simply loose the log output </s> add // When running as a Windows service, use eventlog by default if nothing // else is configured. Otherwise, we'll simply lose the log output. </s> remove // Make sure that we see the microseconds in logs, as networking stuff // can happen pretty quickly. </s> add // Make sure that we see the microseconds in logs, as networking stuff can // happen pretty quickly. </s> remove // print the first message after logger is configured </s> add // Print the first message after logger is configured. </s> remove log.Debug("Current working directory is %s", Context.workDir) </s> add log.Debug("current working directory is %s", Context.workDir)
if runtime.GOOS == "darwin" && action == "start" && !strings.HasPrefix(Context.workDir, "/Applications/") { log.Info("warning: service must be started from within the /Applications directory") }
// On OpenWrt, the service utility may not exist. We use our service script // directly in this case. func svcAction(s service.Service, action string) (err error) { if runtime.GOOS == "darwin" && action == "start" && !strings.HasPrefix(Context.workDir, "/Applications/") { log.Info("warning: service must be started from within the /Applications directory") } err = service.Control(s, action) if err != nil && service.Platform() == "unix-systemv" && (action == "start" || action == "stop" || action == "restart") { _, err = runInitdCommand(action)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: 4046 darwin service message Merge in DNS/adguard-home from 4046-log-dir to master Closes #4046. Squashed commit of the following: commit 05140550b14f477f52487c575f56428ce9e6fa10 Author: Eugene Burkov <[email protected]> Date: Wed Jan 5 17:54:11 2022 +0500 all: add macOS service msg
https://github.com/AdguardTeam/AdGuardHome/commit/34c95f99f86df9dd8c0dcead98424add0523383f
internal/home/service.go
Port int `json:"port"` } type firstRunData struct { Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` } func handleGetDefaultAddresses(w http.ResponseWriter, r *http.Request) { data := firstRunData{} ifaces, err := getValidNetInterfaces()
</s> remove // find an interface with an ipv4 address addr := findIPv4IfaceAddr(ifaces) if len(addr) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any interface with IPv4, plase try again later") return } data.Web.IP = addr data.DNS.IP = addr </s> add // fill out the fields
Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Interfaces map[string]interface{} `json:"interfaces"`
Port int `json:"port"` } type firstRunData struct { Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Interfaces map[string]interface{} `json:"interfaces"` Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Interfaces map[string]interface{} `json:"interfaces"` Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Interfaces map[string]interface{} `json:"interfaces"` Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Interfaces map[string]interface{} `json:"interfaces"` } func handleGetDefaultAddresses(w http.ResponseWriter, r *http.Request) { data := firstRunData{} ifaces, err := getValidNetInterfaces()
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
/install/get_default_addresses -- now it gives out list of interfaces
https://github.com/AdguardTeam/AdGuardHome/commit/34e14930deec600a24db4fb8ceaa1daa63776c1c
control.go
httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") return } // find an interface with an ipv4 address addr := findIPv4IfaceAddr(ifaces) if len(addr) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any interface with IPv4, plase try again later") return } data.Web.IP = addr data.DNS.IP = addr data.Web.Port = 3000 // TODO: find out if port 80 is available -- if not, fall back to 3000 data.DNS.Port = 53 // TODO: find out if port 53 is available -- if not, show a big warning w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(data)
</s> remove Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` </s> add Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Interfaces map[string]interface{} `json:"interfaces"`
// fill out the fields
httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later") return } // fill out the fields // fill out the fields // fill out the fields // fill out the fields // fill out the fields // fill out the fields // fill out the fields // fill out the fields data.Web.Port = 3000 // TODO: find out if port 80 is available -- if not, fall back to 3000 data.DNS.Port = 53 // TODO: find out if port 53 is available -- if not, show a big warning w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(data)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
/install/get_default_addresses -- now it gives out list of interfaces
https://github.com/AdguardTeam/AdGuardHome/commit/34e14930deec600a24db4fb8ceaa1daa63776c1c
control.go
// fill out the fields data.Web.Port = 3000 // TODO: find out if port 80 is available -- if not, fall back to 3000 data.DNS.Port = 53 // TODO: find out if port 53 is available -- if not, show a big warning w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(data) if err != nil { httpError(w, http.StatusInternalServerError, "Unable to marshal default addresses to json: %s", err)
</s> remove // find an interface with an ipv4 address addr := findIPv4IfaceAddr(ifaces) if len(addr) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any interface with IPv4, plase try again later") return } data.Web.IP = addr data.DNS.IP = addr </s> add // fill out the fields </s> remove Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` </s> add Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Interfaces map[string]interface{} `json:"interfaces"`
data.Interfaces = make(map[string]interface{}) for _, iface := range ifaces { data.Interfaces[iface.Name] = iface }
// fill out the fields data.Web.Port = 3000 // TODO: find out if port 80 is available -- if not, fall back to 3000 data.DNS.Port = 53 // TODO: find out if port 53 is available -- if not, show a big warning data.Interfaces = make(map[string]interface{}) for _, iface := range ifaces { data.Interfaces[iface.Name] = iface } w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(data) if err != nil { httpError(w, http.StatusInternalServerError, "Unable to marshal default addresses to json: %s", err)
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
/install/get_default_addresses -- now it gives out list of interfaces
https://github.com/AdguardTeam/AdGuardHome/commit/34e14930deec600a24db4fb8ceaa1daa63776c1c
control.go
spew.Dump(newSettings) config.firstRun = false config.BindHost = newSettings.Web.IP config.BindPort = newSettings.Web.Port config.DNS.BindHost = newSettings.DNS.IP
</s> remove // find an interface with an ipv4 address addr := findIPv4IfaceAddr(ifaces) if len(addr) == 0 { httpError(w, http.StatusServiceUnavailable, "Couldn't find any interface with IPv4, plase try again later") return } data.Web.IP = addr data.DNS.IP = addr </s> add // fill out the fields </s> remove Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` </s> add Web ipport `json:"web"` DNS ipport `json:"dns"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Interfaces map[string]interface{} `json:"interfaces"`
// TODO: validate that hosts and ports are bindable
spew.Dump(newSettings) // TODO: validate that hosts and ports are bindable config.firstRun = false config.BindHost = newSettings.Web.IP config.BindPort = newSettings.Web.Port config.DNS.BindHost = newSettings.DNS.IP
[ "keep", "add", "keep", "keep", "keep", "keep" ]
/install/get_default_addresses -- now it gives out list of interfaces
https://github.com/AdguardTeam/AdGuardHome/commit/34e14930deec600a24db4fb8ceaa1daa63776c1c
control.go
return nil } // Upd returns the channel into which the updates are sent. The receivable // map's values are guaranteed to be of type of *stringutil.Set. func (hc *HostsContainer) Upd() (updates <-chan *netutil.IPMap) { return hc.updates } // pathsToPatterns converts paths into patterns compatible with fs.Glob.
</s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil </s> remove // Return true if every value from the IP map has no discrepancies with the // appropriate one from the target. return !ok </s> add return ok </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove log.Debug("clients: added %d client aliases from system hosts-file", n) </s> add log.Debug("clients: added %d client aliases from system hosts file", n)
// map's values are guaranteed to be of type of *HostsRecord.
return nil } // Upd returns the channel into which the updates are sent. The receivable // map's values are guaranteed to be of type of *HostsRecord. func (hc *HostsContainer) Upd() (updates <-chan *netutil.IPMap) { return hc.updates } // pathsToPatterns converts paths into patterns compatible with fs.Glob.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
if ip == nil || len(hosts) == 0 { continue } hp.addPairs(ip, hosts) } return nil, true, s.Err() }
</s> remove processed := strings.Join(append([]string{ip.String()}, hosts...), " ") for _, h := range hosts { if set.Has(h) { </s> add for _, host := range hosts { if rec.Canonical == host || rec.Aliases.Has(host) { </s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil </s> remove hosts, ok := v.(*stringutil.Set) </s> add rec, ok := v.(*aghnet.HostsRecord) </s> remove hp.table.Range(func(ip net.IP, b interface{}) (cont bool) { // ok is set to true if the target doesn't contain ip or if the // appropriate hosts set isn't equal to the checked one. if a, hasIP := target.Get(ip); !hasIP { ok = true } else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) </s> add hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false
hp.addRecord(ip, hosts)
if ip == nil || len(hosts) == 0 { continue } hp.addRecord(ip, hosts) } return nil, true, s.Err() }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
return ip, hosts } // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) } var set *stringutil.Set set, ok = v.(*stringutil.Set) if !ok {
</s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove hp.table.Range(func(ip net.IP, b interface{}) (cont bool) { // ok is set to true if the target doesn't contain ip or if the // appropriate hosts set isn't equal to the checked one. if a, hasIP := target.Get(ip); !hasIP { ok = true } else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) </s> add hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false </s> remove // Return true if every value from the IP map has no discrepancies with the // appropriate one from the target. return !ok </s> add return ok
// HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil
return ip, hosts } // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil } var set *stringutil.Set set, ok = v.(*stringutil.Set) if !ok {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
v = stringutil.NewSet() hp.table.Set(ip, v) } var set *stringutil.Set set, ok = v.(*stringutil.Set) if !ok { log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) return }
</s> remove log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) </s> add rec = &HostsRecord{ Aliases: stringutil.NewSet(), } </s> remove return </s> add rec.Canonical, hosts = hosts[0], hosts[1:] hp.addRules(ip, rec.Canonical, line) hp.table.Set(ip, rec) } else { rec, ok = v.(*HostsRecord) if !ok { log.Error("%s: adding pairs: unexpected type %T", hostsContainerPref, v) return } </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) require.True(t, ok) </s> add require.IsType(t, (*HostsRecord)(nil), v) </s> remove // Continue only if maps has no discrepancies. return !ok </s> add var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok </s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil
return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip)
v = stringutil.NewSet() hp.table.Set(ip, v) } return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) if !ok { log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) return }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
var set *stringutil.Set set, ok = v.(*stringutil.Set) if !ok { log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) return } processed := strings.Join(append([]string{ip.String()}, hosts...), " ")
</s> remove return </s> add rec.Canonical, hosts = hosts[0], hosts[1:] hp.addRules(ip, rec.Canonical, line) hp.table.Set(ip, rec) } else { rec, ok = v.(*HostsRecord) if !ok { log.Error("%s: adding pairs: unexpected type %T", hostsContainerPref, v) return } </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove // Continue only if maps has no discrepancies. return !ok </s> add var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) require.True(t, ok) </s> add require.IsType(t, (*HostsRecord)(nil), v) </s> remove processed := strings.Join(append([]string{ip.String()}, hosts...), " ") for _, h := range hosts { if set.Has(h) { </s> add for _, host := range hosts { if rec.Canonical == host || rec.Aliases.Has(host) {
rec = &HostsRecord{ Aliases: stringutil.NewSet(), }
var set *stringutil.Set set, ok = v.(*stringutil.Set) if !ok { rec = &HostsRecord{ Aliases: stringutil.NewSet(), } return } processed := strings.Join(append([]string{ip.String()}, hosts...), " ")
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
set, ok = v.(*stringutil.Set) if !ok { log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) return } processed := strings.Join(append([]string{ip.String()}, hosts...), " ") for _, h := range hosts { if set.Has(h) {
</s> remove log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) </s> add rec = &HostsRecord{ Aliases: stringutil.NewSet(), } </s> remove processed := strings.Join(append([]string{ip.String()}, hosts...), " ") for _, h := range hosts { if set.Has(h) { </s> add for _, host := range hosts { if rec.Canonical == host || rec.Aliases.Has(host) { </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove // Continue only if maps has no discrepancies. return !ok </s> add var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok </s> remove set.Add(h) </s> add rec.Aliases.Add(host)
rec.Canonical, hosts = hosts[0], hosts[1:] hp.addRules(ip, rec.Canonical, line) hp.table.Set(ip, rec) } else { rec, ok = v.(*HostsRecord) if !ok { log.Error("%s: adding pairs: unexpected type %T", hostsContainerPref, v) return }
set, ok = v.(*stringutil.Set) if !ok { log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) rec.Canonical, hosts = hosts[0], hosts[1:] hp.addRules(ip, rec.Canonical, line) hp.table.Set(ip, rec) } else { rec, ok = v.(*HostsRecord) if !ok { log.Error("%s: adding pairs: unexpected type %T", hostsContainerPref, v) return } } processed := strings.Join(append([]string{ip.String()}, hosts...), " ") for _, h := range hosts { if set.Has(h) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
return } processed := strings.Join(append([]string{ip.String()}, hosts...), " ") for _, h := range hosts { if set.Has(h) { continue } set.Add(h)
</s> remove return </s> add rec.Canonical, hosts = hosts[0], hosts[1:] hp.addRules(ip, rec.Canonical, line) hp.table.Set(ip, rec) } else { rec, ok = v.(*HostsRecord) if !ok { log.Error("%s: adding pairs: unexpected type %T", hostsContainerPref, v) return } </s> remove log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) </s> add rec = &HostsRecord{ Aliases: stringutil.NewSet(), } </s> remove set.Add(h) </s> add rec.Aliases.Add(host) </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove rule, rulePtr := hp.writeRules(h, ip) hp.translations[rule], hp.translations[rulePtr] = processed, processed log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, h) </s> add hp.addRules(ip, host, line)
for _, host := range hosts { if rec.Canonical == host || rec.Aliases.Has(host) {
return } for _, host := range hosts { if rec.Canonical == host || rec.Aliases.Has(host) { for _, host := range hosts { if rec.Canonical == host || rec.Aliases.Has(host) { for _, host := range hosts { if rec.Canonical == host || rec.Aliases.Has(host) { continue } set.Add(h)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
if set.Has(h) { continue } set.Add(h) rule, rulePtr := hp.writeRules(h, ip) hp.translations[rule], hp.translations[rulePtr] = processed, processed log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, h)
</s> remove rule, rulePtr := hp.writeRules(h, ip) hp.translations[rule], hp.translations[rulePtr] = processed, processed log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, h) </s> add hp.addRules(ip, host, line) </s> remove processed := strings.Join(append([]string{ip.String()}, hosts...), " ") for _, h := range hosts { if set.Has(h) { </s> add for _, host := range hosts { if rec.Canonical == host || rec.Aliases.Has(host) { </s> remove return </s> add rec.Canonical, hosts = hosts[0], hosts[1:] hp.addRules(ip, rec.Canonical, line) hp.table.Set(ip, rec) } else { rec, ok = v.(*HostsRecord) if !ok { log.Error("%s: adding pairs: unexpected type %T", hostsContainerPref, v) return } </s> remove log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) </s> add rec = &HostsRecord{ Aliases: stringutil.NewSet(), }
rec.Aliases.Add(host)
if set.Has(h) { continue } rec.Aliases.Add(host) rule, rulePtr := hp.writeRules(h, ip) hp.translations[rule], hp.translations[rulePtr] = processed, processed log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, h)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
} set.Add(h) rule, rulePtr := hp.writeRules(h, ip) hp.translations[rule], hp.translations[rulePtr] = processed, processed log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, h) } } // writeRules writes the actual rule for the qtype and the PTR for the host-ip // pair into internal builders.
</s> remove set.Add(h) </s> add rec.Aliases.Add(host) </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil </s> remove log.Debug("clients: added %d client aliases from system hosts-file", n) </s> add log.Debug("clients: added %d client aliases from system hosts file", n)
hp.addRules(ip, host, line)
} set.Add(h) hp.addRules(ip, host, line) hp.addRules(ip, host, line) hp.addRules(ip, host, line) hp.addRules(ip, host, line) } } // writeRules writes the actual rule for the qtype and the PTR for the host-ip // pair into internal builders.
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
} // writeRules writes the actual rule for the qtype and the PTR for the host-ip // pair into internal builders. func (hp *hostsParser) writeRules(host string, ip net.IP) (rule, rulePtr string) { arpa, err := netutil.IPToReversedAddr(ip) if err != nil { return "", ""
</s> remove rule, rulePtr := hp.writeRules(h, ip) hp.translations[rule], hp.translations[rulePtr] = processed, processed log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, h) </s> add hp.addRules(ip, host, line) </s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove // defined by refreshIvl. It disables auto-resfreshing if refreshIvl is 0. If </s> add // defined by refreshIvl. It disables auto-refreshing if refreshIvl is 0. If
// addRules adds rules and rule translations for the line. func (hp *hostsParser) addRules(ip net.IP, host, line string) { rule, rulePtr := hp.writeRules(host, ip) hp.translations[rule], hp.translations[rulePtr] = line, line log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, host) }
} // addRules adds rules and rule translations for the line. func (hp *hostsParser) addRules(ip net.IP, host, line string) { rule, rulePtr := hp.writeRules(host, ip) hp.translations[rule], hp.translations[rulePtr] = line, line log.Debug("%s: added ip-host pair %q-%q", hostsContainerPref, ip, host) } // writeRules writes the actual rule for the qtype and the PTR for the host-ip // pair into internal builders. func (hp *hostsParser) writeRules(host string, ip net.IP) (rule, rulePtr string) { arpa, err := netutil.IPToReversedAddr(ip) if err != nil { return "", ""
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
} // equalSet returns true if the internal hosts table just parsed equals target. func (hp *hostsParser) equalSet(target *netutil.IPMap) (ok bool) { if target == nil { // hp.table shouldn't appear nil since it's initialized on each refresh. return target == hp.table
</s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil </s> remove // Return true if every value from the IP map has no discrepancies with the // appropriate one from the target. return !ok </s> add return ok </s> remove hp.table.Range(func(ip net.IP, b interface{}) (cont bool) { // ok is set to true if the target doesn't contain ip or if the // appropriate hosts set isn't equal to the checked one. if a, hasIP := target.Get(ip); !hasIP { ok = true } else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) </s> add hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false </s> remove hp.addPairs(ip, hosts) </s> add hp.addRecord(ip, hosts)
// target's values must be of type *HostsRecord.
} // equalSet returns true if the internal hosts table just parsed equals target. // target's values must be of type *HostsRecord. func (hp *hostsParser) equalSet(target *netutil.IPMap) (ok bool) { if target == nil { // hp.table shouldn't appear nil since it's initialized on each refresh. return target == hp.table
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
if hp.table.Len() != target.Len() { return false } hp.table.Range(func(ip net.IP, b interface{}) (cont bool) { // ok is set to true if the target doesn't contain ip or if the // appropriate hosts set isn't equal to the checked one. if a, hasIP := target.Get(ip); !hasIP { ok = true } else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) } // Continue only if maps has no discrepancies. return !ok })
</s> remove // Continue only if maps has no discrepancies. return !ok </s> add var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok </s> remove // Return true if every value from the IP map has no discrepancies with the // appropriate one from the target. return !ok </s> add return ok </s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove hosts, ok := v.(*stringutil.Set) </s> add rec, ok := v.(*aghnet.HostsRecord)
hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false
if hp.table.Len() != target.Len() { return false } hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false } // Continue only if maps has no discrepancies. return !ok })
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
} else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) } // Continue only if maps has no discrepancies. return !ok }) // Return true if every value from the IP map has no discrepancies with the // appropriate one from the target. return !ok
</s> remove // Return true if every value from the IP map has no discrepancies with the // appropriate one from the target. return !ok </s> add return ok </s> remove hp.table.Range(func(ip net.IP, b interface{}) (cont bool) { // ok is set to true if the target doesn't contain ip or if the // appropriate hosts set isn't equal to the checked one. if a, hasIP := target.Get(ip); !hasIP { ok = true } else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) </s> add hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove log.Debug("clients: added %d client aliases from system hosts-file", n) </s> add log.Debug("clients: added %d client aliases from system hosts file", n) </s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil
var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok
} else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) } var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok }) // Return true if every value from the IP map has no discrepancies with the // appropriate one from the target. return !ok
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
// Continue only if maps has no discrepancies. return !ok }) // Return true if every value from the IP map has no discrepancies with the // appropriate one from the target. return !ok } // sendUpd tries to send the parsed data to the ch. func (hp *hostsParser) sendUpd(ch chan *netutil.IPMap) { log.Debug("%s: sending upd", hostsContainerPref)
</s> remove // Continue only if maps has no discrepancies. return !ok </s> add var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok </s> remove hp.table.Range(func(ip net.IP, b interface{}) (cont bool) { // ok is set to true if the target doesn't contain ip or if the // appropriate hosts set isn't equal to the checked one. if a, hasIP := target.Get(ip); !hasIP { ok = true } else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) </s> add hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove log.Debug("clients: added %d client aliases from system hosts-file", n) </s> add log.Debug("clients: added %d client aliases from system hosts file", n)
return ok
// Continue only if maps has no discrepancies. return !ok }) return ok return ok return ok } // sendUpd tries to send the parsed data to the ch. func (hp *hostsParser) sendUpd(ch chan *netutil.IPMap) { log.Debug("%s: sending upd", hostsContainerPref)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer.go
"time" "github.com/AdguardTeam/AdGuardHome/internal/aghtest" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/stringutil" "github.com/AdguardTeam/golibs/testutil" "github.com/AdguardTeam/urlfilter" "github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns" "github.com/stretchr/testify/assert"
</s> remove log.Debug("clients: added %d client aliases from system hosts-file", n) </s> add log.Debug("clients: added %d client aliases from system hosts file", n) </s> remove hosts.Range(func(name string) (cont bool) { if clients.addHostLocked(ip, name, ClientSourceHostsFile) { n++ } return true }) </s> add clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++ </s> remove }, { </s> add name: "hello_alias", </s> remove Hostname: "simplehost", </s> add Hostname: "hello.world", </s> remove name: "simple", </s> add }, {
"github.com/AdguardTeam/golibs/netutil"
"time" "github.com/AdguardTeam/AdGuardHome/internal/aghtest" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/netutil" "github.com/AdguardTeam/golibs/stringutil" "github.com/AdguardTeam/golibs/testutil" "github.com/AdguardTeam/urlfilter" "github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns" "github.com/stretchr/testify/assert"
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
hc, err := NewHostsContainer(0, testFS, w, "dir") require.NoError(t, err) testutil.CleanupAndRequireSuccess(t, hc.Close) checkRefresh := func(t *testing.T, wantHosts *stringutil.Set) { upd, ok := <-hc.Upd() require.True(t, ok) require.NotNil(t, upd) assert.Equal(t, 1, upd.Len()) v, ok := upd.Get(ip) require.True(t, ok)
</s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) require.True(t, ok) </s> add require.IsType(t, (*HostsRecord)(nil), v) </s> remove assert.True(t, set.Equal(wantHosts)) </s> add rec, _ := v.(*HostsRecord) require.NotNil(t, rec) assert.Truef(t, rec.Equal(want), "%+v != %+v", rec, want) </s> remove hosts, ok := v.(*stringutil.Set) </s> add rec, ok := v.(*aghnet.HostsRecord) </s> remove var rc *RuntimeClient rc, ok = clients.findRuntimeClientLocked(ip) </s> add rc, ok := clients.findRuntimeClientLocked(ip)
checkRefresh := func(t *testing.T, want *HostsRecord) { t.Helper() var ok bool var upd *netutil.IPMap select { case upd, ok = <-hc.Upd(): require.True(t, ok) require.NotNil(t, upd) case <-time.After(1 * time.Second): t.Fatal("did not receive after 1s") }
hc, err := NewHostsContainer(0, testFS, w, "dir") require.NoError(t, err) testutil.CleanupAndRequireSuccess(t, hc.Close) checkRefresh := func(t *testing.T, want *HostsRecord) { t.Helper() var ok bool var upd *netutil.IPMap select { case upd, ok = <-hc.Upd(): require.True(t, ok) require.NotNil(t, upd) case <-time.After(1 * time.Second): t.Fatal("did not receive after 1s") } checkRefresh := func(t *testing.T, want *HostsRecord) { t.Helper() var ok bool var upd *netutil.IPMap select { case upd, ok = <-hc.Upd(): require.True(t, ok) require.NotNil(t, upd) case <-time.After(1 * time.Second): t.Fatal("did not receive after 1s") } checkRefresh := func(t *testing.T, want *HostsRecord) { t.Helper() var ok bool var upd *netutil.IPMap select { case upd, ok = <-hc.Upd(): require.True(t, ok) require.NotNil(t, upd) case <-time.After(1 * time.Second): t.Fatal("did not receive after 1s") } checkRefresh := func(t *testing.T, want *HostsRecord) { t.Helper() var ok bool var upd *netutil.IPMap select { case upd, ok = <-hc.Upd(): require.True(t, ok) require.NotNil(t, upd) case <-time.After(1 * time.Second): t.Fatal("did not receive after 1s") } assert.Equal(t, 1, upd.Len()) v, ok := upd.Get(ip) require.True(t, ok)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
v, ok := upd.Get(ip) require.True(t, ok) var set *stringutil.Set set, ok = v.(*stringutil.Set) require.True(t, ok) assert.True(t, set.Equal(wantHosts)) } t.Run("initial_refresh", func(t *testing.T) {
</s> remove assert.True(t, set.Equal(wantHosts)) </s> add rec, _ := v.(*HostsRecord) require.NotNil(t, rec) assert.Truef(t, rec.Equal(want), "%+v != %+v", rec, want) </s> remove checkRefresh := func(t *testing.T, wantHosts *stringutil.Set) { upd, ok := <-hc.Upd() require.True(t, ok) require.NotNil(t, upd) </s> add checkRefresh := func(t *testing.T, want *HostsRecord) { t.Helper() var ok bool var upd *netutil.IPMap select { case upd, ok = <-hc.Upd(): require.True(t, ok) require.NotNil(t, upd) case <-time.After(1 * time.Second): t.Fatal("did not receive after 1s") } </s> remove checkRefresh(t, stringutil.NewSet("hostname")) </s> add checkRefresh(t, &HostsRecord{ Aliases: stringutil.NewSet(), Canonical: "hostname", }) </s> remove log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) </s> add rec = &HostsRecord{ Aliases: stringutil.NewSet(), } </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip)
require.IsType(t, (*HostsRecord)(nil), v)
v, ok := upd.Get(ip) require.True(t, ok) require.IsType(t, (*HostsRecord)(nil), v) require.IsType(t, (*HostsRecord)(nil), v) require.IsType(t, (*HostsRecord)(nil), v) assert.True(t, set.Equal(wantHosts)) } t.Run("initial_refresh", func(t *testing.T) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
var set *stringutil.Set set, ok = v.(*stringutil.Set) require.True(t, ok) assert.True(t, set.Equal(wantHosts)) } t.Run("initial_refresh", func(t *testing.T) { checkRefresh(t, stringutil.NewSet("hostname")) })
</s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) require.True(t, ok) </s> add require.IsType(t, (*HostsRecord)(nil), v) </s> remove checkRefresh(t, stringutil.NewSet("hostname")) </s> add checkRefresh(t, &HostsRecord{ Aliases: stringutil.NewSet(), Canonical: "hostname", }) </s> remove checkRefresh := func(t *testing.T, wantHosts *stringutil.Set) { upd, ok := <-hc.Upd() require.True(t, ok) require.NotNil(t, upd) </s> add checkRefresh := func(t *testing.T, want *HostsRecord) { t.Helper() var ok bool var upd *netutil.IPMap select { case upd, ok = <-hc.Upd(): require.True(t, ok) require.NotNil(t, upd) case <-time.After(1 * time.Second): t.Fatal("did not receive after 1s") } </s> remove checkRefresh(t, stringutil.NewSet("hostname", "alias")) </s> add checkRefresh(t, &HostsRecord{ Aliases: stringutil.NewSet("alias"), Canonical: "hostname", }) </s> remove log.Debug("%s: adding pairs: unexpected value type %T", hostsContainerPref, v) </s> add rec = &HostsRecord{ Aliases: stringutil.NewSet(), }
rec, _ := v.(*HostsRecord) require.NotNil(t, rec) assert.Truef(t, rec.Equal(want), "%+v != %+v", rec, want)
var set *stringutil.Set set, ok = v.(*stringutil.Set) require.True(t, ok) rec, _ := v.(*HostsRecord) require.NotNil(t, rec) assert.Truef(t, rec.Equal(want), "%+v != %+v", rec, want) } t.Run("initial_refresh", func(t *testing.T) { checkRefresh(t, stringutil.NewSet("hostname")) })
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
assert.True(t, set.Equal(wantHosts)) } t.Run("initial_refresh", func(t *testing.T) { checkRefresh(t, stringutil.NewSet("hostname")) }) t.Run("second_refresh", func(t *testing.T) { testFS["dir/file2"] = &fstest.MapFile{Data: []byte(ipStr + ` alias` + nl)} eventsCh <- event{}
</s> remove checkRefresh(t, stringutil.NewSet("hostname", "alias")) </s> add checkRefresh(t, &HostsRecord{ Aliases: stringutil.NewSet("alias"), Canonical: "hostname", }) </s> remove assert.True(t, set.Equal(wantHosts)) </s> add rec, _ := v.(*HostsRecord) require.NotNil(t, rec) assert.Truef(t, rec.Equal(want), "%+v != %+v", rec, want) </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) require.True(t, ok) </s> add require.IsType(t, (*HostsRecord)(nil), v) </s> remove checkRefresh := func(t *testing.T, wantHosts *stringutil.Set) { upd, ok := <-hc.Upd() require.True(t, ok) require.NotNil(t, upd) </s> add checkRefresh := func(t *testing.T, want *HostsRecord) { t.Helper() var ok bool var upd *netutil.IPMap select { case upd, ok = <-hc.Upd(): require.True(t, ok) require.NotNil(t, upd) case <-time.After(1 * time.Second): t.Fatal("did not receive after 1s") } </s> remove hosts.Range(func(name string) (cont bool) { if clients.addHostLocked(ip, name, ClientSourceHostsFile) { n++ } return true }) </s> add clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++
checkRefresh(t, &HostsRecord{ Aliases: stringutil.NewSet(), Canonical: "hostname", })
assert.True(t, set.Equal(wantHosts)) } t.Run("initial_refresh", func(t *testing.T) { checkRefresh(t, &HostsRecord{ Aliases: stringutil.NewSet(), Canonical: "hostname", }) }) t.Run("second_refresh", func(t *testing.T) { testFS["dir/file2"] = &fstest.MapFile{Data: []byte(ipStr + ` alias` + nl)} eventsCh <- event{}
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
t.Run("second_refresh", func(t *testing.T) { testFS["dir/file2"] = &fstest.MapFile{Data: []byte(ipStr + ` alias` + nl)} eventsCh <- event{} checkRefresh(t, stringutil.NewSet("hostname", "alias")) }) t.Run("double_refresh", func(t *testing.T) { // Make a change once. testFS["dir/file1"] = &fstest.MapFile{Data: []byte(ipStr + ` alias` + nl)}
</s> remove checkRefresh(t, stringutil.NewSet("hostname")) </s> add checkRefresh(t, &HostsRecord{ Aliases: stringutil.NewSet(), Canonical: "hostname", }) </s> remove assert.True(t, set.Equal(wantHosts)) </s> add rec, _ := v.(*HostsRecord) require.NotNil(t, rec) assert.Truef(t, rec.Equal(want), "%+v != %+v", rec, want) </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) require.True(t, ok) </s> add require.IsType(t, (*HostsRecord)(nil), v) </s> remove checkRefresh := func(t *testing.T, wantHosts *stringutil.Set) { upd, ok := <-hc.Upd() require.True(t, ok) require.NotNil(t, upd) </s> add checkRefresh := func(t *testing.T, want *HostsRecord) { t.Helper() var ok bool var upd *netutil.IPMap select { case upd, ok = <-hc.Upd(): require.True(t, ok) require.NotNil(t, upd) case <-time.After(1 * time.Second): t.Fatal("did not receive after 1s") } </s> remove var rc *RuntimeClient rc, ok = clients.findRuntimeClientLocked(ip) </s> add rc, ok := clients.findRuntimeClientLocked(ip)
checkRefresh(t, &HostsRecord{ Aliases: stringutil.NewSet("alias"), Canonical: "hostname", })
t.Run("second_refresh", func(t *testing.T) { testFS["dir/file2"] = &fstest.MapFile{Data: []byte(ipStr + ` alias` + nl)} eventsCh <- event{} checkRefresh(t, &HostsRecord{ Aliases: stringutil.NewSet("alias"), Canonical: "hostname", }) }) t.Run("double_refresh", func(t *testing.T) { // Make a change once. testFS["dir/file1"] = &fstest.MapFile{Data: []byte(ipStr + ` alias` + nl)}
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
require.NoError(t, fstest.TestFS(testdata, "etc_hosts")) testCases := []struct { want []*rules.DNSRewrite name string req *urlfilter.DNSRequest }{{ want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, Value: net.IPv4(1, 0, 0, 1),
</s> remove }, { </s> add name: "other_line_alias", </s> remove }, { </s> add name: "hello_alias",
require.NoError(t, fstest.TestFS(testdata, "etc_hosts")) testCases := []struct { req *urlfilter.DNSRequest }{{ want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, Value: net.IPv4(1, 0, 0, 1),
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
require.NoError(t, fstest.TestFS(testdata, "etc_hosts")) testCases := []struct { req *urlfilter.DNSRequest }{{ req: &urlfilter.DNSRequest{ Hostname: "simplehost", DNSType: dns.TypeA, },
</s> remove want []*rules.DNSRewrite name string </s> add </s> remove name: "simple", </s> add }, { </s> remove Hostname: "simplehost", </s> add Hostname: "hello.world", </s> remove }, { </s> add name: "hello_alias",
name string want []*rules.DNSRewrite
require.NoError(t, fstest.TestFS(testdata, "etc_hosts")) testCases := []struct { req *urlfilter.DNSRequest name string want []*rules.DNSRewrite }{{ req: &urlfilter.DNSRequest{ Hostname: "simplehost", DNSType: dns.TypeA, },
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
req *urlfilter.DNSRequest name string want []*rules.DNSRewrite }{{ want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, Value: net.IPv4(1, 0, 0, 1), RRType: dns.TypeA, }, { RCode: dns.RcodeSuccess,
</s> remove want []*rules.DNSRewrite name string </s> add </s> remove }, { </s> add name: "other_line_alias", </s> remove }, { </s> add name: "hello_alias",
req: &urlfilter.DNSRequest{ Hostname: "simplehost", DNSType: dns.TypeA, }, name: "simple",
req *urlfilter.DNSRequest name string want []*rules.DNSRewrite }{{ req: &urlfilter.DNSRequest{ Hostname: "simplehost", DNSType: dns.TypeA, }, name: "simple", want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, Value: net.IPv4(1, 0, 0, 1), RRType: dns.TypeA, }, { RCode: dns.RcodeSuccess,
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
RCode: dns.RcodeSuccess, Value: net.ParseIP("::1"), RRType: dns.TypeAAAA, }}, name: "simple", req: &urlfilter.DNSRequest{ Hostname: "simplehost", DNSType: dns.TypeA, }, }, {
</s> remove Hostname: "simplehost", </s> add Hostname: "hello.world", </s> remove name: "issue_4216_4_6", </s> add }, { </s> remove name: "hello_alias", </s> add }, { </s> remove name: "lots_of_aliases", </s> add }, {
}, {
RCode: dns.RcodeSuccess, Value: net.ParseIP("::1"), RRType: dns.TypeAAAA, }}, }, { req: &urlfilter.DNSRequest{ Hostname: "simplehost", DNSType: dns.TypeA, }, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
RRType: dns.TypeAAAA, }}, name: "simple", req: &urlfilter.DNSRequest{ Hostname: "simplehost", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess,
</s> remove name: "simple", </s> add }, { </s> remove Hostname: "hello.world", </s> add Hostname: "hello.world.again", </s> remove Hostname: "domain4", DNSType: dns.TypeA, </s> add Hostname: "domain6", DNSType: dns.TypeAAAA, </s> remove }, { </s> add name: "hello_alias",
Hostname: "hello.world",
RRType: dns.TypeAAAA, }}, name: "simple", req: &urlfilter.DNSRequest{ Hostname: "hello.world", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
req: &urlfilter.DNSRequest{ Hostname: "simplehost", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, Value: net.IPv4(1, 0, 0, 0), RRType: dns.TypeA, }, {
</s> remove }, { </s> add name: "other_line_alias", </s> remove Hostname: "simplehost", </s> add Hostname: "hello.world", </s> remove name: "simple", </s> add }, {
name: "hello_alias",
req: &urlfilter.DNSRequest{ Hostname: "simplehost", DNSType: dns.TypeA, }, name: "hello_alias", want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, Value: net.IPv4(1, 0, 0, 0), RRType: dns.TypeA, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
RCode: dns.RcodeSuccess, Value: net.ParseIP("::"), RRType: dns.TypeAAAA, }}, name: "hello_alias", req: &urlfilter.DNSRequest{ Hostname: "hello.world", DNSType: dns.TypeA, }, }, {
</s> remove Hostname: "hello.world", </s> add Hostname: "hello.world.again", </s> remove name: "other_line_alias", req: &urlfilter.DNSRequest{ Hostname: "hello.world.again", DNSType: dns.TypeA, }, </s> add </s> remove Hostname: "simplehost", </s> add Hostname: "hello.world", </s> remove name: "lots_of_aliases", </s> add }, { </s> remove name: "issue_4216_4_6", </s> add }, {
}, {
RCode: dns.RcodeSuccess, Value: net.ParseIP("::"), RRType: dns.TypeAAAA, }}, }, { req: &urlfilter.DNSRequest{ Hostname: "hello.world", DNSType: dns.TypeA, }, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
RRType: dns.TypeAAAA, }}, name: "hello_alias", req: &urlfilter.DNSRequest{ Hostname: "hello.world", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess,
</s> remove name: "hello_alias", </s> add }, { </s> remove Hostname: "simplehost", </s> add Hostname: "hello.world", </s> remove }, { </s> add name: "hello_alias", </s> remove Hostname: "domain4", DNSType: dns.TypeA, </s> add Hostname: "domain6", DNSType: dns.TypeAAAA, </s> remove }, { </s> add name: "other_line_alias",
Hostname: "hello.world.again",
RRType: dns.TypeAAAA, }}, name: "hello_alias", req: &urlfilter.DNSRequest{ Hostname: "hello.world.again", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
req: &urlfilter.DNSRequest{ Hostname: "hello.world", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, Value: net.IPv4(1, 0, 0, 0), RRType: dns.TypeA, }, {
</s> remove }, { </s> add name: "hello_alias", </s> remove Hostname: "simplehost", </s> add Hostname: "hello.world", </s> remove Hostname: "hello.world", </s> add Hostname: "hello.world.again",
name: "other_line_alias",
req: &urlfilter.DNSRequest{ Hostname: "hello.world", DNSType: dns.TypeA, }, name: "other_line_alias", want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, Value: net.IPv4(1, 0, 0, 0), RRType: dns.TypeA, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
RCode: dns.RcodeSuccess, Value: net.ParseIP("::"), RRType: dns.TypeAAAA, }}, name: "other_line_alias", req: &urlfilter.DNSRequest{ Hostname: "hello.world.again", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{}, name: "hello_subdomain", req: &urlfilter.DNSRequest{ Hostname: "say.hello",
</s> remove want: []*rules.DNSRewrite{}, name: "hello_subdomain", </s> add </s> remove }, { </s> add name: "hello_subdomain", </s> remove name: "hello_alias", </s> add }, { </s> remove Hostname: "hello.world", </s> add Hostname: "hello.world.again", </s> remove name: "reverse", req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, }, </s> add
RCode: dns.RcodeSuccess, Value: net.ParseIP("::"), RRType: dns.TypeAAAA, }}, }, { want: []*rules.DNSRewrite{}, name: "hello_subdomain", req: &urlfilter.DNSRequest{ Hostname: "say.hello",
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
Hostname: "hello.world.again", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{}, name: "hello_subdomain", req: &urlfilter.DNSRequest{ Hostname: "say.hello", DNSType: dns.TypeA, }, }, {
</s> remove name: "other_line_alias", req: &urlfilter.DNSRequest{ Hostname: "hello.world.again", DNSType: dns.TypeA, }, </s> add </s> remove }, { </s> add name: "hello_subdomain", </s> remove want: []*rules.DNSRewrite{}, name: "non-existing", </s> add </s> remove name: "hello_alias_subdomain", </s> add }, {
Hostname: "hello.world.again", DNSType: dns.TypeA, }, }, { req: &urlfilter.DNSRequest{ Hostname: "say.hello", DNSType: dns.TypeA, }, }, {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
req: &urlfilter.DNSRequest{ Hostname: "say.hello", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{}, name: "hello_alias_subdomain", req: &urlfilter.DNSRequest{ Hostname: "say.hello.world", DNSType: dns.TypeA,
</s> remove name: "hello_alias_subdomain", </s> add }, { </s> remove want: []*rules.DNSRewrite{}, name: "hello_subdomain", </s> add </s> remove name: "other_line_alias", req: &urlfilter.DNSRequest{ Hostname: "hello.world.again", DNSType: dns.TypeA, }, </s> add </s> remove want: []*rules.DNSRewrite{}, name: "non-existing", </s> add
name: "hello_subdomain",
req: &urlfilter.DNSRequest{ Hostname: "say.hello", DNSType: dns.TypeA, }, name: "hello_subdomain", want: []*rules.DNSRewrite{}, name: "hello_alias_subdomain", req: &urlfilter.DNSRequest{ Hostname: "say.hello.world", DNSType: dns.TypeA,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{}, name: "hello_alias_subdomain", req: &urlfilter.DNSRequest{ Hostname: "say.hello.world", DNSType: dns.TypeA, }, }, {
</s> remove }, { </s> add name: "hello_subdomain", </s> remove want: []*rules.DNSRewrite{}, name: "hello_subdomain", </s> add </s> remove want: []*rules.DNSRewrite{}, name: "non-existing", </s> add
}, {
DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{}, }, { req: &urlfilter.DNSRequest{ Hostname: "say.hello.world", DNSType: dns.TypeA, }, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
DNSType: dns.TypeA, }, }, { req: &urlfilter.DNSRequest{ Hostname: "for.testing", DNSType: dns.TypeA, }, name: "lots_of_aliases",
</s> remove name: "lots_of_aliases", </s> add }, { </s> remove Hostname: "for.testing", DNSType: dns.TypeA, </s> add Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, </s> remove }, { </s> add name: "reverse",
name: "hello_alias_subdomain", want: []*rules.DNSRewrite{},
DNSType: dns.TypeA, }, name: "hello_alias_subdomain", want: []*rules.DNSRewrite{}, }, { req: &urlfilter.DNSRequest{ Hostname: "for.testing", DNSType: dns.TypeA, }, name: "lots_of_aliases",
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
name: "hello_alias_subdomain", want: []*rules.DNSRewrite{}, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypeA, Value: net.IPv4(1, 0, 0, 2), }, { RCode: dns.RcodeSuccess,
</s> remove }, { </s> add name: "other_line_alias", </s> remove }, { </s> add name: "hello_alias", </s> remove want []*rules.DNSRewrite name string </s> add </s> remove name: "hello_alias_subdomain", </s> add }, {
req: &urlfilter.DNSRequest{ Hostname: "for.testing", DNSType: dns.TypeA, }, name: "lots_of_aliases",
name: "hello_alias_subdomain", want: []*rules.DNSRewrite{}, }, { req: &urlfilter.DNSRequest{ Hostname: "for.testing", DNSType: dns.TypeA, }, name: "lots_of_aliases", want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypeA, Value: net.IPv4(1, 0, 0, 2), }, { RCode: dns.RcodeSuccess,
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
RCode: dns.RcodeSuccess, RRType: dns.TypeAAAA, Value: net.ParseIP("::2"), }}, name: "lots_of_aliases", req: &urlfilter.DNSRequest{ Hostname: "for.testing", DNSType: dns.TypeA, }, }, {
</s> remove Hostname: "for.testing", DNSType: dns.TypeA, </s> add Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, </s> remove }, { </s> add name: "reverse", </s> remove name: "hello_alias", </s> add }, {
}, {
RCode: dns.RcodeSuccess, RRType: dns.TypeAAAA, Value: net.ParseIP("::2"), }}, }, { req: &urlfilter.DNSRequest{ Hostname: "for.testing", DNSType: dns.TypeA, }, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
Value: net.ParseIP("::2"), }}, name: "lots_of_aliases", req: &urlfilter.DNSRequest{ Hostname: "for.testing", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypePTR,
</s> remove name: "lots_of_aliases", </s> add }, { </s> remove }, { </s> add name: "reverse", </s> remove name: "reverse", req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, }, </s> add
Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR,
Value: net.ParseIP("::2"), }}, name: "lots_of_aliases", req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypePTR,
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
req: &urlfilter.DNSRequest{ Hostname: "for.testing", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypePTR, Value: "simplehost.", }},
</s> remove Hostname: "for.testing", DNSType: dns.TypeA, </s> add Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, </s> remove name: "reverse", req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, }, </s> add </s> remove name: "lots_of_aliases", </s> add }, { </s> remove Hostname: "hello.world", </s> add Hostname: "hello.world.again",
name: "reverse",
req: &urlfilter.DNSRequest{ Hostname: "for.testing", DNSType: dns.TypeA, }, name: "reverse", want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypePTR, Value: "simplehost.", }},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
RCode: dns.RcodeSuccess, RRType: dns.TypePTR, Value: "simplehost.", }}, name: "reverse", req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, }, }, { want: []*rules.DNSRewrite{}, name: "non-existing", req: &urlfilter.DNSRequest{ Hostname: "nonexisting",
</s> remove want: []*rules.DNSRewrite{}, name: "non-existing", </s> add </s> remove }, { </s> add name: "reverse", </s> remove Hostname: "for.testing", DNSType: dns.TypeA, </s> add Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, </s> remove want: nil, name: "bad_type", </s> add
RCode: dns.RcodeSuccess, RRType: dns.TypePTR, Value: "simplehost.", }}, }, { want: []*rules.DNSRewrite{}, name: "non-existing", req: &urlfilter.DNSRequest{ Hostname: "nonexisting",
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, }, }, { want: []*rules.DNSRewrite{}, name: "non-existing", req: &urlfilter.DNSRequest{ Hostname: "nonexisting", DNSType: dns.TypeA, }, }, {
</s> remove name: "reverse", req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, }, </s> add </s> remove want: nil, name: "bad_type", </s> add </s> remove Hostname: "for.testing", DNSType: dns.TypeA, </s> add Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR,
Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, }, }, { req: &urlfilter.DNSRequest{ Hostname: "nonexisting", DNSType: dns.TypeA, }, }, {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
DNSType: dns.TypeA, }, }, { req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypeSRV, }, name: "bad_type",
</s> remove want: nil, name: "bad_type", </s> add </s> remove want: []*rules.DNSRewrite{}, name: "non-existing", </s> add </s> remove name: "reverse", req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, }, </s> add </s> remove Hostname: "for.testing", DNSType: dns.TypeA, </s> add Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR,
name: "non-existing", want: []*rules.DNSRewrite{},
DNSType: dns.TypeA, }, name: "non-existing", want: []*rules.DNSRewrite{}, }, { req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypeSRV, }, name: "bad_type",
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
Hostname: "nonexisting", DNSType: dns.TypeA, }, }, { want: nil, name: "bad_type", req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypeSRV, }, }, {
</s> remove want: []*rules.DNSRewrite{}, name: "non-existing", </s> add </s> remove name: "reverse", req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR, }, </s> add </s> remove Hostname: "for.testing", DNSType: dns.TypeA, </s> add Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR,
Hostname: "nonexisting", DNSType: dns.TypeA, }, }, { req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypeSRV, }, }, {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypeSRV, }, }, { req: &urlfilter.DNSRequest{ Hostname: "domain", DNSType: dns.TypeA, },
</s> remove want: nil, name: "bad_type", </s> add </s> remove want: []*rules.DNSRewrite{}, name: "non-existing", </s> add </s> remove name: "issue_4216_4_6", </s> add }, { </s> remove Hostname: "domain", </s> add Hostname: "domain4",
name: "bad_type", want: nil,
req: &urlfilter.DNSRequest{ Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypeSRV, }, name: "bad_type", want: nil, }, { req: &urlfilter.DNSRequest{ Hostname: "domain", DNSType: dns.TypeA, },
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
want: nil, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypeA, Value: net.IPv4(4, 2, 1, 6),
</s> remove }, { </s> add name: "issue_4216_6", </s> remove }, { </s> add name: "other_line_alias", </s> remove }, { </s> add name: "hello_alias", </s> remove }, { </s> add name: "issue_4216_4",
req: &urlfilter.DNSRequest{ Hostname: "domain", DNSType: dns.TypeA, }, name: "issue_4216_4_6",
want: nil, }, { req: &urlfilter.DNSRequest{ Hostname: "domain", DNSType: dns.TypeA, }, name: "issue_4216_4_6", want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypeA, Value: net.IPv4(4, 2, 1, 6),
[ "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
RCode: dns.RcodeSuccess, RRType: dns.TypeAAAA, Value: net.ParseIP("::42"), }}, name: "issue_4216_4_6", req: &urlfilter.DNSRequest{ Hostname: "domain", DNSType: dns.TypeA, }, }, {
</s> remove Hostname: "domain", </s> add Hostname: "domain4", </s> remove name: "simple", </s> add }, { </s> remove name: "lots_of_aliases", </s> add }, { </s> remove name: "hello_alias", </s> add }, {
}, {
RCode: dns.RcodeSuccess, RRType: dns.TypeAAAA, Value: net.ParseIP("::42"), }}, }, { req: &urlfilter.DNSRequest{ Hostname: "domain", DNSType: dns.TypeA, }, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
Value: net.ParseIP("::42"), }}, name: "issue_4216_4_6", req: &urlfilter.DNSRequest{ Hostname: "domain", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess,
</s> remove name: "issue_4216_4_6", </s> add }, { </s> remove }, { </s> add name: "issue_4216_4", </s> remove }, { </s> add name: "reverse", </s> remove Hostname: "for.testing", DNSType: dns.TypeA, </s> add Hostname: "1.0.0.1.in-addr.arpa", DNSType: dns.TypePTR,
Hostname: "domain4",
Value: net.ParseIP("::42"), }}, name: "issue_4216_4_6", req: &urlfilter.DNSRequest{ Hostname: "domain4", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
req: &urlfilter.DNSRequest{ Hostname: "domain", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypeA, Value: net.IPv4(7, 5, 3, 1), }, {
</s> remove Hostname: "domain4", DNSType: dns.TypeA, </s> add Hostname: "domain6", DNSType: dns.TypeAAAA, </s> remove name: "issue_4216_4", </s> add }, { </s> remove Hostname: "domain", </s> add Hostname: "domain4", </s> remove name: "issue_4216_4_6", </s> add }, {
name: "issue_4216_4",
req: &urlfilter.DNSRequest{ Hostname: "domain", DNSType: dns.TypeA, }, name: "issue_4216_4", want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypeA, Value: net.IPv4(7, 5, 3, 1), }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
RCode: dns.RcodeSuccess, RRType: dns.TypeA, Value: net.IPv4(1, 3, 5, 7), }}, name: "issue_4216_4", req: &urlfilter.DNSRequest{ Hostname: "domain4", DNSType: dns.TypeA, }, }, {
</s> remove Hostname: "domain4", DNSType: dns.TypeA, </s> add Hostname: "domain6", DNSType: dns.TypeAAAA, </s> remove }, { </s> add name: "issue_4216_4", </s> remove Hostname: "domain", </s> add Hostname: "domain4", </s> remove }, { </s> add name: "issue_4216_6", </s> remove }, { </s> add name: "hello_alias",
}, {
RCode: dns.RcodeSuccess, RRType: dns.TypeA, Value: net.IPv4(1, 3, 5, 7), }}, }, { req: &urlfilter.DNSRequest{ Hostname: "domain4", DNSType: dns.TypeA, }, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
Value: net.IPv4(1, 3, 5, 7), }}, name: "issue_4216_4", req: &urlfilter.DNSRequest{ Hostname: "domain4", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypeAAAA,
</s> remove name: "issue_4216_4", </s> add }, { </s> remove }, { </s> add name: "issue_4216_4", </s> remove }, { </s> add name: "issue_4216_6", </s> remove Hostname: "domain", </s> add Hostname: "domain4", </s> remove Hostname: "hello.world", </s> add Hostname: "hello.world.again",
Hostname: "domain6", DNSType: dns.TypeAAAA,
Value: net.IPv4(1, 3, 5, 7), }}, name: "issue_4216_4", req: &urlfilter.DNSRequest{ Hostname: "domain6", DNSType: dns.TypeAAAA, Hostname: "domain6", DNSType: dns.TypeAAAA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypeAAAA,
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
req: &urlfilter.DNSRequest{ Hostname: "domain4", DNSType: dns.TypeA, }, }, { want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypeAAAA, Value: net.ParseIP("::13"), }, {
</s> remove Hostname: "domain4", DNSType: dns.TypeA, </s> add Hostname: "domain6", DNSType: dns.TypeAAAA, </s> remove Hostname: "domain", </s> add Hostname: "domain4", </s> remove name: "issue_4216_4", </s> add }, { </s> remove Hostname: "hello.world", </s> add Hostname: "hello.world.again", </s> remove Hostname: "simplehost", </s> add Hostname: "hello.world",
name: "issue_4216_6",
req: &urlfilter.DNSRequest{ Hostname: "domain4", DNSType: dns.TypeA, }, name: "issue_4216_6", want: []*rules.DNSRewrite{{ RCode: dns.RcodeSuccess, RRType: dns.TypeAAAA, Value: net.ParseIP("::13"), }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
RCode: dns.RcodeSuccess, RRType: dns.TypeAAAA, Value: net.ParseIP("::31"), }}, name: "issue_4216_6", req: &urlfilter.DNSRequest{ Hostname: "domain6", DNSType: dns.TypeAAAA, }, }} stubWatcher := aghtest.FSWatcher{ OnEvents: func() (e <-chan struct{}) { return nil }, OnAdd: func(name string) (err error) { return nil },
</s> remove Hostname: "domain4", DNSType: dns.TypeA, </s> add Hostname: "domain6", DNSType: dns.TypeAAAA, </s> remove }, { </s> add name: "issue_4216_6", </s> remove name: "simple", </s> add }, { </s> remove name: "issue_4216_4_6", </s> add }, { </s> remove name: "hello_alias", </s> add }, {
RCode: dns.RcodeSuccess, RRType: dns.TypeAAAA, Value: net.ParseIP("::31"), }}, }} stubWatcher := aghtest.FSWatcher{ OnEvents: func() (e <-chan struct{}) { return nil }, OnAdd: func(name string) (err error) { return nil },
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/hostscontainer_test.go
refresh() (err error) } // NewSystemResolvers returns a SystemResolvers with the cache refresh rate // defined by refreshIvl. It disables auto-resfreshing if refreshIvl is 0. If // nil is passed for hostGenFunc, the default generator will be used. func NewSystemResolvers( hostGenFunc HostGenFunc, ) (sr SystemResolvers, err error) { sr = newSystemResolvers(hostGenFunc)
</s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil </s> remove // map's values are guaranteed to be of type of *stringutil.Set. </s> add // map's values are guaranteed to be of type of *HostsRecord. </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip)
// defined by refreshIvl. It disables auto-refreshing if refreshIvl is 0. If
refresh() (err error) } // NewSystemResolvers returns a SystemResolvers with the cache refresh rate // defined by refreshIvl. It disables auto-refreshing if refreshIvl is 0. If // nil is passed for hostGenFunc, the default generator will be used. func NewSystemResolvers( hostGenFunc HostGenFunc, ) (sr SystemResolvers, err error) { sr = newSystemResolvers(hostGenFunc)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/aghnet/systemresolvers.go
} // addHostLocked adds a new IP-hostname pairing. For internal use only. func (clients *clientsContainer) addHostLocked(ip net.IP, host string, src clientSource) (ok bool) { var rc *RuntimeClient rc, ok = clients.findRuntimeClientLocked(ip) if ok { if rc.Source > src { return false }
</s> remove hp.table.Range(func(ip net.IP, b interface{}) (cont bool) { // ok is set to true if the target doesn't contain ip or if the // appropriate hosts set isn't equal to the checked one. if a, hasIP := target.Get(ip); !hasIP { ok = true } else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) </s> add hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false </s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil </s> remove // Continue only if maps has no discrepancies. return !ok </s> add var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok </s> remove log.Debug("clients: added %d client aliases from system hosts-file", n) </s> add log.Debug("clients: added %d client aliases from system hosts file", n)
rc, ok := clients.findRuntimeClientLocked(ip)
} // addHostLocked adds a new IP-hostname pairing. For internal use only. func (clients *clientsContainer) addHostLocked(ip net.IP, host string, src clientSource) (ok bool) { rc, ok := clients.findRuntimeClientLocked(ip) rc, ok := clients.findRuntimeClientLocked(ip) if ok { if rc.Source > src { return false }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/home/clients.go
clients.rmHostsBySrc(ClientSourceHostsFile) n := 0 hosts.Range(func(ip net.IP, v interface{}) (cont bool) { hosts, ok := v.(*stringutil.Set) if !ok { log.Error("dns: bad type %T in ipToRC for %s", v, ip) return true }
</s> remove hp.table.Range(func(ip net.IP, b interface{}) (cont bool) { // ok is set to true if the target doesn't contain ip or if the // appropriate hosts set isn't equal to the checked one. if a, hasIP := target.Get(ip); !hasIP { ok = true } else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) </s> add hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false </s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil </s> remove return </s> add rec.Canonical, hosts = hosts[0], hosts[1:] hp.addRules(ip, rec.Canonical, line) hp.table.Set(ip, rec) } else { rec, ok = v.(*HostsRecord) if !ok { log.Error("%s: adding pairs: unexpected type %T", hostsContainerPref, v) return } </s> remove var set *stringutil.Set set, ok = v.(*stringutil.Set) </s> add return rec.Canonical == other.Canonical && rec.Aliases.Equal(other.Aliases) } // addRecord puts the record for the IP address to the rules builder if needed. // The first host is considered to be the canonical name for the IP address. // hosts must have at least one name. func (hp *hostsParser) addRecord(ip net.IP, hosts []string) { line := strings.Join(append([]string{ip.String()}, hosts...), " ") var rec *HostsRecord v, ok := hp.table.Get(ip) </s> remove // Continue only if maps has no discrepancies. return !ok </s> add var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok
rec, ok := v.(*aghnet.HostsRecord)
clients.rmHostsBySrc(ClientSourceHostsFile) n := 0 hosts.Range(func(ip net.IP, v interface{}) (cont bool) { rec, ok := v.(*aghnet.HostsRecord) if !ok { log.Error("dns: bad type %T in ipToRC for %s", v, ip) return true }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/home/clients.go
return true } hosts.Range(func(name string) (cont bool) { if clients.addHostLocked(ip, name, ClientSourceHostsFile) { n++ } return true }) return true }) log.Debug("clients: added %d client aliases from system hosts-file", n)
</s> remove log.Debug("clients: added %d client aliases from system hosts-file", n) </s> add log.Debug("clients: added %d client aliases from system hosts file", n) </s> remove hp.table.Range(func(ip net.IP, b interface{}) (cont bool) { // ok is set to true if the target doesn't contain ip or if the // appropriate hosts set isn't equal to the checked one. if a, hasIP := target.Get(ip); !hasIP { ok = true } else if hosts, aok := a.(*stringutil.Set); aok { ok = !hosts.Equal(b.(*stringutil.Set)) </s> add hp.table.Range(func(ip net.IP, recVal interface{}) (cont bool) { var targetVal interface{} targetVal, ok = target.Get(ip) if !ok { return false </s> remove hosts, ok := v.(*stringutil.Set) </s> add rec, ok := v.(*aghnet.HostsRecord) </s> remove // Return true if every value from the IP map has no discrepancies with the // appropriate one from the target. return !ok </s> add return ok </s> remove // Continue only if maps has no discrepancies. return !ok </s> add var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok
clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++
return true } clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++ clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++ clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++ clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++ clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++ clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++ clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++ return true }) log.Debug("clients: added %d client aliases from system hosts-file", n)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/home/clients.go
return true }) log.Debug("clients: added %d client aliases from system hosts-file", n) } // addFromSystemARP adds the IP-hostname pairings from the output of the arp -a // command. func (clients *clientsContainer) addFromSystemARP() {
</s> remove hosts.Range(func(name string) (cont bool) { if clients.addHostLocked(ip, name, ClientSourceHostsFile) { n++ } return true }) </s> add clients.addHostLocked(ip, rec.Canonical, ClientSourceHostsFile) n++ </s> remove // Return true if every value from the IP map has no discrepancies with the // appropriate one from the target. return !ok </s> add return ok </s> remove // Continue only if maps has no discrepancies. return !ok </s> add var rec *HostsRecord rec, ok = recVal.(*HostsRecord) if !ok { log.Error("%s: comparing: unexpected type %T", hostsContainerPref, recVal) return false } var targetRec *HostsRecord targetRec, ok = targetVal.(*HostsRecord) if !ok { log.Error("%s: comparing: target: unexpected type %T", hostsContainerPref, targetVal) return false } ok = rec.Equal(targetRec) return ok </s> remove var rc *RuntimeClient rc, ok = clients.findRuntimeClientLocked(ip) </s> add rc, ok := clients.findRuntimeClientLocked(ip) </s> remove // addPair puts the pair of ip and host to the rules builder if needed. For // each ip the first member of hosts will become the main one. func (hp *hostsParser) addPairs(ip net.IP, hosts []string) { v, ok := hp.table.Get(ip) if !ok { // This ip is added at the first time. v = stringutil.NewSet() hp.table.Set(ip, v) </s> add // HostsRecord represents a single hosts file record. type HostsRecord struct { Aliases *stringutil.Set Canonical string } // Equal returns true if all fields of rec are equal to field in other or they // both are nil. func (rec *HostsRecord) Equal(other *HostsRecord) (ok bool) { if rec == nil { return other == nil
log.Debug("clients: added %d client aliases from system hosts file", n)
return true }) log.Debug("clients: added %d client aliases from system hosts file", n) } // addFromSystemARP adds the IP-hostname pairings from the output of the arp -a // command. func (clients *clientsContainer) addFromSystemARP() {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: all: use canonical names for hosts file runtime clients Updates #4683. Squashed commit of the following: commit daa8fdaee574d4ac2171f6b13c5ce3f3fedd9801 Author: Ainar Garipov <[email protected]> Date: Thu Jul 7 19:13:29 2022 +0300 all: use canonical names for hosts file runtime clients
https://github.com/AdguardTeam/AdGuardHome/commit/3505ce87397372f79bc067f6afa8cead833426a9
internal/home/clients.go
Header: 'IP', accessor: 'ip', }, { Header: 'Requests count', accessor: 'domain', Cell: ({ value }) => { const {
</s>
Cell: ({ value }) => (<div className="logs__row logs__row--overflow"><span className="logs__text" title={value}>{value}</span></div>),
Header: 'IP', accessor: 'ip', Cell: ({ value }) => (<div className="logs__row logs__row--overflow"><span className="logs__text" title={value}>{value}</span></div>), }, { Header: 'Requests count', accessor: 'domain', Cell: ({ value }) => { const {
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Fix footer links Closes #360
https://github.com/AdguardTeam/AdGuardHome/commit/35368619b0d7ed0fb838d749cd7b2f63ae9c9aa3
client/src/components/Dashboard/BlockedDomains.js
columns = [{ Header: 'IP', accessor: 'ip', }, { Header: 'Requests count', accessor: 'count', Cell: ({ value }) => { const percent = getPercent(this.props.dnsQueries, value); const percentColor = this.getPercentColor(percent);
</s>
Cell: ({ value }) => (<div className="logs__row logs__row--overflow"><span className="logs__text" title={value}>{value}</span></div>),
columns = [{ Header: 'IP', accessor: 'ip', Cell: ({ value }) => (<div className="logs__row logs__row--overflow"><span className="logs__text" title={value}>{value}</span></div>), }, { Header: 'Requests count', accessor: 'count', Cell: ({ value }) => { const percent = getPercent(this.props.dnsQueries, value); const percentColor = this.getPercentColor(percent);
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Fix footer links Closes #360
https://github.com/AdguardTeam/AdGuardHome/commit/35368619b0d7ed0fb838d749cd7b2f63ae9c9aa3
client/src/components/Dashboard/Clients.js
columns = [{ Header: 'IP', accessor: 'ip', }, { Header: 'Requests count', accessor: 'count', Cell: ({ value }) => { const percent = getPercent(this.props.dnsQueries, value); const percentColor = this.getPercentColor(percent);
</s>
Cell: ({ value }) => (<div className="logs__row logs__row--overflow"><span className="logs__text" title={value}>{value}</span></div>),
columns = [{ Header: 'IP', accessor: 'ip', Cell: ({ value }) => (<div className="logs__row logs__row--overflow"><span className="logs__text" title={value}>{value}</span></div>), }, { Header: 'Requests count', accessor: 'count', Cell: ({ value }) => { const percent = getPercent(this.props.dnsQueries, value); const percentColor = this.getPercentColor(percent);
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Fix footer links Closes #360
https://github.com/AdguardTeam/AdGuardHome/commit/35368619b0d7ed0fb838d749cd7b2f63ae9c9aa3
client/src/components/Dashboard/QueriedDomains.js
"example_upstream_regular": "DNS reguler (melalui UDP);", "example_upstream_udp": "DNS biasa (lebih dari UDP, nama host);", "example_upstream_dot": "terenkripsi <0>DNS-over-TLS</0>;", "example_upstream_doh": "terenkripsi <0>DNS-over-HTTPS</0>;", "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0> (eksperimental);", "example_upstream_sdns": "<0>Stempel DNS</0> untuk <1>DNSCrypt</1> atau pengarah <2>DNS-over-HTTPS</2>;", "example_upstream_tcp": "DNS reguler (melalui TCP);", "example_upstream_tcp_hostname": "DNS biasa (lebih dari TCP, nama host);", "all_lists_up_to_date_toast": "Semua daftar sudah diperbarui", "updated_upstream_dns_toast": "Server upstream berhasil disimpan",
</s> remove "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0> (experimenteel);", </s> add "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0>;", </s> remove "example_upstream_doq": "<0>DNS su QUIC</0> crittografato (sperimentale);", </s> add "example_upstream_doq": "<0>DNS su QUIC</0> crittografato;", </s> remove "encryption_doq": "Port DNS-over-QUIC (eksperimental)", "encryption_doq_desc": "Jika port ini diatur secara sepesifik, AdGuard Home akan menjalankan server DNS-lewat-QUIC pada port ini. Ini adalah eksperimental dan mungkin tidak dapat diandalkan. Juga, tidak banyak klien yang mendukungnya saat ini.", </s> add "encryption_doq": "Port DNS-over-QUIC ", "encryption_doq_desc": "Jika port ini diatur secara sepesifik, AdGuard Home akan menjalankan server DNS-lewat-QUIC pada port ini.",
"example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0>;",
"example_upstream_regular": "DNS reguler (melalui UDP);", "example_upstream_udp": "DNS biasa (lebih dari UDP, nama host);", "example_upstream_dot": "terenkripsi <0>DNS-over-TLS</0>;", "example_upstream_doh": "terenkripsi <0>DNS-over-HTTPS</0>;", "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0>;", "example_upstream_sdns": "<0>Stempel DNS</0> untuk <1>DNSCrypt</1> atau pengarah <2>DNS-over-HTTPS</2>;", "example_upstream_tcp": "DNS reguler (melalui TCP);", "example_upstream_tcp_hostname": "DNS biasa (lebih dari TCP, nama host);", "all_lists_up_to_date_toast": "Semua daftar sudah diperbarui", "updated_upstream_dns_toast": "Server upstream berhasil disimpan",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: client: upd i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit 3feadfe31609ef52726b582ad6ba18bfa435a081 Author: Ainar Garipov <[email protected]> Date: Fri Jun 3 16:34:36 2022 +0300 client: upd i18n
https://github.com/AdguardTeam/AdGuardHome/commit/368a98fb296da349ed7fb99b03c4ed6b7d0dda3a
client/src/__locales/id.json
"encryption_https": "Port HTTPS", "encryption_https_desc": "Jika port HTTPS dikonfigurasi, antarmuka admin Home AdGuard akan dapat diakses melalui HTTPS, dan itu juga akan memberikan DNS-over-HTTPS di lokasi '/ dns-query'.", "encryption_dot": "Port DNS-over-TLS", "encryption_dot_desc": "Jika port ini terkonfigurasi, AdGuard Home akan menjalankan server DNS-over-TLS dalam port ini", "encryption_doq": "Port DNS-over-QUIC (eksperimental)", "encryption_doq_desc": "Jika port ini diatur secara sepesifik, AdGuard Home akan menjalankan server DNS-lewat-QUIC pada port ini. Ini adalah eksperimental dan mungkin tidak dapat diandalkan. Juga, tidak banyak klien yang mendukungnya saat ini.", "encryption_certificates": "Sertifikat", "encryption_certificates_desc": "Untuk menggunakan enkripsi, Anda perlu memberikan rantai sertifikat SSL yang valid untuk domain Anda. Anda bisa mendapatkan sertifikat gratis di <0>{{link}}</0> atau Anda dapat membelinya dari salah satu Otoritas Sertifikat tepercaya.", "encryption_certificates_input": "Salin / rekatkan sertifikat PEM yang disandikan di sini.", "encryption_status": "Status", "encryption_expire": "Kedaluwarsa",
</s> remove "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0> (experimenteel);", </s> add "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0>;", </s> remove "example_upstream_doq": "<0>DNS su QUIC</0> crittografato (sperimentale);", </s> add "example_upstream_doq": "<0>DNS su QUIC</0> crittografato;", </s> remove "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0> (eksperimental);", </s> add "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0>;",
"encryption_doq": "Port DNS-over-QUIC ", "encryption_doq_desc": "Jika port ini diatur secara sepesifik, AdGuard Home akan menjalankan server DNS-lewat-QUIC pada port ini.",
"encryption_https": "Port HTTPS", "encryption_https_desc": "Jika port HTTPS dikonfigurasi, antarmuka admin Home AdGuard akan dapat diakses melalui HTTPS, dan itu juga akan memberikan DNS-over-HTTPS di lokasi '/ dns-query'.", "encryption_dot": "Port DNS-over-TLS", "encryption_dot_desc": "Jika port ini terkonfigurasi, AdGuard Home akan menjalankan server DNS-over-TLS dalam port ini", "encryption_doq": "Port DNS-over-QUIC ", "encryption_doq_desc": "Jika port ini diatur secara sepesifik, AdGuard Home akan menjalankan server DNS-lewat-QUIC pada port ini.", "encryption_doq": "Port DNS-over-QUIC ", "encryption_doq_desc": "Jika port ini diatur secara sepesifik, AdGuard Home akan menjalankan server DNS-lewat-QUIC pada port ini.", "encryption_certificates": "Sertifikat", "encryption_certificates_desc": "Untuk menggunakan enkripsi, Anda perlu memberikan rantai sertifikat SSL yang valid untuk domain Anda. Anda bisa mendapatkan sertifikat gratis di <0>{{link}}</0> atau Anda dapat membelinya dari salah satu Otoritas Sertifikat tepercaya.", "encryption_certificates_input": "Salin / rekatkan sertifikat PEM yang disandikan di sini.", "encryption_status": "Status", "encryption_expire": "Kedaluwarsa",
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: client: upd i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit 3feadfe31609ef52726b582ad6ba18bfa435a081 Author: Ainar Garipov <[email protected]> Date: Fri Jun 3 16:34:36 2022 +0300 client: upd i18n
https://github.com/AdguardTeam/AdGuardHome/commit/368a98fb296da349ed7fb99b03c4ed6b7d0dda3a
client/src/__locales/id.json
"example_upstream_regular": "DNS regolare (over UDP);", "example_upstream_udp": "DNS regolare (over UDP, nome host);", "example_upstream_dot": "<0>DNS su TLS</0> crittografato;", "example_upstream_doh": "<0>DNS su HTTPS</0> crittografato;", "example_upstream_doq": "<0>DNS su QUIC</0> crittografato (sperimentale);", "example_upstream_sdns": "<0>DNS Stamps</0> per <1>DNSCrypt</1> oppure i risolutori <2>DNS su HTTPS</2>;", "example_upstream_tcp": "DNS regolare (over TCP);", "example_upstream_tcp_hostname": "DNS regolare (over TCP, nome host);", "all_lists_up_to_date_toast": "Tutti gli elenchi sono aggiornati", "updated_upstream_dns_toast": "I server upstream sono stati salvati correttamente",
</s> remove "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0> (experimenteel);", </s> add "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0>;", </s> remove "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0> (eksperimental);", </s> add "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0>;", </s> remove "encryption_doq": "Port DNS-over-QUIC (eksperimental)", "encryption_doq_desc": "Jika port ini diatur secara sepesifik, AdGuard Home akan menjalankan server DNS-lewat-QUIC pada port ini. Ini adalah eksperimental dan mungkin tidak dapat diandalkan. Juga, tidak banyak klien yang mendukungnya saat ini.", </s> add "encryption_doq": "Port DNS-over-QUIC ", "encryption_doq_desc": "Jika port ini diatur secara sepesifik, AdGuard Home akan menjalankan server DNS-lewat-QUIC pada port ini.",
"example_upstream_doq": "<0>DNS su QUIC</0> crittografato;",
"example_upstream_regular": "DNS regolare (over UDP);", "example_upstream_udp": "DNS regolare (over UDP, nome host);", "example_upstream_dot": "<0>DNS su TLS</0> crittografato;", "example_upstream_doh": "<0>DNS su HTTPS</0> crittografato;", "example_upstream_doq": "<0>DNS su QUIC</0> crittografato;", "example_upstream_sdns": "<0>DNS Stamps</0> per <1>DNSCrypt</1> oppure i risolutori <2>DNS su HTTPS</2>;", "example_upstream_tcp": "DNS regolare (over TCP);", "example_upstream_tcp_hostname": "DNS regolare (over TCP, nome host);", "all_lists_up_to_date_toast": "Tutti gli elenchi sono aggiornati", "updated_upstream_dns_toast": "I server upstream sono stati salvati correttamente",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: client: upd i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit 3feadfe31609ef52726b582ad6ba18bfa435a081 Author: Ainar Garipov <[email protected]> Date: Fri Jun 3 16:34:36 2022 +0300 client: upd i18n
https://github.com/AdguardTeam/AdGuardHome/commit/368a98fb296da349ed7fb99b03c4ed6b7d0dda3a
client/src/__locales/it.json
"example_upstream_regular": "standaard DNS (over UDP);", "example_upstream_udp": "standaard DNS (via UDP, hostnaam);", "example_upstream_dot": "versleutelde <0>DNS-via-TLS</0>;", "example_upstream_doh": "versleutelde <0>DNS-via-HTTPS</0>;", "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0> (experimenteel);", "example_upstream_sdns": "<0>DNS Stamps</0> voor <1>DNSCrypt</1> of <2>DNS-via-HTTPS</2> oplossingen;", "example_upstream_tcp": "standaard DNS (over TCP);", "example_upstream_tcp_hostname": "standaard DNS (via TCP, hostnaam);", "all_lists_up_to_date_toast": "Alle lijsten zijn reeds actueel", "updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen",
</s> remove "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0> (eksperimental);", </s> add "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0>;", </s> remove "example_upstream_doq": "<0>DNS su QUIC</0> crittografato (sperimentale);", </s> add "example_upstream_doq": "<0>DNS su QUIC</0> crittografato;", </s> remove "encryption_doq": "Port DNS-over-QUIC (eksperimental)", "encryption_doq_desc": "Jika port ini diatur secara sepesifik, AdGuard Home akan menjalankan server DNS-lewat-QUIC pada port ini. Ini adalah eksperimental dan mungkin tidak dapat diandalkan. Juga, tidak banyak klien yang mendukungnya saat ini.", </s> add "encryption_doq": "Port DNS-over-QUIC ", "encryption_doq_desc": "Jika port ini diatur secara sepesifik, AdGuard Home akan menjalankan server DNS-lewat-QUIC pada port ini.",
"example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0>;",
"example_upstream_regular": "standaard DNS (over UDP);", "example_upstream_udp": "standaard DNS (via UDP, hostnaam);", "example_upstream_dot": "versleutelde <0>DNS-via-TLS</0>;", "example_upstream_doh": "versleutelde <0>DNS-via-HTTPS</0>;", "example_upstream_doq": "versleutelde <0>DNS-via-QUIC</0>;", "example_upstream_sdns": "<0>DNS Stamps</0> voor <1>DNSCrypt</1> of <2>DNS-via-HTTPS</2> oplossingen;", "example_upstream_tcp": "standaard DNS (over TCP);", "example_upstream_tcp_hostname": "standaard DNS (via TCP, hostnaam);", "all_lists_up_to_date_toast": "Alle lijsten zijn reeds actueel", "updated_upstream_dns_toast": "Upstream-servers succesvol opgeslagen",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: client: upd i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit 3feadfe31609ef52726b582ad6ba18bfa435a081 Author: Ainar Garipov <[email protected]> Date: Fri Jun 3 16:34:36 2022 +0300 client: upd i18n
https://github.com/AdguardTeam/AdGuardHome/commit/368a98fb296da349ed7fb99b03c4ed6b7d0dda3a
client/src/__locales/nl.json
"strconv" "syscall" "time" "github.com/AdguardTeam/AdGuardHome/log" "github.com/gobuffalo/packr" "golang.org/x/crypto/ssh/terminal" ) // VersionString will be set through ldflags, contains current version
</s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add "github.com/hmage/golibs/log" </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add </s> remove "github.com/AdguardTeam/AdGuardHome/log" </s> add
"strconv" "syscall" "time" "github.com/gobuffalo/packr" "golang.org/x/crypto/ssh/terminal" ) // VersionString will be set through ldflags, contains current version
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
move log wrapper library outside into hmage/golibs/log
https://github.com/AdguardTeam/AdGuardHome/commit/368e2d1ebd51bbb48a6df208299630666853f985
app.go