docstring_tokens stringlengths 0 76.5k | code_tokens stringlengths 75 1.81M | label_window listlengths 4 2.12k | html_url stringlengths 74 116 | file_name stringlengths 3 311 |
|---|---|---|---|---|
TrustedProxies: []string{"127.0.0.0/8", "::1/128"},
| <mask> Ratelimit: 20,
<mask> RefuseAny: true,
<mask> AllServers: false,
<mask>
<mask> // set default maximum concurrent queries to 300
<mask> // we introduced a default limit due to this:
<mask> // https://github.com/AdguardTeam/AdGuardHome/issues/2015#issuecomment-67... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2f661df88cf4a11a86c1fbfb8dae9b2cd79ada09 | internal/home/config.go |
import { getIpMatchListStatus, sortIp } from '../helpers/helpers'; | <mask> import { getIpMatchListStatus } from '../helpers/helpers';
<mask> import { IP_MATCH_LIST_STATUS } from '../helpers/constants';
<mask>
<mask> describe('getIpMatchListStatus', () => {
<mask> describe('IPv4', () => {
<mask> test('should return EXACT on find the exact ip match', () => {
</s> Pull... | [
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2f8e34e73b75a18cba70ae81e455c9e979642f52 | client/src/__tests__/helpers.test.js |
import { getPercent, getIpMatchListStatus, sortIp } from '../../helpers/helpers'; | <mask>
<mask> import Card from '../ui/Card';
<mask> import Cell from '../ui/Cell';
<mask>
<mask> import { getPercent, getIpMatchListStatus } from '../../helpers/helpers';
<mask> import { IP_MATCH_LIST_STATUS, STATUS_COLORS } from '../../helpers/constants';
<mask> import { formatClientCell } from '../../helpers... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2f8e34e73b75a18cba70ae81e455c9e979642f52 | client/src/components/Dashboard/Clients.js |
sortMethod: sortIp, | <mask> columns={[
<mask> {
<mask> Header: 'IP',
<mask> accessor: 'ip',
<mask> sortMethod: (a, b) => parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10),
<mask> Cell: clientCell(t, toggle... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2f8e34e73b75a18cba70ae81e455c9e979642f52 | client/src/components/Dashboard/Clients.js |
import { sortIp } from '../../../helpers/helpers'; | <mask> import whoisCell from './whoisCell';
<mask> import LogsSearchLink from '../../ui/LogsSearchLink';
<mask>
<mask> const COLUMN_MIN_WIDTH = 200;
<mask>
<mask> class AutoClients extends Component {
</s> Pull request 734: + client: 1778 Add ip sort function, write unit tests
Close #1778
Squashed commit of ... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2f8e34e73b75a18cba70ae81e455c9e979642f52 | client/src/components/Settings/Clients/AutoClients.js |
sortMethod: sortIp, | <mask> accessor: 'ip',
<mask> minWidth: COLUMN_MIN_WIDTH,
<mask> Cell: CellWrap,
<mask> },
<mask> {
<mask> Header: this.props.t('table_name'),
<mask> accessor: 'name',
</s> Pull request 734: + client: 1778 Add ip sort function, write un... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2f8e34e73b75a18cba70ae81e455c9e979642f52 | client/src/components/Settings/Clients/AutoClients.js |
import { sortIp } from '../../../helpers/helpers'; | <mask> import ReactTable from 'react-table';
<mask> import { Trans, withTranslation } from 'react-i18next';
<mask> import { LEASES_TABLE_DEFAULT_PAGE_SIZE } from '../../../helpers/constants';
<mask>
<mask> class Leases extends Component {
<mask> cellWrap = ({ value }) => (
<mask> <div className="log... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2f8e34e73b75a18cba70ae81e455c9e979642f52 | client/src/components/Settings/Dhcp/Leases.js |
sortMethod: sortIp, | <mask> Header: 'IP',
<mask> accessor: 'ip',
<mask> Cell: this.cellWrap,
<mask> }, {
<mask> Header: <Trans>dhcp_table_hostname</Trans>,
<mask> accessor: 'hostname',
<mask> ... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2f8e34e73b75a18cba70ae81e455c9e979642f52 | client/src/components/Settings/Dhcp/Leases.js |
import { sortIp } from '../../../../helpers/helpers'; | <mask> import PropTypes from 'prop-types';
<mask> import ReactTable from 'react-table';
<mask> import { Trans, withTranslation } from 'react-i18next';
<mask> import { LEASES_TABLE_DEFAULT_PAGE_SIZE } from '../../../../helpers/constants';
<mask>
<mask> import Modal from './Modal';
<mask>
<mask> class StaticLea... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2f8e34e73b75a18cba70ae81e455c9e979642f52 | client/src/components/Settings/Dhcp/StaticLeases/index.js |
sortMethod: sortIp, | <mask> Header: 'IP',
<mask> accessor: 'ip',
<mask> Cell: this.cellWrap,
<mask> },
<mask> {
<mask> Header: <Trans>dhcp_table_hostname</Trans>,
<mask> ... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2f8e34e73b75a18cba70ae81e455c9e979642f52 | client/src/components/Settings/Dhcp/StaticLeases/index.js |
TLSListenAddr *net.TCPAddr `yaml:"-" json:"-"`
StrictSNICheck bool `yaml:"strict_sni_check" json:"-"` // Reject connection if the client uses server name (in SNI) that doesn't match the certificate
CertificateChain string `yaml:"certificate_chain" json:"certificate_chain"` // PEM-encoded certificates chain... | <mask> }
<mask>
<mask> // TLSConfig is the TLS configuration for HTTPS, DNS-over-HTTPS, and DNS-over-TLS
<mask> type TLSConfig struct {
<mask> TLSListenAddr *net.TCPAddr `yaml:"-" json:"-"`
<mask> StrictSNICheck bool `yaml:"strict_sni_check" json:"-"` // Reject connection if the c... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fca419c7f2356026c1a9d8bd2ac2be9e9f2f240 | dnsforward/config.go |
port := strconv.Itoa(config.BindPort)
if proto == "https" {
port = strconv.Itoa(tlsConf.PortHTTPS)
}
| <mask> Context.tls.WriteDiskConfig(&tlsConf)
<mask> }
<mask> if proto == "https" && tlsConf.ServerName != "" {
<mask> if tlsConf.PortHTTPS == 443 {
<mask> log.Printf("Go to https://%s", tlsConf.ServerName)
<mask> } else {
<mask> log.Printf("Go to https://%s:%s", tlsConf.ServerName, port)
</s> *(ho... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fca419c7f2356026c1a9d8bd2ac2be9e9f2f240 | home/home.go |
log.Printf("Go to https://%s:%s", tlsConf.ServerName, port) | <mask> if proto == "https" && tlsConf.ServerName != "" {
<mask> if tlsConf.PortHTTPS == 443 {
<mask> log.Printf("Go to https://%s", tlsConf.ServerName)
<mask> } else {
<mask> log.Printf("Go to https://%s:%d", tlsConf.ServerName, tlsConf.PortHTTPS)
<mask> }
<mask> } else if config.BindHost == "0.0.0... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fca419c7f2356026c1a9d8bd2ac2be9e9f2f240 | home/home.go |
address = net.JoinHostPort(config.BindHost, port) | <mask> log.Println("AdGuard Home is available on the following addresses:")
<mask> ifaces, err := util.GetValidNetInterfacesForWeb()
<mask> if err != nil {
<mask> // That's weird, but we'll ignore it
<mask> address = net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
<mask> log.Printf... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fca419c7f2356026c1a9d8bd2ac2be9e9f2f240 | home/home.go |
address = net.JoinHostPort(iface.Addresses[0], port) | <mask> return
<mask> }
<mask>
<mask> for _, iface := range ifaces {
<mask> address = net.JoinHostPort(iface.Addresses[0], strconv.Itoa(config.BindPort))
<mask> log.Printf("Go to %s://%s", proto, address)
<mask> }
<mask> } else {
<mask> address = net.JoinHostPort(config.BindHost, strconv.Itoa... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fca419c7f2356026c1a9d8bd2ac2be9e9f2f240 | home/home.go |
address = net.JoinHostPort(config.BindHost, port) | <mask> address = net.JoinHostPort(iface.Addresses[0], strconv.Itoa(config.BindPort))
<mask> log.Printf("Go to %s://%s", proto, address)
<mask> }
<mask> } else {
<mask> address = net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
<mask> log.Printf("Go to %s://%s", proto, address)
<mask>... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fca419c7f2356026c1a9d8bd2ac2be9e9f2f240 | home/home.go |
// Something is not valid - return an empty TLS config
return &TLSMod{conf: tlsConfigSettings{
Enabled: conf.Enabled,
ServerName: conf.ServerName,
PortHTTPS: conf.PortHTTPS,
PortDNSOverTLS: conf.PortDNSOverTLS,
AllowUnencryptedDOH: conf.AllowUnencryptedDOH,
... | <mask> t := &TLSMod{}
<mask> t.conf = conf
<mask> if t.conf.Enabled {
<mask> if !t.load() {
<mask> return nil
<mask> }
<mask> t.setCertFileTime()
<mask> }
<mask> return t
<mask> }
</s> *(home): fix TLS module initialization
Continue to work even when TLS cert-key pair is invalid
Closes: https... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fca419c7f2356026c1a9d8bd2ac2be9e9f2f240 | home/tls.go |
log.Error("failed to validate certificate: %s", data.WarningValidation) | <mask>
<mask> // validate current TLS config and update warnings (it could have been loaded from file)
<mask> data := validateCertificates(string(t.conf.CertificateChainData), string(t.conf.PrivateKeyData), t.conf.ServerName)
<mask> if !data.ValidPair {
<mask> log.Error(data.WarningValidation)
<mask> retu... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fca419c7f2356026c1a9d8bd2ac2be9e9f2f240 | home/tls.go |
import { splitByNewLine, countClientsStatistics, sortIp } from '../../../helpers/helpers'; | <mask> import { Trans, withTranslation } from 'react-i18next';
<mask> import ReactTable from 'react-table';
<mask>
<mask> import { MODAL_TYPE } from '../../../helpers/constants';
<mask> import { splitByNewLine, countClientsStatistics } from '../../../helpers/helpers';
<mask> import Card from '../../ui/Card';
<m... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fdda8a22cb46f76c8f92ac2bdcbd9b25acd3e21 | client/src/components/Settings/Clients/ClientsTable.js |
sortMethod: sortIp, | <mask> </div>
<mask> );
<mask> },
<mask> },
<mask> {
<mask> Header: this.props.t('table_name'),
<mask> accessor: 'name',
</s> Pull request: 4143 sort client ids
Merge in DNS/adguard-home from 4143-clients-sort to master
Up... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fdda8a22cb46f76c8f92ac2bdcbd9b25acd3e21 | client/src/components/Settings/Clients/ClientsTable.js |
const comparisonBytesA = Array.isArray(a)
? getAddressesComparisonBytes(a[0]) : getAddressesComparisonBytes(a);
const comparisonBytesB = Array.isArray(b)
? getAddressesComparisonBytes(b[0]) : getAddressesComparisonBytes(b); | <mask> * @returns {number} -1 | 0 | 1
<mask> */
<mask> export const sortIp = (a, b) => {
<mask> try {
<mask> const comparisonBytesA = getAddressesComparisonBytes(a);
<mask> const comparisonBytesB = getAddressesComparisonBytes(b);
<mask>
<mask> for (let i = 0; i < comparisonBytesA.... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fdda8a22cb46f76c8f92ac2bdcbd9b25acd3e21 | client/src/helpers/helpers.js |
"client_settings": "Client settings", | <mask> {
<mask> "example_upstream_reserved": "you can specify DNS upstream <0>for a specific domain(s)<\/0>",
<mask> "upstream_parallel": "Use parallel queries to speed up resolving by simultaneously querying all upstream servers",
<mask> "bootstrap_dns": "Bootstrap DNS servers",
<mask> "bootstrap_... | [
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fe9819150f3a6d5eeeee632879eb85dc632559f | client/src/__locales/en.json |
"version": "Version", | <mask> "settings": "Settings",
<mask> "filters": "Filters",
<mask> "query_log": "Query Log",
<mask> "faq": "FAQ",
<mask> "version": "version",
<mask> "address": "address",
<mask> "on": "ON",
<mask> "off": "OFF",
<mask> "copyright": "Copyright",
<mask> "homepage": "Homep... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fe9819150f3a6d5eeeee632879eb85dc632559f | client/src/__locales/en.json |
<mask> "general_settings": "General settings",
<mask> "dns_settings": "DNS settings",
<mask> "encryption_settings": "Encryption settings",
<mask> "dhcp_settings": "DHCP settings",
<mask> "client_settings": "Client settings",
<mask> "upstream_dns": "Upstream DNS servers",
<mask> "upstr... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fe9819150f3a6d5eeeee632879eb85dc632559f | client/src/__locales/en.json | |
"updates_version_equal": "AdGuard Home is up-to-date", | <mask> "access_settings_saved": "Access settings successfully saved",
<mask> "updates_checked": "Updates successfully checked",
<mask> "check_updates_now": "Check for updates now",
<mask> "dns_privacy": "DNS Privacy",
<mask> "setup_dns_privacy_1": "<0>DNS-over-TLS:</0> Use <1>{{address}}</1> st... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fe9819150f3a6d5eeeee632879eb85dc632559f | client/src/__locales/en.json |
import versionCompare from '../helpers/versionCompare'; | <mask> import axios from 'axios';
<mask>
<mask> import { normalizeHistory, normalizeFilteringStatus, normalizeLogs, normalizeTextarea, sortClients } from '../helpers/helpers';
<mask> import { SETTINGS_NAMES, CHECK_TIMEOUT } from '../helpers/constants';
<mask> import { getTlsStatus } from './encryption';
<mask> i... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fe9819150f3a6d5eeeee632879eb85dc632559f | client/src/actions/index.js |
export const getVersion = (recheck = false) => async (dispatch, getState) => { | <mask> export const getVersionRequest = createAction('GET_VERSION_REQUEST');
<mask> export const getVersionFailure = createAction('GET_VERSION_FAILURE');
<mask> export const getVersionSuccess = createAction('GET_VERSION_SUCCESS');
<mask>
<mask> export const getVersion = (recheck = false) => async (dispatch) => {
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fe9819150f3a6d5eeeee632879eb85dc632559f | client/src/actions/index.js |
const data = await apiClient.getGlobalVersion({ recheck_now: recheck });
dispatch(getVersionSuccess(data));
| <mask>
<mask> export const getVersion = (recheck = false) => async (dispatch) => {
<mask> dispatch(getVersionRequest());
<mask> try {
<mask> const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck });
<mask> dispatch(getVersionSuccess(newVersion));
<mask> if (r... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fe9819150f3a6d5eeeee632879eb85dc632559f | client/src/actions/index.js |
const { dnsVersion } = getState().dashboard;
const currentVersion = dnsVersion === 'undefined' ? 0 : dnsVersion;
if (data && versionCompare(currentVersion, data.new_version) === -1) {
dispatch(addSuccessToast('updates_checked'));
} else {
... | <mask> try {
<mask> const newVersion = await apiClient.getGlobalVersion({ recheck_now: recheck });
<mask> dispatch(getVersionSuccess(newVersion));
<mask> if (recheck) {
<mask> dispatch(addSuccessToast('updates_checked'));
<mask> }
<mask> } catch (error) {
<mas... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fe9819150f3a6d5eeeee632879eb85dc632559f | client/src/actions/index.js |
return {
...state,
processingVersion: false,
}; | <mask> };
<mask> return newState;
<mask> }
<mask>
<mask> return state;
<mask> },
<mask>
<mask> [actions.getUpdateRequest]: state => ({ ...state, processingUpdate: true }),
<mask> [actions.getUpdateFailure]: state => ({ ...state, processingUpdate: false }),
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/2fe9819150f3a6d5eeeee632879eb85dc632559f | client/src/reducers/index.js |
<mask> package main
<mask>
<mask> import (
<mask> "bufio"
<mask> "fmt"
<mask> stdlog "log"
<mask> "net"
<mask> "net/http"
<mask> "os"
</s> Initial implementation of welcome/firstrun/installer page in go backend </s> remove "net"
</s> add </s> remove data := struct {
Web ipport `json:"web"`
DNS ... | [
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | app.go | |
<mask>
<mask> "github.com/gobuffalo/packr"
<mask>
<mask> "github.com/hmage/golibs/log"
<mask> "golang.org/x/crypto/ssh/terminal"
<mask> )
<mask>
<mask> // VersionString will be set through ldflags, contains current version
<mask> var VersionString = "undefined"
<mask>
</s> Initial implementation of we... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | app.go | |
config.firstRun = detectFirstRun() | <mask> if args.runningAsService {
<mask> log.Printf("AdGuard Home is running as a service")
<mask> }
<mask>
<mask> err := askUsernamePasswordIfPossible()
<mask> if err != nil {
<mask> log.Fatal(err)
<mask> }
<mask>
<mask> // Do the upgrade if necessary
<mask> err = upgradeConfig()
<mask> if er... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | app.go |
err := upgradeConfig() | <mask> log.Fatal(err)
<mask> }
<mask>
<mask> // Do the upgrade if necessary
<mask> err = upgradeConfig()
<mask> if err != nil {
<mask> log.Fatal(err)
<mask> }
<mask>
<mask> // parse from config file
</s> Initial implementation of welcome/firstrun/installer page in go backend </s> remove err := a... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | app.go |
// if not configured, redirect / to /install.html, otherwise redirect /install.html to /
http.Handle("/", postInstallHandler(optionalAuthHandler(http.FileServer(box))))
http.Handle("/install.html", preInstallHandler(http.FileServer(box))) | <mask> go periodicallyRefreshFilters()
<mask>
<mask> // Initialize and run the admin Web interface
<mask> box := packr.NewBox("build/static")
<mask> http.Handle("/", optionalAuthHandler(http.FileServer(box)))
<mask> registerControlHandlers()
<mask>
<mask> address := net.JoinHostPort(config.BindHost, str... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | app.go |
<mask> log.Printf("Couldn't stop DHCP server: %s", err)
<mask> }
<mask> }
<mask>
<mask> func getInput() (string, error) {
<mask> scanner := bufio.NewScanner(os.Stdin)
<mask> scanner.Scan()
<mask> text := scanner.Text()
<mask> err := scanner.Err()
<mask> return text, err
<mask> }
<mask>
<mask> // ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | app.go | |
<mask> }
<mask>
<mask> return o
<mask> }
<mask>
<mask> func promptAndGet(prompt string) (string, error) {
<mask> for {
<mask> fmt.Print(prompt)
<mask> input, err := getInput()
<mask> if err != nil {
<mask> log.Printf("Failed to get input, aborting: %s", err)
<mask> return "", err
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | app.go | |
firstRun bool // if set to true, don't run any services except HTTP web inteface, and serve only first-run html | <mask> // field ordering is important -- yaml fields will mirror ordering from here
<mask> type configuration struct {
<mask> ourConfigFilename string // Config filename (can be overridden via the command line arguments)
<mask> ourBinaryDir string // Location of our directory, used to protect against CWD bei... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | config.go |
if config.firstRun {
log.Tracef("Silently refusing to write config because first run and not configured yet")
return nil
} | <mask> c.Lock()
<mask> defer c.Unlock()
<mask> configFile := config.getConfigFilename()
<mask> log.Printf("Writing YAML file: %s", configFile)
<mask> yamlText, err := yaml.Marshal(&config)
<mask> if err != nil {
<mask> log.Printf("Couldn't generate YAML file: %s", err)
</s> Initial implementation of wel... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | config.go |
type ipport struct {
IP string `json:"ip"`
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"`
}
| <mask> }
<mask> }
<mask>
<mask> func handleGetDefaultAddresses(w http.ResponseWriter, r *http.Request) {
<mask> data := firstRunData{}
<mask> ifaces, err := getValidNetInterfaces()
<mask> if err != nil {
<mask> httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err)
<mask> ret... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | control.go |
data := firstRunData{}
ifaces, err := getValidNetInterfaces()
if err != nil {
httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err)
return
}
if len(ifaces) == 0 {
httpError(w, http.StatusServiceUnavailable, "Couldn't find any legible interface, plase try again later")
return | <mask> }
<mask> }
<mask>
<mask> func handleGetDefaultAddresses(w http.ResponseWriter, r *http.Request) {
<mask> type ipport struct {
<mask> IP string `json:"ip"`
<mask> Port int `json:"port"`
<mask> }
<mask> data := struct {
<mask> Web ipport `json:"web"`
<mask> DNS ipport `json:"dns"`
<ma... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | control.go |
<mask> type ipport struct {
<mask> IP string `json:"ip"`
<mask> Port int `json:"port"`
<mask> }
<mask> data := struct {
<mask> Web ipport `json:"web"`
<mask> DNS ipport `json:"dns"`
<mask> }{}
<mask>
<mask> // TODO: replace mockup with actual data
<mask> data.Web.IP = "192.168.104.104"
<... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | control.go | |
// 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 avail... | <mask> Web ipport `json:"web"`
<mask> DNS ipport `json:"dns"`
<mask> }{}
<mask>
<mask> // TODO: replace mockup with actual data
<mask> data.Web.IP = "192.168.104.104"
<mask> data.Web.Port = 3000
<mask> data.DNS.IP = "192.168.104.104"
<mask> data.DNS.Port = 53
<mask>
<mask> w.Header().Set("Conten... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | control.go |
err = json.NewEncoder(w).Encode(data) | <mask> data.DNS.IP = "192.168.104.104"
<mask> data.DNS.Port = 53
<mask>
<mask> w.Header().Set("Content-Type", "application/json")
<mask> err := json.NewEncoder(w).Encode(data)
<mask> if err != nil {
<mask> httpError(w, http.StatusInternalServerError, "Unable to marshal default addresses to json: %s", err... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | control.go |
newSettings := firstRunData{} | <mask> }
<mask> }
<mask>
<mask> func handleSetAllSettings(w http.ResponseWriter, r *http.Request) {
<mask> newSettings := map[string]interface{}{}
<mask> err := json.NewDecoder(r.Body).Decode(&newSettings)
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "Failed to parse new DHCP config ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | control.go |
config.firstRun = false
config.BindHost = newSettings.Web.IP
config.BindPort = newSettings.Web.Port
config.DNS.BindHost = newSettings.DNS.IP
config.DNS.Port = newSettings.DNS.Port
config.AuthName = newSettings.Username
config.AuthPass = newSettings.Password
httpUpdateConfigReloadDNSReturnOK(w, r) | <mask> }
<mask>
<mask> spew.Dump(newSettings)
<mask> }
<mask>
<mask> func registerControlHandlers() {
<mask> http.HandleFunc("/control/status", postInstall(optionalAuth(ensureGET(handleStatus))))
</s> Initial implementation of welcome/firstrun/installer page in go backend </s> remove http.HandleFunc("/con... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | control.go |
http.HandleFunc("/control/status", postInstall(optionalAuth(ensureGET(handleStatus))))
http.HandleFunc("/control/enable_protection", postInstall(optionalAuth(ensurePOST(handleProtectionEnable))))
http.HandleFunc("/control/disable_protection", postInstall(optionalAuth(ensurePOST(handleProtectionDisable))))
http.Hand... | <mask> spew.Dump(newSettings)
<mask> }
<mask>
<mask> func registerControlHandlers() {
<mask> http.HandleFunc("/control/status", optionalAuth(ensureGET(handleStatus)))
<mask> http.HandleFunc("/control/enable_protection", optionalAuth(ensurePOST(handleProtectionEnable)))
<mask> http.HandleFunc("/control/disab... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | control.go |
http.HandleFunc("/control/install/get_default_addresses", preInstall(ensureGET(handleGetDefaultAddresses)))
http.HandleFunc("/control/install/set_all_settings", preInstall(ensurePOST(handleSetAllSettings))) | <mask> http.HandleFunc("/control/dhcp/set_config", optionalAuth(ensurePOST(handleDHCPSetConfig)))
<mask> http.HandleFunc("/control/dhcp/find_active_dhcp", optionalAuth(ensurePOST(handleDHCPFindActiveServer)))
<mask>
<mask> // TODO: move to registerInstallHandlers()
<mask> http.HandleFunc("/control/install/get... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | control.go |
<mask> import (
<mask> "encoding/json"
<mask> "fmt"
<mask> "io/ioutil"
<mask> "net"
<mask> "net/http"
<mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/dhcpd"
</s> Initial implementation of welcome/firstrun/installer page in go backend </s> remove "bufio"
</s> add <... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | dhcp.go | |
ifaces, err := getValidNetInterfaces() | <mask>
<mask> func handleDHCPInterfaces(w http.ResponseWriter, r *http.Request) {
<mask> response := map[string]interface{}{}
<mask>
<mask> ifaces, err := net.Interfaces()
<mask> if err != nil {
<mask> httpError(w, http.StatusInternalServerError, "Couldn't get list of interfaces: %s", err)
<mask> retur... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | dhcp.go |
httpError(w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err) | <mask> response := map[string]interface{}{}
<mask>
<mask> ifaces, err := net.Interfaces()
<mask> if err != nil {
<mask> httpError(w, http.StatusInternalServerError, "Couldn't get list of interfaces: %s", err)
<mask> return
<mask> }
<mask>
<mask> type responseInterface struct {
<mask> Name ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | dhcp.go |
<mask> httpError(w, http.StatusInternalServerError, "Couldn't get list of interfaces: %s", err)
<mask> return
<mask> }
<mask>
<mask> type responseInterface struct {
<mask> Name string `json:"name"`
<mask> MTU int `json:"mtu"`
<mask> HardwareAddr string `json:"hardware_addr... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | dhcp.go | |
response[ifaces[i].Name] = ifaces[i] | <mask> Addresses []string `json:"ip_addresses"`
<mask> }
<mask>
<mask> for i := range ifaces {
<mask> if ifaces[i].Flags&net.FlagLoopback != 0 {
<mask> // it's a loopback, skip it
<mask> continue
<mask> }
<mask> if ifaces[i].Flags&net.FlagBroadcast == 0 {
<mask> // this interface doesn'... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | dhcp.go |
"fmt" | <mask> import (
<mask> "bufio"
<mask> "errors"
<mask> "io"
<mask> "io/ioutil"
<mask> "net"
<mask> "net/http"
<mask> "os"
</s> Initial implementation of welcome/firstrun/installer page in go backend </s> remove "bufio"
</s> add </s> remove "net"
</s> add </s> remove data := struct {
Web ipport `... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | helpers.go |
"net" | <mask> "errors"
<mask> "fmt"
<mask> "io"
<mask> "io/ioutil"
<mask> "net/http"
<mask> "os"
<mask> "path"
<mask> "path/filepath"
<mask> "runtime"
<mask> "strings"
</s> Initial implementation of welcome/firstrun/installer page in go backend </s> remove "net"
</s> add </s> remove "bufio"
</s> add ... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | helpers.go |
"github.com/hmage/golibs/log" | <mask> "path"
<mask> "path/filepath"
<mask> "runtime"
<mask> "strings"
<mask> )
<mask>
<mask> // ----------------------------------
<mask> // helper functions for working with files
</s> Initial implementation of welcome/firstrun/installer page in go backend </s> remove "golang.org/x/crypto/ssh/terminal"... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | helpers.go |
optionalAuth(a.handler.ServeHTTP)(w, r) | <mask> handler http.Handler
<mask> }
<mask>
<mask> func (a *authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
<mask> if config.AuthName == "" || config.AuthPass == "" {
<mask> a.handler.ServeHTTP(w, r)
<mask> return
<mask> }
<mask> user, pass, ok := r.BasicAuth()
<mask> if !ok || user... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/302c3a767a4d296d1f8cf5d895be8af2477113ce | helpers.go |
<mask> - errcheck
<mask> - govet
<mask> - ineffassign
<mask> - staticcheck
<mask> - structcheck
<mask> - unused
<mask> - varcheck
<mask> - bodyclose
<mask> - depguard
<mask> - dupl
</s> Pull request: 2271 handle nolint
Merge in DNS/adguard-home from 2271-handle-nolint... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | .golangci.yml | |
// In returns true if reasons include r.
func (r Reason) In(reasons ...Reason) bool {
for _, reason := range reasons {
if r == reason {
return true
}
}
return false
}
| <mask> }
<mask>
<mask> // GetConfig - get configuration
<mask> func (d *Dnsfilter) GetConfig() RequestFilteringSettings {
<mask> c := RequestFilteringSettings{}
<mask> // d.confLock.RLock()
</s> Pull request: 2271 handle nolint
Merge in DNS/adguard-home from 2271-handle-nolint to master
Closes #2271.
Squas... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/dnsfilter.go |
// findInHash returns 32-byte hash if it's found in hashToHost.
func (c *sbCtx) findInHash(val []byte) (hash32 [32]byte, found bool) {
for i := 4; i < len(val); i += 32 {
hash := val[i : i+32]
copy(hash32[:], hash[0:32])
_, found = c.hashToHost[hash32]
if found {
return hash32, found
}
}
return [32]b... | <mask> }
<mask>
<mask> func (c *sbCtx) getCached() int {
<mask> now := time.Now().Unix()
<mask> hashesToRequest := map[[32]byte]string{}
<mask> for k, v := range c.hashToHost {
</s> Pull request: 2271 handle nolint
Merge in DNS/adguard-home from 2271-handle-nolint to master
Closes #2271.
Squashed commit o... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
if val == nil || now >= int64(binary.BigEndian.Uint32(val)) { | <mask> hashesToRequest := map[[32]byte]string{}
<mask> for k, v := range c.hashToHost {
<mask> key := k[0:2]
<mask> val := c.cache.Get(key)
<mask> if val != nil {
<mask> expire := binary.BigEndian.Uint32(val)
<mask> if now >= int64(expire) {
<mask> val = nil
<mask> } else {
<mask> for... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"k... | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
continue
}
if hash32, found := c.findInHash(val); found {
log.Debug("%s: found in cache: %s: blocked by %v", c.svc, c.host, hash32)
return 1 | <mask> key := k[0:2]
<mask> val := c.cache.Get(key)
<mask> if val == nil || now >= int64(binary.BigEndian.Uint32(val)) {
<mask> hashesToRequest[k] = v
<mask> }
<mask> }
<mask>
<mask> if len(hashesToRequest) == 0 {
<mask> log.Debug("%s: found in cache: %s: not blocked", c.svc, c.host)
</s> Pull... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
func check(c *sbCtx, r Result, u upstream.Upstream) (Result, error) {
c.hashToHost = hostnameToHashes(c.host)
switch c.getCached() {
case -1:
return Result{}, nil
case 1:
return r, nil | <mask> }
<mask> }
<mask> }
<mask>
<mask> // Disabling "dupl": the algorithm of SB/PC is similar, but it uses different data
<mask> // nolint:dupl
<mask> func (d *Dnsfilter) checkSafeBrowsing(host string) (Result, error) {
<mask> if log.GetLevel() >= log.DEBUG {
<mask> timer := log.StartTimer()
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"re... | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
<mask> return result, nil
<mask> }
<mask>
<mask> question := c.getQuestion()
<mask> log.Tracef("SafeBrowsing: checking %s: %s", host, question)
<mask>
<mask> req := dns.Msg{}
<mask> req.SetQuestion(question, dns.TypeTXT)
<mask> resp, err := d.safeBrowsingUpstream.Exchange(&req)
<mask> if err != nil... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go | |
log.Tracef("%s: checking %s: %s", c.svc, c.host, question)
req := (&dns.Msg{}).SetQuestion(question, dns.TypeTXT)
resp, err := u.Exchange(req) | <mask>
<mask> question := c.getQuestion()
<mask> log.Tracef("SafeBrowsing: checking %s: %s", host, question)
<mask>
<mask> req := dns.Msg{}
<mask> req.SetQuestion(question, dns.TypeTXT)
<mask> resp, err := d.safeBrowsingUpstream.Exchange(&req)
<mask> if err != nil {
<mask> return result, err
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
return Result{}, err | <mask> req := dns.Msg{}
<mask> req.SetQuestion(question, dns.TypeTXT)
<mask> resp, err := d.safeBrowsingUpstream.Exchange(&req)
<mask> if err != nil {
<mask> return result, err
<mask> }
<mask>
<mask> matched, receivedHashes := c.processTXT(resp)
<mask> if matched {
<mask> result.IsFiltered = true
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
c.storeCache(receivedHashes) | <mask>
<mask> matched, receivedHashes := c.processTXT(resp)
<mask> if matched {
<mask> return r, nil
<mask> }
<mask>
<mask> return Result{}, nil
</s> Pull request: 2271 handle nolint
Merge in DNS/adguard-home from 2271-handle-nolint to master
Closes #2271.
Squashed commit of the following:
commit fd... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
return r, nil | <mask> }
<mask>
<mask> matched, receivedHashes := c.processTXT(resp)
<mask> if matched {
<mask> result.IsFiltered = true
<mask> result.Reason = FilteredSafeBrowsing
<mask> result.Rule = "adguard-malware-shavar"
<mask> }
<mask> c.storeCache(receivedHashes)
<mask>
<mask> return result, nil
<mask... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
<mask> result.IsFiltered = true
<mask> result.Reason = FilteredSafeBrowsing
<mask> result.Rule = "adguard-malware-shavar"
<mask> }
<mask> c.storeCache(receivedHashes)
<mask>
<mask> return result, nil
<mask> }
<mask>
<mask> // Disabling "dupl": the algorithm of SB/PC is similar, but it uses differen... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go | |
return Result{}, nil | <mask> result.Rule = "adguard-malware-shavar"
<mask> }
<mask> c.storeCache(receivedHashes)
<mask>
<mask> return result, nil
<mask> }
<mask>
<mask> // Disabling "dupl": the algorithm of SB/PC is similar, but it uses different data
<mask> // nolint:dupl
<mask> func (d *Dnsfilter) checkParental(host strin... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
func (d *Dnsfilter) checkSafeBrowsing(host string) (Result, error) { | <mask>
<mask> return result, nil
<mask> }
<mask>
<mask> // Disabling "dupl": the algorithm of SB/PC is similar, but it uses different data
<mask> // nolint:dupl
<mask> func (d *Dnsfilter) checkParental(host string) (Result, error) {
<mask> if log.GetLevel() >= log.DEBUG {
<mask> timer := log.StartTimer()... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
defer timer.LogElapsed("SafeBrowsing lookup for %s", host) | <mask> // nolint:dupl
<mask> func (d *Dnsfilter) checkParental(host string) (Result, error) {
<mask> if log.GetLevel() >= log.DEBUG {
<mask> timer := log.StartTimer()
<mask> defer timer.LogElapsed("Parental lookup for %s", host)
<mask> }
<mask>
<mask> result := Result{}
<mask> hashes := hostnameToHash... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
ctx := &sbCtx{
host: host,
svc: "SafeBrowsing",
cache: gctx.safebrowsingCache,
cacheTime: d.Config.CacheTime, | <mask> if log.GetLevel() >= log.DEBUG {
<mask> timer := log.StartTimer()
<mask> defer timer.LogElapsed("Parental lookup for %s", host)
<mask> }
<mask>
<mask> result := Result{}
<mask> hashes := hostnameToHashes(host)
<mask>
<mask> c := &sbCtx{
<mask> host: host,
<mask> svc: "Paren... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
res := Result{
IsFiltered: true,
Reason: FilteredSafeBrowsing,
Rule: "adguard-malware-shavar", | <mask> hashToHost: hashes,
<mask> cache: gctx.parentalCache,
<mask> cacheTime: d.Config.CacheTime,
<mask> }
<mask>
<mask> // check cache
<mask> match := c.getCached()
<mask> if match < 0 {
<mask> return result, nil
<mask> } else if match > 0 {
<mask> result.IsFiltered = true
<mask> r... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
return check(ctx, res, d.safeBrowsingUpstream)
} | <mask> IsFiltered: true,
<mask> Reason: FilteredSafeBrowsing,
<mask> Rule: "adguard-malware-shavar",
<mask> }
<mask>
<mask> func (d *Dnsfilter) checkParental(host string) (Result, error) {
<mask> if log.GetLevel() >= log.DEBUG {
<mask> timer := log.StartTimer()
<mask> defer timer.LogElap... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
func (d *Dnsfilter) checkParental(host string) (Result, error) {
if log.GetLevel() >= log.DEBUG {
timer := log.StartTimer()
defer timer.LogElapsed("Parental lookup for %s", host) | <mask> result.Rule = "parental CATEGORY_BLACKLISTED"
<mask> return result, nil
<mask> }
<mask>
<mask> question := c.getQuestion()
<mask> log.Tracef("Parental: checking %s: %s", host, question)
<mask>
<mask> req := dns.Msg{}
<mask> req.SetQuestion(question, dns.TypeTXT)
<mask> resp, err := d.parent... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
ctx := &sbCtx{
host: host,
svc: "Parental",
cache: gctx.parentalCache,
cacheTime: d.Config.CacheTime, | <mask> resp, err := d.parentalUpstream.Exchange(&req)
<mask> if err != nil {
<mask> return result, err
<mask> }
<mask>
<mask> matched, receivedHashes := c.processTXT(resp)
<mask> if matched {
<mask> result.IsFiltered = true
<mask> result.Reason = FilteredParental
<mask> result.Rule = "parental C... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
res := Result{
IsFiltered: true,
Reason: FilteredParental,
Rule: "parental CATEGORY_BLACKLISTED",
}
return check(ctx, res, d.parentalUpstream) | <mask> result.IsFiltered = true
<mask> result.Reason = FilteredParental
<mask> result.Rule = "parental CATEGORY_BLACKLISTED"
<mask> }
<mask> c.storeCache(receivedHashes)
<mask>
<mask> return result, err
<mask> }
<mask>
<mask> func httpError(r *http.Request, w http.ResponseWriter, code int, format s... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsfilter/sb_pc.go |
<mask> // TLSConfig is the TLS configuration for HTTPS, DNS-over-HTTPS, and DNS-over-TLS
<mask> type TLSConfig struct {
<mask> TLSListenAddr *net.TCPAddr `yaml:"-" json:"-"`
<mask> QUICListenAddr *net.UDPAddr `yaml:"-" json:"-"`
<mask> StrictSNICheck bool `yaml:"strict_sni_check" json:"-"` // Reject co... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/config.go | |
// Reject connection if the client uses server name (in SNI) that doesn't match the certificate
StrictSNICheck bool `yaml:"strict_sni_check" json:"-"` | <mask> TLSListenAddr *net.TCPAddr `yaml:"-" json:"-"`
<mask> QUICListenAddr *net.UDPAddr `yaml:"-" json:"-"`
<mask> StrictSNICheck bool `yaml:"strict_sni_check" json:"-"` // Reject connection if the client uses server name (in SNI) that doesn't match the certificate
<mask>
<mask> CertificateChain str... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/config.go |
// PEM-encoded certificates chain
CertificateChain string `yaml:"certificate_chain" json:"certificate_chain"`
// PEM-encoded private key
PrivateKey string `yaml:"private_key" json:"private_key"`
CertificatePath string `yaml:"certificate_path" json:"certificate_path"`
PrivateKeyPath string `yaml:"private_key_pat... | <mask>
<mask> CertificateChain string `yaml:"certificate_chain" json:"certificate_chain"` // PEM-encoded certificates chain
<mask> PrivateKey string `yaml:"private_key" json:"private_key"` // PEM-encoded private key
<mask>
<mask> CertificatePath string `yaml:"certificate_path" json:"certific... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/config.go |
cert tls.Certificate
// DNS names from certificate (SAN) or CN value from Subject
dnsNames []string | <mask>
<mask> CertificateChainData []byte `yaml:"-" json:"-"`
<mask> PrivateKeyData []byte `yaml:"-" json:"-"`
<mask>
<mask> cert tls.Certificate // nolint(structcheck) - linter thinks that this field is unused, while TLSConfig is directly included into ServerConfig
<mask> dnsNames []string ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/config.go |
<mask> "strconv"
<mask> "strings"
<mask>
<mask> "github.com/AdguardTeam/dnsproxy/upstream"
<mask> "github.com/AdguardTeam/golibs/jsonutil"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/golibs/utils"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
</s> Pull request: 2271 han... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go | |
type dnsConfig struct {
Upstreams *[]string `json:"upstream_dns"`
UpstreamsFile *string `json:"upstream_dns_file"`
Bootstraps *[]string `json:"bootstrap_dns"`
ProtectionEnabled *bool `json:"protection_enabled"`
RateLimit *uint32 `json:"ratelimit"`
BlockingMode *string `json:"blocking_mode... | <mask> log.Info("dns: %s %s: %s", r.Method, r.URL, text)
<mask> http.Error(w, text, code)
<mask> }
<mask>
<mask> type dnsConfigJSON struct {
<mask> Upstreams []string `json:"upstream_dns"`
<mask> UpstreamsFile string `json:"upstream_dns_file"`
<mask> Bootstraps []string `json:"bootstrap_dns"`
<m... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
func (s *Server) getDNSConfig() dnsConfig { | <mask> CacheMinTTL uint32 `json:"cache_ttl_min"`
<mask> CacheMaxTTL uint32 `json:"cache_ttl_max"`
<mask> }
<mask>
<mask> func (s *Server) handleGetConfig(w http.ResponseWriter, r *http.Request) {
<mask> resp := dnsConfigJSON{}
<mask> s.RLock()
<mask> resp.Upstreams = stringArrayDup(s.conf.Upst... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
upstreams := stringArrayDup(s.conf.UpstreamDNS)
upstreamFile := s.conf.UpstreamDNSFileName
bootstraps := stringArrayDup(s.conf.BootstrapDNS)
protectionEnabled := s.conf.ProtectionEnabled
blockingMode := s.conf.BlockingMode
BlockingIPv4 := s.conf.BlockingIPv4
BlockingIPv6 := s.conf.BlockingIPv6
Ratelimit := s.co... | <mask>
<mask> func (s *Server) handleGetConfig(w http.ResponseWriter, r *http.Request) {
<mask> resp := dnsConfigJSON{}
<mask> s.RLock()
<mask> resp.Upstreams = stringArrayDup(s.conf.UpstreamDNS)
<mask> resp.UpstreamsFile = s.conf.UpstreamDNSFileName
<mask> resp.Bootstraps = stringArrayDup(s.conf.Bootstrap... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
upstreamMode = "fastest_addr" | <mask> resp.CacheSize = s.conf.CacheSize
<mask> resp.CacheMinTTL = s.conf.CacheMinTTL
<mask> resp.CacheMaxTTL = s.conf.CacheMaxTTL
<mask> if s.conf.FastestAddr {
<mask> resp.UpstreamMode = "fastest_addr"
<mask> } else if s.conf.AllServers {
<mask> resp.UpstreamMode = "parallel"
<mask> }
<mask> s.RUn... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
upstreamMode = "parallel" | <mask> resp.CacheMaxTTL = s.conf.CacheMaxTTL
<mask> if s.conf.FastestAddr {
<mask> resp.UpstreamMode = "fastest_addr"
<mask> } else if s.conf.AllServers {
<mask> resp.UpstreamMode = "parallel"
<mask> }
<mask> s.RUnlock()
<mask>
<mask> js, err := json.Marshal(resp)
<mask> if err != nil {
</s> Pull... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
func (s *Server) handleGetConfig(w http.ResponseWriter, r *http.Request) {
resp := s.getDNSConfig()
w.Header().Set("Content-Type", "application/json")
enc := json.NewEncoder(w)
if err := enc.Encode(resp); err != nil {
httpError(r, w, http.StatusInternalServerError, "json.Encoder: %s", err) | <mask> resp.UpstreamMode = "parallel"
<mask> }
<mask> s.RUnlock()
<mask>
<mask> js, err := json.Marshal(resp)
<mask> if err != nil {
<mask> httpError(r, w, http.StatusInternalServerError, "json.Marshal: %s", err)
<mask> return
<mask> }
<mask> w.Header().Set("Content-Type", "application/json")
<m... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
<mask> if err != nil {
<mask> httpError(r, w, http.StatusInternalServerError, "json.Marshal: %s", err)
<mask> return
<mask> }
<mask> w.Header().Set("Content-Type", "application/json")
<mask> _, _ = w.Write(js)
<mask> }
<mask>
<mask> func checkBlockingMode(req dnsConfigJSON) bool {
<mask> bm := req.B... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go | |
func (req *dnsConfig) checkBlockingMode() bool {
if req.BlockingMode == nil {
return true | <mask> w.Header().Set("Content-Type", "application/json")
<mask> _, _ = w.Write(js)
<mask> }
<mask>
<mask> func checkBlockingMode(req dnsConfigJSON) bool {
<mask> bm := req.BlockingMode
<mask> if !(bm == "default" || bm == "refused" || bm == "nxdomain" || bm == "null_ip" || bm == "custom_ip") {
<mask> re... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
bm := *req.BlockingMode | <mask> if req.BlockingMode == nil {
<mask> return true
<mask> }
<mask>
<mask> if bm == "custom_ip" {
<mask> if req.BlockingIPv4 == nil || req.BlockingIPv6 == nil {
<mask> return false
<mask> }
<mask>
</s> Pull request: 2271 handle nolint
Merge in DNS/adguard-home from 2271-handle-nolint to mast... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
if req.BlockingIPv4 == nil || req.BlockingIPv6 == nil { | <mask> return false
<mask> }
<mask>
<mask> if bm == "custom_ip" {
<mask> ip := net.ParseIP(req.BlockingIPv4)
<mask> if ip == nil || ip.To4() == nil {
<mask> return false
<mask> }
<mask>
<mask> ip = net.ParseIP(req.BlockingIPv6)
<mask> if ip == nil {
</s> Pull request: 2271 handle nolint
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
ip4 := net.ParseIP(*req.BlockingIPv4)
if ip4 == nil || ip4.To4() == nil { | <mask> if ip == nil || ip.To4() == nil {
<mask> return false
<mask> }
<mask>
<mask> ip = net.ParseIP(req.BlockingIPv6)
<mask> if ip == nil {
<mask> return false
<mask> }
<mask> }
<mask>
<mask> return true
</s> Pull request: 2271 handle nolint
Merge in DNS/adguard-home from 2271-handle-n... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
ip6 := net.ParseIP(*req.BlockingIPv6)
return ip6 != nil | <mask> if ip4 == nil || ip4.To4() == nil {
<mask> return false
<mask> }
<mask> }
<mask>
<mask> for _, valid := range []string{
<mask> "default",
<mask> "refused",
<mask> "nxdomain",
</s> Pull request: 2271 handle nolint
Merge in DNS/adguard-home from 2271-handle-nolint to master
Closes #2271... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
for _, valid := range []string{
"default",
"refused",
"nxdomain",
"null_ip",
} {
if bm == valid {
return true
}
}
return false | <mask> return false
<mask> }
<mask> }
<mask>
<mask> return true
<mask> }
<mask>
<mask> // Validate bootstrap server address
<mask> func checkBootstrap(addr string) error {
<mask> if addr == "" { // additional check is required because NewResolver() allows empty address
</s> Pull request: 2271 handl... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
func (req *dnsConfig) checkUpstreamsMode() bool {
if req.UpstreamMode == nil {
return true | <mask>
<mask> return true
<mask> }
<mask>
<mask> // Validate bootstrap server address
<mask> func checkBootstrap(addr string) error {
<mask> if addr == "" { // additional check is required because NewResolver() allows empty address
<mask> return fmt.Errorf("invalid bootstrap server address: empty")
<mask... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
for _, valid := range []string{
"",
"fastest_addr",
"parallel",
} {
if *req.UpstreamMode == valid {
return true
} | <mask> func checkBootstrap(addr string) error {
<mask> if addr == "" { // additional check is required because NewResolver() allows empty address
<mask> return fmt.Errorf("invalid bootstrap server address: empty")
<mask> }
<mask> _, err := upstream.NewResolver(addr, 0)
<mask> if err != nil {
<mask> retur... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
return false
}
func (req *dnsConfig) checkBootstrap() (string, error) {
if req.Bootstraps == nil {
return "", nil
}
for _, boot := range *req.Bootstraps {
if boot == "" {
return boot, fmt.Errorf("invalid bootstrap server address: empty")
}
if _, err := upstream.NewResolver(boot, 0); err != nil {
re... | <mask> _, err := upstream.NewResolver(addr, 0)
<mask> if err != nil {
<mask> return fmt.Errorf("invalid bootstrap server address: %w", err)
<mask> }
<mask> return nil
<mask> }
<mask>
<mask> // nolint(gocyclo) - we need to check each JSON field separately
<mask> func (s *Server) handleSetConfig(w http.Re... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
<mask> }
<mask> return nil
<mask> }
<mask>
<mask> // nolint(gocyclo) - we need to check each JSON field separately
<mask> func (s *Server) handleSetConfig(w http.ResponseWriter, r *http.Request) {
<mask> req := dnsConfigJSON{}
<mask> js, err := jsonutil.DecodeObject(&req, r.Body)
<mask> if err != nil {
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/3045da1742ee0e75392de1623900d7d88b08f0b4 | internal/dnsforward/dnsforward_http.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.