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
const Tooltip = (props) => (
<mask> import PropTypes from 'prop-types'; <mask> <mask> import './Tooltip.css'; <mask> <mask> const Tooltip = props => ( <mask> <div data-tooltip={props.text} className={`tooltip-custom ${props.type || ''}`}></div> <mask> ); <mask> <mask> Tooltip.propTypes = { <mask> text: PropTypes.string.isRequi...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/components/ui/Tooltip.js
const Topline = (props) => (
<mask> import PropTypes from 'prop-types'; <mask> <mask> import './Topline.css'; <mask> <mask> const Topline = props => ( <mask> <div className={`alert alert-${props.type} topline`}> <mask> <div className="container"> <mask> {props.children} <mask> </div> <mask> </div> <...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/components/ui/Topline.js
import { Trans, withTranslation } from 'react-i18next';
<mask> import React from 'react'; <mask> import PropTypes from 'prop-types'; <mask> import { Trans, withNamespaces } from 'react-i18next'; <mask> import classnames from 'classnames'; <mask> <mask> import './Overlay.css'; <mask> <mask> const UpdateOverlay = (props) => { </s> + client: Update packages - Merge ...
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/components/ui/UpdateOverlay.js
export default withTranslation()(UpdateOverlay);
<mask> UpdateOverlay.propTypes = { <mask> processingUpdate: PropTypes.bool, <mask> }; <mask> <mask> export default withNamespaces()(UpdateOverlay); </s> + client: Update packages - Merge pull request #613 in DNS/adguard-home from fix/1597 to master Close #1597 Squashed commit of the following: commit 1eb89...
[ "keep", "keep", "keep", "keep", "replace" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/components/ui/UpdateOverlay.js
import { Trans, withTranslation } from 'react-i18next';
<mask> import React, { Fragment } from 'react'; <mask> import PropTypes from 'prop-types'; <mask> import { Trans, withNamespaces } from 'react-i18next'; <mask> <mask> import Topline from './Topline'; <mask> <mask> const UpdateTopline = props => ( <mask> <Topline type="info"> </s> + client: Update package...
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/components/ui/UpdateTopline.js
const UpdateTopline = (props) => (
<mask> import { Trans, withNamespaces } from 'react-i18next'; <mask> <mask> import Topline from './Topline'; <mask> <mask> const UpdateTopline = props => ( <mask> <Topline type="info"> <mask> <Fragment> <mask> <Trans <mask> values={{ version: props.version }} <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/components/ui/UpdateTopline.js
{props.canAutoUpdate && <button
<mask> ]} <mask> > <mask> update_announcement <mask> </Trans> <mask> {props.canAutoUpdate && <mask> <button <mask> type="button" <mask> className="btn btn-sm btn-primary ml-3" <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/components/ui/UpdateTopline.js
export default withTranslation()(UpdateTopline);
<mask> getUpdate: PropTypes.func, <mask> processingUpdate: PropTypes.bool, <mask> }; <mask> <mask> export default withNamespaces()(UpdateTopline); </s> + client: Update packages - Merge pull request #613 in DNS/adguard-home from fix/1597 to master Close #1597 Squashed commit of the following: commit 1e...
[ "keep", "keep", "keep", "keep", "replace" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/components/ui/UpdateTopline.js
import { Trans, withTranslation } from 'react-i18next';
<mask> import React from 'react'; <mask> import PropTypes from 'prop-types'; <mask> import { Trans, withNamespaces } from 'react-i18next'; <mask> <mask> import './Version.css'; <mask> <mask> const Version = (props) => { <mask> const { </s> + client: Update packages - Merge pull request #613 in DNS/adguar...
[ "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/components/ui/Version.js
export default withTranslation()(Version);
<mask> processingVersion: PropTypes.bool.isRequired, <mask> t: PropTypes.func.isRequired, <mask> }; <mask> <mask> export default withNamespaces()(Version); </s> + client: Update packages - Merge pull request #613 in DNS/adguard-home from fix/1597 to master Close #1597 Squashed commit of the following: ...
[ "keep", "keep", "keep", "keep", "replace" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/components/ui/Version.js
window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : (f) => f,
<mask> export default function configureStore(reducer, initialState) { <mask> /* eslint-disable no-underscore-dangle */ <mask> const store = createStore(reducer, initialState, compose( <mask> applyMiddleware(...middlewares), <mask> window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOO...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/configureStore.js
import { addClient, updateClient, deleteClient, toggleClientModal, } from '../actions/clients';
<mask> import { connect } from 'react-redux'; <mask> import { getClients } from '../actions'; <mask> import { getStats } from '../actions/stats'; <mask> import { addClient, updateClient, deleteClient, toggleClientModal } from '../actions/clients'; <mask> import Clients from '../components/Settings/Clients'; <mask...
[ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/containers/Clients.js
import { getClients } from '../actions';
<mask> import { connect } from 'react-redux'; <mask> import { addSuccessToast, getClients } from '../actions'; <mask> import { getFilteringStatus, setRules } from '../actions/filtering'; <mask> import { getLogs, getLogsConfig, setLogsPagination, setLogsFilter, setLogsPage } from '../actions/queryLogs'; <mask> impo...
[ "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/containers/Logs.js
import { getLogs, getLogsConfig, setLogsPagination, setLogsFilter, setLogsPage, } from '../actions/queryLogs';
<mask> import { connect } from 'react-redux'; <mask> import { addSuccessToast, getClients } from '../actions'; <mask> import { getFilteringStatus, setRules } from '../actions/filtering'; <mask> import { getLogs, getLogsConfig, setLogsPagination, setLogsFilter, setLogsPage } from '../actions/queryLogs'; <mask> impo...
[ "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/containers/Logs.js
import { addSuccessToast } from '../actions/toasts';
<mask> } from '../actions/queryLogs'; <mask> import Logs from '../components/Logs'; <mask> <mask> const mapStateToProps = (state) => { <mask> const { queryLogs, dashboard, filtering } = state; <mask> const props = { queryLogs, dashboard, filtering }; <mask> return props; </s> + client: Update packa...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/containers/Logs.js
} from './constants';
<mask> import PropTypes from 'prop-types'; <mask> import { <mask> R_IPV4, R_MAC, R_HOST, R_IPV6, R_CIDR, R_CIDR_IPV6, <mask> UNSAFE_PORTS, R_URL_REQUIRES_PROTOCOL, R_WIN_ABSOLUTE_PATH, R_UNIX_ABSOLUTE_PATH, <mask> } from '../helpers/constants'; <mask> import { createOnBlurHandler } from './helpers'; <mas...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
const onBlur = (event) => createOnBlurHandler(event, input, normalizeOnBlur);
<mask> input, id, className, placeholder, type, disabled, normalizeOnBlur, <mask> autoComplete, meta: { touched, error }, <mask> } = props; <mask> <mask> const onBlur = event => createOnBlurHandler(event, input, normalizeOnBlur); <mask> <mask> const element = React.createElement(ele...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
{!disabled && touched && error && <span className="form__message form__message--error">{error}</span>}
<mask> }); <mask> return ( <mask> <Fragment> <mask> {element} <mask> {!disabled && touched && (error && <span className="form__message form__message--error">{error}</span>)} <mask> </Fragment> <mask> ); <mask> }; <mask> <mask> renderField.propTypes = { </s...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
<mask> <mask> renderField.propTypes = { <mask> id: PropTypes.string.isRequired, <mask> input: PropTypes.object.isRequired, <mask> meta: PropTypes.object.isRequired, <mask> className: PropTypes.string, <mask> placeholder: PropTypes.string, <mask> type: PropTypes.string, <mask> disab...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
meta: PropTypes.shape({ touched: PropTypes.bool, error: PropTypes.object, }).isRequired,
<mask> disabled: PropTypes.bool, <mask> autoComplete: PropTypes.bool, <mask> normalizeOnBlur: PropTypes.func, <mask> }; <mask> <mask> export const renderTextareaField = (props) => renderField(props, 'textarea'); <mask> <mask> export const renderInputField = (props) => renderField(props, 'input'); ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
export const renderTextareaField = (props) => renderField(props, 'textarea');
<mask> autoComplete: PropTypes.bool, <mask> normalizeOnBlur: PropTypes.func, <mask> }; <mask> <mask> export const renderTextareaField = props => renderField(props, 'textarea'); <mask> <mask> export const renderInputField = props => renderField(props, 'input'); <mask> <mask> export const renderGroupF...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
export const renderInputField = (props) => renderField(props, 'input');
<mask> }; <mask> <mask> export const renderTextareaField = props => renderField(props, 'textarea'); <mask> <mask> export const renderInputField = props => renderField(props, 'input'); <mask> <mask> export const renderGroupField = ({ <mask> input, <mask> id, <mask> className, </s> + client: Upd...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
const onBlur = (event) => createOnBlurHandler(event, input, normalizeOnBlur);
<mask> removeField, <mask> meta: { touched, error }, <mask> normalizeOnBlur, <mask> }) => { <mask> const onBlur = event => createOnBlurHandler(event, input, normalizeOnBlur); <mask> <mask> return ( <mask> <Fragment> <mask> <div className="input-group"> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
{isActionAvailable && <span className="input-group-append">
<mask> disabled={disabled} <mask> autoComplete={autoComplete} <mask> onBlur={onBlur} <mask> /> <mask> {isActionAvailable && <mask> <span className="input-group-append"> <mask> <butt...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
{!disabled && touched && error && <span className="form__message form__message--error">{error}</span>}
<mask> </button> <mask> </span> <mask> } <mask> </div> <mask> {!disabled && <mask> touched && <mask> (error && <span className="form__message form__message--error">{error}</span>)} <mask> </Fragme...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
}) => <Fragment> <label className="custom-control custom-radio custom-control-inline"> <input {...input} type="radio" className="custom-control-input" disabled={disabled} /> <span className="custom-control-label">{placeholder}</span> </label> {!disabled && touched && (error && <span ...
<mask> }; <mask> <mask> export const renderRadioField = ({ <mask> input, placeholder, disabled, meta: { touched, error }, <mask> }) => ( <mask> <Fragment> <mask> <label className="custom-control custom-radio custom-control-inline"> <mask> <input {...input} type="radio" className="cu...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
}) => <Fragment> <label className={`checkbox ${modifier}`} onClick={onClick}> <span className="checkbox__marker" /> <input {...input} type="checkbox" className="checkbox__input" disabled={disabled} /> <span className="checkbox__label">
<mask> disabled, <mask> onClick, <mask> modifier = 'checkbox--form', <mask> meta: { touched, error }, <mask> }) => ( <mask> <Fragment> <mask> <label className={`checkbox ${modifier}`} onClick={onClick}> <mask> <span className="checkbox__marker" /> <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
</label> {!disabled && touched && (error && <span className="form__message form__message--error">{error}</span>)} </Fragment>; renderSelectField.propTypes = { input: PropTypes.object.isRequired, placeholder: PropTypes.string, subtitle: PropTypes.string, disabled: PropTypes.bool, onC...
<mask> /> <mask> )} <mask> </span> <mask> </span> <mask> </label> <mask> {!disabled && <mask> touched && <mask> (error && <span className="form__message form__message--error">{...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
}) => <Fragment> <label className={`service custom-switch ${modifier}`}> <input {...input} type="checkbox" className="custom-switch-input" value={placeholder.toLowerCase()} disabled={disabled} /> <span className="service__switch cus...
<mask> disabled, <mask> modifier, <mask> icon, <mask> meta: { touched, error }, <mask> }) => ( <mask> <Fragment> <mask> <label className={`service custom-switch ${modifier}`}> <mask> <input <mask> {...input} <mask> type="checkbox" <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", "ke...
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
} if (value && (value < 80 || value > 65535)) {
<mask> <mask> export const portTLS = (value) => { <mask> if (value === 0) { <mask> return undefined; <mask> } else if (value && (value < 80 || value > 65535)) { <mask> return <Trans>form_error_port_range</Trans>; <mask> } <mask> return undefined; <mask> }; <mask> </s> + clie...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
export const isValidAbsolutePath = (value) => R_WIN_ABSOLUTE_PATH.test(value)
<mask> } <mask> return undefined; <mask> }; <mask> <mask> export const isValidAbsolutePath = value => R_WIN_ABSOLUTE_PATH.test(value) <mask> || R_UNIX_ABSOLUTE_PATH.test(value); <mask> <mask> export const isValidPath = (value) => { <mask> if (value && !isValidAbsolutePath(value) && !R_URL_REQ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
export const toNumber = (value) => value && parseInt(value, 10);
<mask> } <mask> return undefined; <mask> }; <mask> <mask> export const toNumber = value => value && parseInt(value, 10); </s> + client: Update packages - Merge pull request #613 in DNS/adguard-home from fix/1597 to master Close #1597 Squashed commit of the following: commit 1eb89586dd71260e561420fe669a...
[ "keep", "keep", "keep", "keep", "replace" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f3cd4e7eb1f9c790208d8f42ead6af04f2138e4
client/src/helpers/form.js
"encoding/gob"
<mask> "context" <mask> "crypto/sha256" <mask> "encoding/json" <mask> "fmt" <mask> "io/ioutil" <mask> "net" <mask> "net/http" <mask> "os" </s> * dnsfilter: use fastcache instead of gcache </s> remove "errors" </s> add </s> remove safebrowsingCache gcache.Cache parentalCache gcache.Cache safeS...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
<mask> "bytes" <mask> "context" <mask> "crypto/sha256" <mask> "encoding/json" <mask> "errors" <mask> "fmt" <mask> "io/ioutil" <mask> "net" <mask> "net/http" <mask> "os" </s> * dnsfilter: use fastcache instead of gcache </s> remove safebrowsingCache gcache.Cache parentalCache gcache.Cache saf...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
"github.com/VictoriaMetrics/fastcache"
<mask> "strings" <mask> "sync/atomic" <mask> "time" <mask> <mask> "github.com/joomcode/errorx" <mask> <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/urlfilter" </s> * dnsfilter: use fastcache instead of gcache </s> remove "...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
safebrowsingCache *fastcache.Cache parentalCache *fastcache.Cache safeSearchCache *fastcache.Cache
<mask> <mask> type dnsFilterContext struct { <mask> stats Stats <mask> dialCache gcache.Cache // "host" -> "IP" cache for safebrowsing and parental control servers <mask> safebrowsingCache gcache.Cache <mask> parentalCache gcache.Cache <mask> safeSearchCache gcache.Cache <mask> }...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
func setCacheResult(cache *fastcache.Cache, host string, res Result) { var buf bytes.Buffer enc := gob.NewEncoder(&buf) _ = enc.Encode(res) cache.Set([]byte(host), buf.Bytes()) log.Debug("Stored in cache %p: %s => [%d]", cache, host, buf.Len()) } func getCachedResult(cache *fastcache.Cache, host string) (result R...
<mask> // nothing matched, return nothing <mask> return Result{}, nil <mask> } <mask> <mask> func getCachedReason(cache gcache.Cache, host string) (result Result, isFound bool, err error) { <mask> isFound = false // not found yet <mask> <mask> // get raw value <mask> rawValue, err := cache.Get(host) <m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
rawValue := cache.Get(nil, []byte(host)) if len(rawValue) == 0 { return Result{}, false
<mask> func getCachedReason(cache gcache.Cache, host string) (result Result, isFound bool, err error) { <mask> isFound = false // not found yet <mask> <mask> // get raw value <mask> rawValue, err := cache.Get(host) <mask> if err == gcache.KeyNotFoundError { <mask> // not a real error, just not found <mas...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
var buf bytes.Buffer buf.Write(rawValue) dec := gob.NewDecoder(&buf) cachedValue := Result{} err := dec.Decode(&cachedValue) if err != nil { log.Debug("gob.Decode(): %s", err) return Result{}, false
<mask> // real error <mask> return <mask> } <mask> <mask> // since it can be something else, validate that it belongs to proper type <mask> cachedValue, ok := rawValue.(Result) <mask> if !ok { <mask> // this is not our type -- error <mask> text := "SHOULD NOT HAPPEN: entry with invalid type was fo...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
return cachedValue, true
<mask> log.Println(text) <mask> err = errors.New(text) <mask> return <mask> } <mask> isFound = ok <mask> return cachedValue, isFound, err <mask> } <mask> <mask> // for each dot, hash it and add it to string <mask> func hostnameToHashParam(host string, addslash bool) (string, map[string]bool) { <mas...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
cachedValue, isFound := getCachedResult(gctx.safeSearchCache, host)
<mask> defer timer.LogElapsed("SafeSearch HTTP lookup for %s", host) <mask> } <mask> <mask> // Check cache. Return cached result if it was found <mask> cachedValue, isFound, err := getCachedReason(gctx.safeSearchCache, host) <mask> if isFound { <mask> atomic.AddUint64(&gctx.stats.Safesearch.CacheHits, 1...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
<mask> log.Tracef("%s: found in SafeSearch cache", host) <mask> return cachedValue, nil <mask> } <mask> <mask> if err != nil { <mask> return Result{}, err <mask> } <mask> <mask> safeHost, ok := d.SafeSearchDomain(host) <mask> if !ok { <mask> return Result{}, nil <mask> } <mask> </s> * dns...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
setCacheResult(gctx.safeSearchCache, host, res)
<mask> <mask> res := Result{IsFiltered: true, Reason: FilteredSafeSearch} <mask> if ip := net.ParseIP(safeHost); ip != nil { <mask> res.IP = ip <mask> err = gctx.safeSearchCache.Set(host, res) <mask> if err != nil { <mask> return Result{}, nil <mask> } <mask> <mask> return res, nil <mask> }...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
setCacheResult(gctx.safeSearchCache, host, res)
<mask> return Result{}, fmt.Errorf("no ipv4 addresses in safe search response for %s", safeHost) <mask> } <mask> <mask> // Cache result <mask> err = gctx.safeSearchCache.Set(host, res) <mask> if err != nil { <mask> return Result{}, nil <mask> } <mask> return res, nil <mask> } <mask> <mask> func ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
func (d *Dnsfilter) lookupCommon(host string, lookupstats *LookupStats, cache *fastcache.Cache, hashparamNeedSlash bool, format formatHandler, handleBody bodyHandler) (Result, error) {
<mask> type formatHandler func(hashparam string) string <mask> type bodyHandler func(body []byte, hashes map[string]bool) (Result, error) <mask> <mask> // real implementation of lookup/check <mask> func (d *Dnsfilter) lookupCommon(host string, lookupstats *LookupStats, cache gcache.Cache, hashparamNeedSlash bool,...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
cachedValue, isFound := getCachedResult(cache, host)
<mask> // if host ends with a dot, trim it <mask> host = strings.ToLower(strings.Trim(host, ".")) <mask> <mask> // check cache <mask> cachedValue, isFound, err := getCachedReason(cache, host) <mask> if isFound { <mask> atomic.AddUint64(&lookupstats.CacheHits, 1) <mask> log.Tracef("%s: found in the loo...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
log.Tracef("%s: found in the lookup cache %p", host, cache)
<mask> // check cache <mask> cachedValue, isFound, err := getCachedReason(cache, host) <mask> if isFound { <mask> atomic.AddUint64(&lookupstats.CacheHits, 1) <mask> log.Tracef("%s: found in the lookup cache", host) <mask> return cachedValue, nil <mask> } <mask> if err != nil { <mask> return Result...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
<mask> atomic.AddUint64(&lookupstats.CacheHits, 1) <mask> log.Tracef("%s: found in the lookup cache", host) <mask> return cachedValue, nil <mask> } <mask> if err != nil { <mask> return Result{}, err <mask> } <mask> <mask> // convert hostname to hash parameters <mask> hashparam, hashes := hostnam...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
setCacheResult(cache, host, Result{})
<mask> // handle status code <mask> switch { <mask> case resp.StatusCode == 204: <mask> // empty result, save cache <mask> err = cache.Set(host, Result{}) <mask> if err != nil { <mask> return Result{}, err <mask> } <mask> return Result{}, nil <mask> case resp.StatusCode != 200: <mask> // e...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
setCacheResult(cache, host, result)
<mask> // error, don't save cache <mask> return Result{}, err <mask> } <mask> <mask> err = cache.Set(host, result) <mask> if err != nil { <mask> return Result{}, err <mask> } <mask> return result, nil <mask> } <mask> <mask> // <mask> // Adding rule and matching against the rules </s> * dnsfil...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
gctx.safebrowsingCache = fastcache.New(c.SafeBrowsingCacheSize)
<mask> <mask> if c != nil { <mask> // initialize objects only once <mask> if gctx.safebrowsingCache == nil { <mask> gctx.safebrowsingCache = gcache.New(c.SafeBrowsingCacheSize).LRU().Expiration(defaultCacheTime).Build() <mask> } <mask> if gctx.safeSearchCache == nil { <mask> gctx.safeSearchCache...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
gctx.safeSearchCache = fastcache.New(c.SafeSearchCacheSize)
<mask> if gctx.safebrowsingCache == nil { <mask> gctx.safebrowsingCache = gcache.New(c.SafeBrowsingCacheSize).LRU().Expiration(defaultCacheTime).Build() <mask> } <mask> if gctx.safeSearchCache == nil { <mask> gctx.safeSearchCache = gcache.New(c.SafeSearchCacheSize).LRU().Expiration(defaultCacheTime).Bu...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
gctx.parentalCache = fastcache.New(c.ParentalCacheSize)
<mask> if gctx.safeSearchCache == nil { <mask> gctx.safeSearchCache = gcache.New(c.SafeSearchCacheSize).LRU().Expiration(defaultCacheTime).Build() <mask> } <mask> if gctx.parentalCache == nil { <mask> gctx.parentalCache = gcache.New(c.ParentalCacheSize).LRU().Expiration(defaultCacheTime).Build() <mask...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
dnsfilter/dnsfilter.go
github.com/VictoriaMetrics/fastcache v1.5.1
<mask> github.com/AdguardTeam/dnsproxy v0.15.0 <mask> github.com/AdguardTeam/golibs v0.1.3 <mask> github.com/AdguardTeam/urlfilter v0.4.1 <mask> github.com/NYTimes/gziphandler v1.1.1 <mask> github.com/bluele/gcache v0.0.0-20190203144525-2016d595ccb0 <mask> github.com/go-test/deep v1.0.1 <mask> github.com/...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
go.mod
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OneOfOne/xxhash v1.2.5 h1:zl/OfRA6nftbBK9qTohYBJ5xvw6C/oNKizR7cZGl3cI= github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
<mask> github.com/AdguardTeam/urlfilter v0.4.1/go.mod h1:6YehXZ8e0Hx2MvqeQWLFom6IkPinm04tNhO1CkwAxmg= <mask> github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= <mask> github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= <mask> github.com/Sta...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
go.sum
github.com/VictoriaMetrics/fastcache v1.5.1 h1:qHgHjyoNFV7jgucU8QZUuU4gcdhfs8QW1kw68OD2Lag= github.com/VictoriaMetrics/fastcache v1.5.1/go.mod h1:+jv9Ckb+za/P1ZRg/sulP5Ni1v49daAVERr0H3CuscE=
<mask> github.com/OneOfOne/xxhash v1.2.5 h1:zl/OfRA6nftbBK9qTohYBJ5xvw6C/oNKizR7cZGl3cI= <mask> github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= <mask> github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705 h1:UUppSQnhf4Yc6xGxSkoQpPhb7RVzuv5Nb1mwJ5VId9s= <mask> githu...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
go.sum
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
<mask> github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da h1:KjTM2ks9d14ZYCvmHS9iAKVt9AyzRSqNU1qabPih5BY= <mask> github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da/go.mod h1:eHEWzANqSiWQsof+nXEI9bUVUyV6F53Fp89EuCh2EAA= <mask> github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635 h1:52m0LGchQB...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
go.sum
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.0.1-0.20190104013014-3767db7a7e18 h1:pl4eWIqvFe/Kg3zkn7NxevNzILnZYWDCG7qbA1CJik0= github.com/cespare/xxhash/v2 v2.0.1-0...
<mask> github.com/beefsack/go-rate v0.0.0-20180408011153-efa7637bb9b6 h1:KXlsf+qt/X5ttPGEjR0tPH1xaWWoKBEg9Q1THAj2h3I= <mask> github.com/beefsack/go-rate v0.0.0-20180408011153-efa7637bb9b6/go.mod h1:6YNgTHLutezwnBvyneBbwvB8C82y3dcoOj5EQJIdGXA= <mask> github.com/bluele/gcache v0.0.0-20190203144525-2016d595ccb0 h1:vUdU...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
go.sum
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
<mask> github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264 h1:roWyi0eEdiFreSqW9V1wT9pNOVzrpo2NWsxja53slX0= <mask> github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= <mask> github.com/gobuffalo/packr v1.19.0 h1:3UDmBDxesCOPF8iZdMDBBWKfkBoYujI...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
go.sum
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.0.1-0.20190317074736-539464a789e9 h1:5Cp3cVwpQP4aCQ6jx6dNLP3IarbYiuStmIzYu+BjQwY= github.com/spaolacci/murmur3 v1.0.1-0.20190317074736-539464a789e9/go.mod h1:JwIasOWyU6f...
<mask> github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= <mask> github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= <mask> github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEf...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f51df7d2e3eb4672d4762e14e22e831fdadd256
go.sum
"sync"
<mask> "sort" <mask> "strconv" <mask> "strings" <mask> "time" <mask> <mask> "github.com/AdguardTeam/AdGuardHome/dnsforward" <mask> "github.com/AdguardTeam/dnsproxy/upstream" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/miekg/dns" </s> * control: safely restart DHCP server * control:...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f69fb73af7901b52a4717833de8554069c0b43b
control.go
var controlLock sync.Mutex
<mask> } <mask> <mask> // ---------------- <mask> // helper functions <mask> // ---------------- <mask> <mask> func returnOK(w http.ResponseWriter) { </s> * control: safely restart DHCP server * control: use mutex in all POST,PUT,DELETE handlers </s> remove if !newconfig.Enabled { err := dhcpServer.Stop()...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f69fb73af7901b52a4717833de8554069c0b43b
control.go
err = dhcpServer.Stop() if err != nil { log.Error("failed to stop the DHCP server: %s", err) }
<mask> return <mask> } <mask> <mask> if newconfig.Enabled { <mask> err := dhcpServer.Start(&newconfig) <mask> if err != nil { <mask> httpError(w, http.StatusBadRequest, "Failed to start DHCP server: %s", err) <mask> return </s> * control: safely restart DHCP server * control: use mutex in all P...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f69fb73af7901b52a4717833de8554069c0b43b
dhcp.go
<mask> httpError(w, http.StatusBadRequest, "Failed to start DHCP server: %s", err) <mask> return <mask> } <mask> } <mask> if !newconfig.Enabled { <mask> err := dhcpServer.Stop() <mask> if err != nil { <mask> log.Error("failed to stop the DHCP server: %s", err) <mask> } <mask> } <mask> co...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f69fb73af7901b52a4717833de8554069c0b43b
dhcp.go
if method == "POST" || method == "PUT" || method == "DELETE" { controlLock.Lock() defer controlLock.Unlock() }
<mask> if r.Method != method { <mask> http.Error(w, "This request must be "+method, http.StatusMethodNotAllowed) <mask> return <mask> } <mask> handler(w, r) <mask> } <mask> } <mask> </s> * control: safely restart DHCP server * control: use mutex in all POST,PUT,DELETE handlers </s> remove if !n...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6f69fb73af7901b52a4717833de8554069c0b43b
helpers.go
format := func(hashparam string) string {
<mask> return result, err <mask> } <mask> <mask> func (d *Dnsfilter) checkParental(host string) (Result, error) { <mask> format2 := func(hashparam string) string { <mask> url := fmt.Sprintf(defaultParentalURL, hashparam, d.config.parentalSensitivity) <mask> return url <mask> } <mask> handleBody2 := fu...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6fc50cd743a38f681b151703bbe06dd9cbc8e07c
dnsfilter/dnsfilter.go
handleBody := func(body []byte, hashes map[string]bool) (Result, error) {
<mask> format2 := func(hashparam string) string { <mask> url := fmt.Sprintf(defaultParentalURL, hashparam, d.config.parentalSensitivity) <mask> return url <mask> } <mask> handleBody2 := func(body []byte, hashes map[string]bool) (Result, error) { <mask> // parse json <mask> var m []struct { <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6fc50cd743a38f681b151703bbe06dd9cbc8e07c
dnsfilter/dnsfilter.go
result, err := d.lookupCommon(host, &stats.Parental, parentalCache, false, format, handleBody)
<mask> } <mask> } <mask> return result, nil <mask> } <mask> result, err := d.lookupCommon(host, &stats.Parental, parentalCache, false, format2, handleBody2) <mask> return result, err <mask> } <mask> <mask> // real implementation of lookup/check <mask> func (d *Dnsfilter) lookupCommon(host string, l...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/6fc50cd743a38f681b151703bbe06dd9cbc8e07c
dnsfilter/dnsfilter.go
defaultPageSize={100}
<mask> showPagination={false} <mask> noDataText={t('no_domains_found')} <mask> minRows={6} <mask> className="-striped -highlight card-table-overflow stats__table" <mask> /> <mask> </Card> <mask> ); <mask> }; <mask> </s> -...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701233a4b786495be2f7f8e5e33ebf041481df01
client/src/components/Dashboard/BlockedDomains.js
defaultPageSize={100}
<mask> ]} <mask> showPagination={false} <mask> noDataText={t('no_clients_found')} <mask> minRows={6} <mask> className="-striped -highlight card-table-overflow" <mask> /> <mask> </Card> <mask> ); <mask> </s> - client: fix default page siz...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701233a4b786495be2f7f8e5e33ebf041481df01
client/src/components/Dashboard/Clients.js
defaultPageSize={100}
<mask> noDataText={t('no_domains_found')} <mask> minRows={6} <mask> className="-striped -highlight card-table-overflow stats__table" <mask> /> <mask> </Card> <mask> ); <mask> </s> - client: fix default page size for dashboard tables
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701233a4b786495be2f7f8e5e33ebf041481df01
client/src/components/Dashboard/QueriedDomains.js
"time"
<mask> "path/filepath" <mask> "strconv" <mask> <mask> "github.com/gobuffalo/packr" <mask> "golang.org/x/crypto/ssh/terminal" <mask> ) <mask> </s> Protect against users deleting the filter ID's in the config file. Incidentally, it also simplifies upgrade schema from 0 to 1. </s> remove var NextFilterId = ...
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701fd10c1cc519d73e88c88b9be5dd9ad398276c
app.go
<mask> if err != nil { <mask> log.Fatal(err) <mask> } <mask> <mask> // Load filters from the disk <mask> for i := range config.Filters { <mask> filter := &config.Filters[i] <mask> err = filter.load() <mask> if err != nil { <mask> // This is okay for the first start, the filter will be loaded l...
[ "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/701fd10c1cc519d73e88c88b9be5dd9ad398276c
app.go
var nextFilterID int64 = time.Now().Unix()
<mask> userFilterID = 0 // special filter ID, always 0 <mask> ) <mask> <mask> // Just a counter that we use for incrementing the filter ID <mask> var NextFilterId = time.Now().Unix() <mask> <mask> // configuration is loaded from YAML <mask> // field ordering is important -- yaml fields will m...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701fd10c1cc519d73e88c88b9be5dd9ad398276c
config.go
ID int64 // auto-assigned when filter is added (see nextFilterID)
<mask> URL string `json:"url"` <mask> Name string `json:"name" yaml:"name"` <mask> RulesCount int `json:"rulesCount" yaml:"-"` <mask> LastUpdated time.Time `json:"lastUpdated,omitempty" yaml:"last_updated,omitempty"` <mask> ID int64 // auto-assigned when filter is adde...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701fd10c1cc519d73e88c88b9be5dd9ad398276c
config.go
updateUniqueFilterID(config.Filters)
<mask> // all entries we want to keep are at front, delete the rest <mask> config.Filters = config.Filters[:i] <mask> } <mask> <mask> // Set the next filter ID to max(filter.ID) + 1 <mask> for i := range config.Filters { <mask> if NextFilterId < config.Filters[i].ID { <mask> NextFilterId = config.F...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701fd10c1cc519d73e88c88b9be5dd9ad398276c
config.go
filter.ID = assignUniqueFilterID()
<mask> } <mask> } <mask> <mask> // Set necessary properties <mask> filter.ID = NextFilterId <mask> filter.Enabled = true <mask> NextFilterId++ <mask> <mask> // Download the filter contents <mask> ok, err := filter.update(true) </s> Protect against users deleting the filter ID's in the config file....
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701fd10c1cc519d73e88c88b9be5dd9ad398276c
control.go
<mask> <mask> // Set necessary properties <mask> filter.ID = NextFilterId <mask> filter.Enabled = true <mask> NextFilterId++ <mask> <mask> // Download the filter contents <mask> ok, err := filter.update(true) <mask> if err != nil { <mask> errorText := fmt.Sprintf("Couldn't fetch filter from url %s:...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701fd10c1cc519d73e88c88b9be5dd9ad398276c
control.go
if filter.ID == 0 { // protect against users modifying the yaml and removing the ID filter.ID = assignUniqueFilterID() }
<mask> // fetch URLs <mask> updateCount := 0 <mask> for i := range config.Filters { <mask> filter := &config.Filters[i] // otherwise we will be operating on a copy <mask> updated, err := filter.update(force) <mask> if err != nil { <mask> log.Printf("Failed to update filter %s: %s\n", filter.URL, err)...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701fd10c1cc519d73e88c88b9be5dd9ad398276c
control.go
if filter.ID == 0 { // protect against users deleting the ID filter.ID = assignUniqueFilterID() }
<mask> // Checks for filters updates <mask> // If "force" is true -- does not check the filter's LastUpdated field <mask> // Call "save" to persist the filter contents <mask> func (filter *filter) update(force bool) (bool, error) { <mask> if !filter.Enabled { <mask> return false, nil <mask> } <mask> if !fo...
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/701fd10c1cc519d73e88c88b9be5dd9ad398276c
control.go
// No more "dnsfilter.txt", filters are now kept in data/filters/
<mask> func upgradeSchema0to1(diskConfig *map[string]interface{}) error { <mask> trace("Called") <mask> <mask> // The first schema upgrade: <mask> // Added "ID" field to "filter" -- we need to populate this field now <mask> // Added "config.ourDataDir" -- where we will now store filters contents <mask> for...
[ "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/701fd10c1cc519d73e88c88b9be5dd9ad398276c
upgrade.go
cellWrap = ({ value }) => ( <div className="logs__row logs__row--overflow"> <span className="logs__text" title={value}> {value} </span> </div> );
<mask> return ''; <mask> }; <mask> <mask> columns = [ <mask> { <mask> Header: this.props.t('table_client'), <mask> accessor: 'ip', </s> * client: remove redundant table formatting for runtime clients table </s> remove Cell: ({ value }) => ( ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/702db84e39bf6ee43de51ded9bd4dd154171f4ed
client/src/components/Settings/Clients/AutoClients.js
Cell: this.cellWrap,
<mask> columns = [ <mask> { <mask> Header: this.props.t('table_client'), <mask> accessor: 'ip', <mask> Cell: (row) => { <mask> if (row.value) { <mask> return ( <mask> <div className="logs__row logs__row--...
[ "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", "ke...
https://github.com/AdguardTeam/AdGuardHome/commit/702db84e39bf6ee43de51ded9bd4dd154171f4ed
client/src/components/Settings/Clients/AutoClients.js
Cell: this.cellWrap,
<mask> }, <mask> { <mask> Header: this.props.t('table_name'), <mask> accessor: 'name', <mask> Cell: ({ value }) => ( <mask> <div className="logs__row logs__row--overflow"> <mask> <span className="logs__text" title={value}> <...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/702db84e39bf6ee43de51ded9bd4dd154171f4ed
client/src/components/Settings/Clients/AutoClients.js
c.SafeBrowsingCacheSize = 10000 c.ParentalCacheSize = 10000
<mask> func NewForTest(c *Config, filters []Filter) *Dnsfilter { <mask> setts = RequestFilteringSettings{} <mask> setts.FilteringEnabled = true <mask> if c != nil { <mask> c.SafeBrowsingCacheSize = 1000 <mask> c.SafeSearchCacheSize = 1000 <mask> c.ParentalCacheSize = 1000 <mask> c.CacheTime = 30 <ma...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/705a9d909dfb37bb759ca1525af4d3748444f5f4
dnsfilter/dnsfilter_test.go
<mask> setts.FilteringEnabled = true <mask> if c != nil { <mask> c.SafeBrowsingCacheSize = 1000 <mask> c.SafeSearchCacheSize = 1000 <mask> c.ParentalCacheSize = 1000 <mask> c.CacheTime = 30 <mask> setts.SafeSearchEnabled = c.SafeSearchEnabled <mask> setts.SafeBrowsingEnabled = c.SafeBrowsingEnable...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/705a9d909dfb37bb759ca1525af4d3748444f5f4
dnsfilter/dnsfilter_test.go
<mask> } <mask> <mask> // SAFE BROWSING <mask> <mask> func TestSafeBrowsingHash(t *testing.T) { <mask> q, hashes := hostnameToHashParam("1.2.3.4.5.6") <mask> assert.Equal(t, "0132d0fa.b5413b4e.5fa067c1.e7f6c011.", q) <mask> assert.Equal(t, 4, len(hashes)) <mask> } <mask> <mask> func TestSafeBrowsing(t ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/705a9d909dfb37bb759ca1525af4d3748444f5f4
dnsfilter/dnsfilter_test.go
UDPListenAddr: []*net.UDPAddr{s.conf.UDPListenAddr}, TCPListenAddr: []*net.TCPAddr{s.conf.TCPListenAddr},
<mask> <mask> // createProxyConfig creates and validates configuration for the main proxy <mask> func (s *Server) createProxyConfig() (proxy.Config, error) { <mask> proxyConfig := proxy.Config{ <mask> UDPListenAddr: s.conf.UDPListenAddr, <mask> TCPListenAddr: s.conf.TCPListenAddr, <mask> ...
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/705a9d909dfb37bb759ca1525af4d3748444f5f4
dnsforward/config.go
proxyConfig.TLSListenAddr = []*net.TCPAddr{s.conf.TLSListenAddr}
<mask> <mask> // prepareTLS - prepares TLS configuration for the DNS proxy <mask> func (s *Server) prepareTLS(proxyConfig *proxy.Config) error { <mask> if s.conf.TLSListenAddr != nil && len(s.conf.CertificateChainData) != 0 && len(s.conf.PrivateKeyData) != 0 { <mask> proxyConfig.TLSListenAddr = s.conf.TLSListe...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/705a9d909dfb37bb759ca1525af4d3748444f5f4
dnsforward/config.go
<mask> } <mask> <mask> func TestServerCustomClientUpstream(t *testing.T) { <mask> s := createTestServer(t) <mask> err := s.Start() <mask> if err != nil { <mask> t.Fatalf("Failed to start server: %s", err) <mask> } <mask> s.conf.GetCustomUpstreamByClient = func(clientAddr string) *proxy.UpstreamConfig {...
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/705a9d909dfb37bb759ca1525af4d3748444f5f4
dnsforward/dnsforward_test.go
assert.Nil(t, s.Start())
<mask> uc.Upstreams = append(uc.Upstreams, u) <mask> return uc <mask> } <mask> addr := s.dnsProxy.Addr(proxy.ProtoUDP) <mask> <mask> // Send test request <mask> req := dns.Msg{} </s> * SB/PC: use 4-character hash in request * use hash prefix as the cache key Squashed commit of the following: commit ...
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/705a9d909dfb37bb759ca1525af4d3748444f5f4
dnsforward/dnsforward_test.go
github.com/AdguardTeam/dnsproxy v0.30.1
<mask> <mask> go 1.14 <mask> <mask> require ( <mask> github.com/AdguardTeam/dnsproxy v0.29.1 <mask> github.com/AdguardTeam/golibs v0.4.2 <mask> github.com/AdguardTeam/urlfilter v0.11.2 <mask> github.com/NYTimes/gziphandler v1.1.1 <mask> github.com/fsnotify/fsnotify v1.4.7 <mask> github.com/gobuffalo/p...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/705a9d909dfb37bb759ca1525af4d3748444f5f4
go.mod
github.com/AdguardTeam/dnsproxy v0.30.1 h1:SnsL5kM/eFTrtLLdww1EePOhVDZTWzMkse+5tadGhvc= github.com/AdguardTeam/dnsproxy v0.30.1/go.mod h1:hOYFV9TW+pd5XKYz7KZf2FFD8SvSPqjyGTxUae86s58=
<mask> github.com/AdguardTeam/dnsproxy v0.29.1 h1:Stc+JLh67C9K38vbrH2920+3FnbXKkFzYQqRiu5auUo= <mask> github.com/AdguardTeam/dnsproxy v0.29.1/go.mod h1:hOYFV9TW+pd5XKYz7KZf2FFD8SvSPqjyGTxUae86s58= <mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4= <mask> github.com/Ad...
[ "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/705a9d909dfb37bb759ca1525af4d3748444f5f4
go.sum
if filepath.IsAbs(ls.LogFile) { logFilePath = ls.LogFile } file, err := os.OpenFile(logFilePath, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
<mask> log.Fatalf("cannot initialize syslog: %s", err) <mask> } <mask> } else { <mask> logFilePath := filepath.Join(config.ourWorkingDir, ls.LogFile) <mask> file, err := os.OpenFile(logFilePath, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0755) <mask> if err != nil { <mask> log.Fatalf("cannot create a lo...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/70c56f7a180e1113c289574e69dd148bc76db511
app.go
configFile, err := filepath.EvalSymlinks(config.ourConfigFilename) if err != nil { if !os.IsNotExist(err) { log.Error("unexpected error while config file path evaluation: %s", err) } configFile = config.ourConfigFilename }
<mask> } <mask> <mask> // getConfigFilename returns path to the current config file <mask> func (c *configuration) getConfigFilename() string { <mask> configFile := config.ourConfigFilename <mask> if !filepath.IsAbs(configFile) { <mask> configFile = filepath.Join(config.ourWorkingDir, config.ourConfigFilena...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/70c56f7a180e1113c289574e69dd148bc76db511
config.go
configFile = filepath.Join(config.ourWorkingDir, configFile)
<mask> // getConfigFilename returns path to the current config file <mask> func (c *configuration) getConfigFilename() string { <mask> configFile := config.ourConfigFilename <mask> if !filepath.IsAbs(configFile) { <mask> configFile = filepath.Join(config.ourWorkingDir, config.ourConfigFilename) <mask> } <ma...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/70c56f7a180e1113c289574e69dd148bc76db511
config.go
refreshFiltersIfNeccessary(false)
<mask> } <mask> <mask> // Update filters we've just loaded right away, don't wait for periodic update timer <mask> go func() { <mask> checkFiltersUpdates(false) <mask> // Save the updated config <mask> err := writeConfig() <mask> if err != nil { <mask> log.Fatal(err) <mask> } </s> Restore En...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/70c5afd6a5065ad827b038954dba1ade503a5246
app.go
go periodicallyRefreshFilters()
<mask> } <mask> <mask> address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort)) <mask> <mask> runFiltersUpdatesTimer() <mask> <mask> http.Handle("/", optionalAuthHandler(http.FileServer(box))) <mask> registerControlHandlers() <mask> <mask> err = startDNSServer() </s> Restore Engr...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/70c5afd6a5065ad827b038954dba1ade503a5246
app.go
refreshFiltersIfNeccessary(false)
<mask> return <mask> } <mask> <mask> // kick off refresh of rules from new URLs <mask> checkFiltersUpdates(false) <mask> httpUpdateConfigReloadDNSReturnOK(w, r) <mask> } <mask> <mask> func handleFilteringDisableURL(w http.ResponseWriter, r *http.Request) { <mask> parameters, err := parseParametersFro...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/70c5afd6a5065ad827b038954dba1ade503a5246
control.go
updated := refreshFiltersIfNeccessary(force != "")
<mask> } <mask> <mask> func handleFilteringRefresh(w http.ResponseWriter, r *http.Request) { <mask> force := r.URL.Query().Get("force") <mask> updated := checkFiltersUpdates(force != "") <mask> fmt.Fprintf(w, "OK %d filters updated\n", updated) <mask> } <mask> <mask> // Sets up a timer that will be checki...
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
https://github.com/AdguardTeam/AdGuardHome/commit/70c5afd6a5065ad827b038954dba1ade503a5246
control.go