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 |
|---|---|---|---|---|
// Anonymizer proccesses the IP addresses to anonymize those if needed.
Anonymizer *aghnet.IPMut | <mask> // AnonymizeClientIP tells if the query log should anonymize clients' IP
<mask> // addresses.
<mask> AnonymizeClientIP bool
<mask> }
<mask>
<mask> // AddParams - parameters for Add()
<mask> type AddParams struct {
<mask> Question *dns.Msg
<mask> Answer *dns.Msg // The response we ... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/querylog/querylog.go |
logFile: filepath.Join(conf.BaseDir, queryLogFileName),
anonymizer: conf.Anonymizer, | <mask>
<mask> l = &queryLog{
<mask> findClient: findClient,
<mask>
<mask> logFile: filepath.Join(conf.BaseDir, queryLogFileName),
<mask> }
<mask>
<mask> l.conf = &Config{}
<mask> *l.conf = conf
<mask>
</s> Pull request: 3890 fix anonymization
Merge in DNS/adguard-home from 3890-fix-stats to mast... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/querylog/querylog.go |
Filename string // database file name
LimitDays uint32 // time limit (in days)
UnitID unitIDCallback // user function to get the current unit ID. If nil, the current time hour is used. | <mask> }
<mask>
<mask> // Config - module configuration
<mask> type Config struct {
<mask> Filename string // database file name
<mask> LimitDays uint32 // time limit (in days)
<mask> UnitID unitIDCallback // user function to get the current unit ID. If nil, the c... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/stats.go |
// mu protects unit.
mu *sync.Mutex
// current is the actual statistics collection result.
current *unit
| <mask> )
<mask>
<mask> // statsCtx - global context
<mask> type statsCtx struct {
<mask> db *bolt.DB
<mask> conf *Config
<mask> }
<mask>
<mask> // data for 1 time unit
<mask> type unit struct {
</s> Pull request: 3890 fix anonymization
Merge in DNS/adguard-home from 3890-fix-stats to master
Updates #... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go |
<mask> // statsCtx - global context
<mask> type statsCtx struct {
<mask> db *bolt.DB
<mask> conf *Config
<mask>
<mask> unit *unit // the current unit
<mask> unitLock sync.Mutex // protect 'unit'
<mask> }
<mask>
<mask> // data for 1 time unit
<mask> type unit struct {
<mask> id uint32 // un... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go | |
s = &statsCtx{
mu: &sync.Mutex{},
} | <mask> TimeAvg uint32 // usec
<mask> }
<mask>
<mask> func createObject(conf Config) (s *statsCtx, err error) {
<mask> s = &statsCtx{}
<mask> if !checkInterval(conf.LimitDays) {
<mask> conf.LimitDays = 1
<mask> }
<mask>
<mask> s.conf = &Config{}
</s> Pull request: 3890 fix anonymization
Merge in DNS... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go |
s.current = &u | <mask> s.initUnit(&u, id)
<mask> if udb != nil {
<mask> deserialize(&u, udb)
<mask> }
<mask> s.unit = &u
<mask>
<mask> log.Debug("stats: initialized")
<mask>
<mask> return s, nil
<mask> }
</s> Pull request: 3890 fix anonymization
Merge in DNS/adguard-home from 3890-fix-stats to master
Updates #38... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go |
func (s *statsCtx) swapUnit(new *unit) (u *unit) {
s.mu.Lock()
defer s.mu.Unlock()
u = s.current
s.current = new
| <mask> }
<mask>
<mask> // Atomically swap the currently active unit with a new value
<mask> // Return old value
<mask> func (s *statsCtx) swapUnit(new *unit) *unit {
<mask> s.unitLock.Lock()
<mask> u := s.unit
<mask> s.unit = new
<mask> s.unitLock.Unlock()
<mask> return u
<mask> }
<mask>
<mask> // G... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go |
func (s *statsCtx) ongoing() (u *unit) {
s.mu.Lock()
defer s.mu.Unlock()
return s.current
}
| <mask> }
<mask>
<mask> // Flush the current unit to DB and delete an old unit when a new hour is started
<mask> // If a unit must be flushed:
<mask> // . lock DB
<mask> // . atomically set a new empty unit as the current one and get the old unit
<mask> // This is important to do it inside DB lock, so the read... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go |
ptr := s.ongoing() | <mask> // . remove the stale unit from DB
<mask> // . unlock DB
<mask> func (s *statsCtx) periodicFlush() {
<mask> for {
<mask> s.unitLock.Lock()
<mask> ptr := s.unit
<mask> s.unitLock.Unlock()
<mask>
<mask> if ptr == nil {
<mask> break
<mask> }
<mask>
<mask> id := s.conf.UnitID()
</s> P... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go |
<mask>
<mask> log.Debug("stats: cleared")
<mask> }
<mask>
<mask> // Get Client IP address
<mask> func (s *statsCtx) getClientIP(ip net.IP) (clientIP net.IP) {
<mask> if s.conf.AnonymizeClientIP && ip != nil {
<mask> const AnonymizeClientIP4Mask = 16
<mask> const AnonymizeClientIP6Mask = 112
<mask>
<... | [
"keep",
"keep",
"keep",
"keep",
"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/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go | |
<mask> }
<mask>
<mask> clientID := e.Client
<mask> if ip := net.ParseIP(clientID); ip != nil {
<mask> ip = s.getClientIP(ip)
<mask> clientID = ip.String()
<mask> }
<mask>
<mask> s.unitLock.Lock()
<mask> defer s.unitLock.Unlock()
</s> Pull request: 3890 fix anonymization
Merge in DNS/adguard-home... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go | |
s.mu.Lock()
defer s.mu.Unlock() | <mask> ip = s.getClientIP(ip)
<mask> clientID = ip.String()
<mask> }
<mask>
<mask> s.unitLock.Lock()
<mask> defer s.unitLock.Unlock()
<mask>
<mask> u := s.unit
<mask>
<mask> u.nResult[e.Result]++
<mask>
</s> Pull request: 3890 fix anonymization
Merge in DNS/adguard-home from 3890-fix-stats to ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go |
u := s.current | <mask>
<mask> s.unitLock.Lock()
<mask> defer s.unitLock.Unlock()
<mask>
<mask> u := s.unit
<mask>
<mask> u.nResult[e.Result]++
<mask>
<mask> if e.Result == RNotFiltered {
<mask> u.domains[e.Domain]++
</s> Pull request: 3890 fix anonymization
Merge in DNS/adguard-home from 3890-fix-stats to master... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go |
cur := s.ongoing()
curID := cur.id | <mask> if tx == nil {
<mask> return nil, 0
<mask> }
<mask>
<mask> s.unitLock.Lock()
<mask> curUnit := serialize(s.unit)
<mask> curID := s.unit.id
<mask> s.unitLock.Unlock()
<mask>
<mask> // Per-hour units.
<mask> units := []*unitDB{}
<mask> firstID := curID - limit + 1
<mask> for i := firstID... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go |
units = append(units, serialize(cur)) | <mask> }
<mask>
<mask> _ = tx.Rollback()
<mask>
<mask> units = append(units, curUnit)
<mask>
<mask> if len(units) != int(limit) {
<mask> log.Fatalf("len(units) != limit: %d %d", len(units), limit)
<mask> }
<mask>
</s> Pull request: 3890 fix anonymization
Merge in DNS/adguard-home from 3890-fix-st... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d2cf3233b8fc65538bdc052d600f224a7126f2e0 | internal/stats/unit.go |
setts := s.dnsFilter.Settings() | <mask>
<mask> // getClientRequestFilteringSettings looks up client filtering settings using
<mask> // the client's IP address and ID, if any, from dctx.
<mask> func (s *Server) getClientRequestFilteringSettings(dctx *dnsContext) *filtering.Settings {
<mask> setts := s.dnsFilter.GetConfig()
<mask> setts.Protect... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/dnsforward/filter.go |
s.conf.FilterHandler(ip, dctx.clientID, setts) | <mask> setts := s.dnsFilter.GetConfig()
<mask> setts.ProtectionEnabled = dctx.protectionEnabled
<mask> if s.conf.FilterHandler != nil {
<mask> ip, _ := netutil.IPAndPortFromAddr(dctx.proxyCtx.Addr)
<mask> s.conf.FilterHandler(ip, dctx.clientID, &setts)
<mask> }
<mask>
<mask> return &setts
<mask> }
<... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/dnsforward/filter.go |
return setts | <mask> ip, _ := netutil.IPAndPortFromAddr(dctx.proxyCtx.Addr)
<mask> s.conf.FilterHandler(ip, dctx.clientID, &setts)
<mask> }
<mask>
<mask> return &setts
<mask> }
<mask>
<mask> // filterDNSRequest applies the dnsFilter and sets dctx.proxyCtx.Res if the
<mask> // request was filtered.
<mask> func (s *S... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/dnsforward/filter.go |
"time" | <mask>
<mask> import (
<mask> "encoding/json"
<mask> "net/http"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/schedule"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/urlfilter/rules"
</s> Pull request... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/blocked.go |
"github.com/AdguardTeam/AdGuardHome/internal/schedule" | <mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/urlfilter/rules"
<mask> "golang.org/x/exp/slices"
<mask> )
<mask>
</s> Pull request 1854: 951-blocked-services-schedule
Merge in DNS/adguard-home from 951-blocked-... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/blocked.go |
// BlockedServices is the configuration of blocked services.
type BlockedServices struct {
// Schedule is blocked services schedule for every day of the week.
Schedule *schedule.Weekly `yaml:"schedule"`
// IDs is the names of blocked services.
IDs []string `yaml:"ids"`
}
| <mask> log.Debug("filtering: initialized %d services", l)
<mask> }
<mask>
<mask> // BlockedSvcKnown returns true if a blocked service ID is known.
<mask> func BlockedSvcKnown(s string) (ok bool) {
<mask> _, ok = serviceRules[s]
<mask>
<mask> return ok
</s> Pull request 1854: 951-blocked-services-schedule
... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/blocked.go |
func (d *DNSFilter) ApplyBlockedServices(setts *Settings) {
d.confLock.RLock()
defer d.confLock.RUnlock()
| <mask> return ok
<mask> }
<mask>
<mask> // ApplyBlockedServices - set blocked services settings for this DNS request
<mask> func (d *DNSFilter) ApplyBlockedServices(setts *Settings, list []string) {
<mask> setts.ServicesRules = []ServiceEntry{}
<mask> if list == nil {
<mask> d.confLock.RLock()
<mask> d... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/blocked.go |
<mask>
<mask> // ApplyBlockedServices - set blocked services settings for this DNS request
<mask> func (d *DNSFilter) ApplyBlockedServices(setts *Settings, list []string) {
<mask> setts.ServicesRules = []ServiceEntry{}
<mask> if list == nil {
<mask> d.confLock.RLock()
<mask> defer d.confLock.RUnlock()
<m... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/blocked.go | |
bsvc := d.BlockedServices
// TODO(s.chzhen): Use startTime from [dnsforward.dnsContext].
if !bsvc.Schedule.Contains(time.Now()) {
d.ApplyBlockedServicesList(setts, bsvc.IDs) | <mask> if list == nil {
<mask> d.confLock.RLock()
<mask> defer d.confLock.RUnlock()
<mask>
<mask> list = d.Config.BlockedServices
<mask> }
<mask>
<mask> for _, name := range list {
<mask> rules, ok := serviceRules[name]
<mask> if !ok {
</s> Pull request 1854: 951-blocked-services-schedule
Mer... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/blocked.go |
} | <mask> // TODO(s.chzhen): Use startTime from [dnsforward.dnsContext].
<mask> if !bsvc.Schedule.Contains(time.Now()) {
<mask> d.ApplyBlockedServicesList(setts, bsvc.IDs)
<mask> }
<mask>
<mask> // ApplyBlockedServicesList appends filtering rules to the settings.
<mask> func (d *DNSFilter) ApplyBlockedServic... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/blocked.go |
// ApplyBlockedServicesList appends filtering rules to the settings.
func (d *DNSFilter) ApplyBlockedServicesList(setts *Settings, list []string) { | <mask> d.ApplyBlockedServicesList(setts, bsvc.IDs)
<mask> }
<mask> }
<mask>
<mask> for _, name := range list {
<mask> rules, ok := serviceRules[name]
<mask> if !ok {
<mask> log.Error("unknown service name: %s", name)
<mask>
<mask> continue
</s> Pull request 1854: 951-blocked-services-schedule... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/blocked.go |
list := d.Config.BlockedServices.IDs | <mask> }
<mask>
<mask> func (d *DNSFilter) handleBlockedServicesList(w http.ResponseWriter, r *http.Request) {
<mask> d.confLock.RLock()
<mask> list := d.Config.BlockedServices
<mask> d.confLock.RUnlock()
<mask>
<mask> _ = aghhttp.WriteJSONResponse(w, r, list)
<mask> }
<mask>
</s> Pull request 1854: 9... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/blocked.go |
d.Config.BlockedServices.IDs = list | <mask> return
<mask> }
<mask>
<mask> d.confLock.Lock()
<mask> d.Config.BlockedServices = list
<mask> d.confLock.Unlock()
<mask>
<mask> log.Debug("Updated blocked services list: %d", len(list))
<mask>
<mask> d.Config.ConfigModified()
</s> Pull request 1854: 951-blocked-services-schedule
Merge in D... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/blocked.go |
// BlockedServices is the configuration of blocked services. | <mask> SafeSearch SafeSearch `yaml:"-"`
<mask>
<mask> Rewrites []*LegacyRewrite `yaml:"rewrites"`
<mask>
<mask> // Names of services to block (globally).
<mask> // Per-client settings can override this configuration.
<mask> BlockedServices []string `yaml:"blocked_services"`
<mask>
<mask> // ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/filtering.go |
BlockedServices *BlockedServices `yaml:"blocked_services"` | <mask> Rewrites []*LegacyRewrite `yaml:"rewrites"`
<mask>
<mask> // Names of services to block (globally).
<mask> // Per-client settings can override this configuration.
<mask> BlockedServices []string `yaml:"blocked_services"`
<mask>
<mask> // EtcHosts is a container of IP-hostname pairs taken from the o... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/filtering.go |
// Settings returns filtering settings.
func (d *DNSFilter) Settings() (s *Settings) { | <mask> func (d *DNSFilter) SetEnabled(enabled bool) {
<mask> atomic.StoreUint32(&d.enabled, mathutil.BoolToNumber[uint32](enabled))
<mask> }
<mask>
<mask> // GetConfig - get configuration
<mask> func (d *DNSFilter) GetConfig() (s Settings) {
<mask> d.confLock.RLock()
<mask> defer d.confLock.RUnlock()
<mask... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/filtering.go |
return &Settings{ | <mask> func (d *DNSFilter) GetConfig() (s Settings) {
<mask> d.confLock.RLock()
<mask> defer d.confLock.RUnlock()
<mask>
<mask> return Settings{
<mask> FilteringEnabled: atomic.LoadUint32(&d.Config.enabled) != 0,
<mask> SafeSearchEnabled: d.Config.SafeSearchConf.Enabled,
<mask> SafeBrowsingEnable... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/filtering.go |
if d.BlockedServices != nil {
bsvcs := []string{}
for _, s := range d.BlockedServices.IDs {
if !BlockedSvcKnown(s) {
log.Debug("skipping unknown blocked-service %q", s) | <mask> if err != nil {
<mask> return nil, fmt.Errorf("rewrites: preparing: %s", err)
<mask> }
<mask>
<mask> bsvcs := []string{}
<mask> for _, s := range d.BlockedServices {
<mask> if !BlockedSvcKnown(s) {
<mask> log.Debug("skipping unknown blocked-service %q", s)
<mask>
<mask> continue
<mask>... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/filtering.go |
continue
}
bsvcs = append(bsvcs, s) | <mask> for _, s := range d.BlockedServices {
<mask> if !BlockedSvcKnown(s) {
<mask> log.Debug("skipping unknown blocked-service %q", s)
<mask>
<mask> continue
<mask> }
<mask> bsvcs = append(bsvcs, s)
<mask> }
<mask> d.BlockedServices = bsvcs
<mask>
</s> Pull request 1854: 951-blocked-service... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/filtering.go |
d.BlockedServices.IDs = bsvcs | <mask> log.Debug("skipping unknown blocked-service %q", s)
<mask>
<mask> continue
<mask> }
<mask> bsvcs = append(bsvcs, s)
<mask> }
<mask> d.BlockedServices = bsvcs
<mask>
<mask> if blockFilters != nil {
<mask> err = d.initFiltering(nil, blockFilters)
</s> Pull request 1854: 951-blocked-serv... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/filtering.go |
<mask> continue
<mask> }
<mask> bsvcs = append(bsvcs, s)
<mask> }
<mask> d.BlockedServices = bsvcs
<mask>
<mask> if blockFilters != nil {
<mask> err = d.initFiltering(nil, blockFilters)
<mask> if err != nil {
<mask> d.Close()
</s> Pull request 1854: 951-blocked-services-schedule
Merge in D... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/filtering.go | |
setts := d.Settings() | <mask>
<mask> func (d *DNSFilter) handleCheckHost(w http.ResponseWriter, r *http.Request) {
<mask> host := r.URL.Query().Get("name")
<mask>
<mask> setts := d.GetConfig()
<mask> setts.FilteringEnabled = true
<mask> setts.ProtectionEnabled = true
<mask>
<mask> d.ApplyBlockedServices(&setts, nil)
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/http.go |
d.ApplyBlockedServices(setts)
result, err := d.CheckHost(host, dns.TypeA, setts) | <mask> setts := d.GetConfig()
<mask> setts.FilteringEnabled = true
<mask> setts.ProtectionEnabled = true
<mask>
<mask> d.ApplyBlockedServices(&setts, nil)
<mask> result, err := d.CheckHost(host, dns.TypeA, &setts)
<mask> if err != nil {
<mask> aghhttp.Error(
<mask> r,
<mask> w,
<mask> http.... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/filtering/http.go |
"github.com/AdguardTeam/AdGuardHome/internal/schedule" | <mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/querylog"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/stats"
<mask> "github.com/AdguardTeam/dnsproxy/fastip"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/home/config.go |
BlockedServices: &filtering.BlockedServices{
Schedule: schedule.EmptyWeekly(),
IDs: []string{},
}, | <mask> Pixabay: true,
<mask> Yandex: true,
<mask> YouTube: true,
<mask> },
<mask> },
<mask> UpstreamTimeout: timeutil.Duration{Duration: dnsforward.DefaultTimeout},
<mask> UsePrivateRDNS: true,
<mask> },
<mask> TLS: tlsConfigSettings{
<mask> PortHTTPS: defaultPortHTTP... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/home/config.go |
Context.filters.ApplyBlockedServices(setts) | <mask> func applyAdditionalFiltering(clientIP net.IP, clientID string, setts *filtering.Settings) {
<mask> // pref is a prefix for logging messages around the scope.
<mask> const pref = "applying filters"
<mask>
<mask> Context.filters.ApplyBlockedServices(setts, nil)
<mask>
<mask> log.Debug("%s: looking fo... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/home/dns.go |
Context.filters.ApplyBlockedServicesList(setts, svcs) | <mask> svcs := c.BlockedServices
<mask> if svcs == nil {
<mask> svcs = []string{}
<mask> }
<mask> Context.filters.ApplyBlockedServices(setts, svcs)
<mask> log.Debug("%s: services for client %q set: %s", pref, c.Name, svcs)
<mask> }
<mask>
<mask> setts.ClientName = c.Name
<mask> setts.ClientTa... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/home/dns.go |
const currentSchemaVersion = 21 | <mask> yaml "gopkg.in/yaml.v3"
<mask> )
<mask>
<mask> // currentSchemaVersion is the current schema version.
<mask> const currentSchemaVersion = 20
<mask>
<mask> // These aliases are provided for convenience.
<mask> type (
<mask> yarr = []any
<mask> yobj = map[string]any
</s> Pull request 1854: 951-bloc... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/home/upgrade.go |
upgradeSchema20to21, | <mask> upgradeSchema18to19,
<mask> upgradeSchema19to20,
<mask> }
<mask>
<mask> n := 0
<mask> for i, u := range upgrades {
</s> Pull request 1854: 951-blocked-services-schedule
Merge in DNS/adguard-home from 951-blocked-services-schedule to master
Squashed commit of the following:
commit 0f0770292f8aa9... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ada9881ac0333deeaa13a77a78d6c4d891d14b | internal/home/upgrade.go |
// cached version.json to avoid hammering github.io for each page reload
versionCheckJSON []byte
versionCheckLastTime time.Time
| <mask> client *http.Client
<mask>
<mask> BindHost string `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to
<mask> BindPort int `yaml:"bind_port"` // BindPort is the port the HTTP server
<mask> AuthName string `yaml:"auth_name"` // AuthName is t... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ddfc81a6d64f9f0802014d32f18f5a5c5a3ba1 | home/config.go |
<mask> )
<mask>
<mask> const updatePeriod = time.Minute * 30
<mask>
<mask> // cached version.json to avoid hammering github.io for each page reload
<mask> var versionCheckJSON []byte
<mask> var versionCheckLastTime time.Time
<mask>
<mask> var protocols = []string{"tls://", "https://", "tcp://", "sdns://"}
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ddfc81a6d64f9f0802014d32f18f5a5c5a3ba1 | home/control.go | |
cached := now.Sub(config.versionCheckLastTime) <= versionCheckPeriod && len(config.versionCheckJSON) != 0
data := config.versionCheckJSON | <mask>
<mask> now := time.Now()
<mask> if !req.RecheckNow {
<mask> config.controlLock.Lock()
<mask> cached := now.Sub(versionCheckLastTime) <= versionCheckPeriod && len(versionCheckJSON) != 0
<mask> data := versionCheckJSON
<mask> config.controlLock.Unlock()
<mask>
<mask> if cached {
<mask> l... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ddfc81a6d64f9f0802014d32f18f5a5c5a3ba1 | home/control_update.go |
config.versionCheckLastTime = now
config.versionCheckJSON = body | <mask> return
<mask> }
<mask>
<mask> config.controlLock.Lock()
<mask> versionCheckLastTime = now
<mask> versionCheckJSON = body
<mask> config.controlLock.Unlock()
<mask>
<mask> w.Header().Set("Content-Type", "application/json")
<mask> _, err = w.Write(getVersionResp(body))
<mask> if err != nil {
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ddfc81a6d64f9f0802014d32f18f5a5c5a3ba1 | home/control_update.go |
if len(config.versionCheckJSON) == 0 { | <mask> // Perform an update procedure to the latest available version
<mask> func handleUpdate(w http.ResponseWriter, r *http.Request) {
<mask> log.Tracef("%s %v", r.Method, r.URL)
<mask>
<mask> if len(versionCheckJSON) == 0 {
<mask> httpError(w, http.StatusBadRequest, "/update request isn't allowed now")
<... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ddfc81a6d64f9f0802014d32f18f5a5c5a3ba1 | home/control_update.go |
u, err := getUpdateInfo(config.versionCheckJSON) | <mask> httpError(w, http.StatusBadRequest, "/update request isn't allowed now")
<mask> return
<mask> }
<mask>
<mask> u, err := getUpdateInfo(versionCheckJSON)
<mask> if err != nil {
<mask> httpError(w, http.StatusInternalServerError, "%s", err)
<mask> return
<mask> }
<mask>
</s> * move "version... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3ddfc81a6d64f9f0802014d32f18f5a5c5a3ba1 | home/control_update.go |
sortable: false,
resizable: false, | <mask> accessor: 'actions',
<mask> maxWidth: 100,
<mask> Cell: (value) => (
<mask> <div className="logs__row logs__row--center">
<mask> <button
<mask> type="button"
<mask> className="btn btn-ic... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3f39b0aa168ddf89755e769a1477ae3c91ece3a | client/src/components/Filters/Rewrites/Table.js |
resizable: false, | <mask> accessor: 'enabled',
<mask> Cell: this.renderCheckbox,
<mask> width: 90,
<mask> className: 'text-center',
<mask> },
<mask> {
<mask> Header: <Trans>name_table_header</Trans>,
<mask> accessor: 'name',
<mask> ... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3f39b0aa168ddf89755e769a1477ae3c91ece3a | client/src/components/Filters/Table.js |
accessor: 'actions', | <mask> Cell: this.getDateCell,
<mask> },
<mask> {
<mask> Header: <Trans>actions_table_header</Trans>,
<mask> accessor: 'url',
<mask> className: 'text-center',
<mask> width: 100,
<mask> sortable: false,
<mask> Ce... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3f39b0aa168ddf89755e769a1477ae3c91ece3a | client/src/components/Filters/Table.js |
resizable: false, | <mask> accessor: 'actions',
<mask> className: 'text-center',
<mask> width: 100,
<mask> sortable: false,
<mask> Cell: (row) => {
<mask> const { value } = row;
<mask> const { t, toggleFilteringModal, handleDelete } = this.p... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3f39b0aa168ddf89755e769a1477ae3c91ece3a | client/src/components/Filters/Table.js |
.logs__row--icons {
flex-wrap: wrap;
}
| <mask> overflow: hidden;
<mask> text-overflow: ellipsis;
<mask> }
<mask>
<mask> .logs__table .logs__row {
<mask> border-bottom: 2px solid var(--gray-216);
<mask> }
<mask>
<mask> .logs__tag {
</s> Pull request: 4637 fix blocked services icons and actions highlight
Updates #4637
Squashed commit ... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3f39b0aa168ddf89755e769a1477ae3c91ece3a | client/src/components/Logs/Logs.css |
.logs__tag {
text-overflow: ellipsis;
overflow: hidden;
}
| <mask> border-bottom: 2px solid var(--gray-216);
<mask> }
<mask>
<mask> /* QUERY_STATUS_COLORS */
<mask> .logs__row--blue {
<mask> background-color: var(--blue);
<mask> }
<mask>
<mask> .logs__row--green {
</s> Pull request: 4637 fix blocked services icons and actions highlight
Updates #4637
Squash... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3f39b0aa168ddf89755e769a1477ae3c91ece3a | client/src/components/Logs/Logs.css |
<div key={tag} title={tag} className="logs__tag small"> | <mask> return (
<mask> <div className="logs__row o-hidden">
<mask> <span className="logs__text">
<mask> {value.map((tag) => (
<mask> <div key={tag} title={tag} className="small">
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3f39b0aa168ddf89755e769a1477ae3c91ece3a | client/src/components/Settings/Clients/ClientsTable.js |
sortable: false,
resizable: false, | <mask> accessor: 'actions',
<mask> maxWidth: 100,
<mask> Cell: (row) => {
<mask> const clientName = row.original.name;
<mask> const {
<mask> toggleClientModal, processingDeleting, processingUpdating, t,
<mask> ... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3f39b0aa168ddf89755e769a1477ae3c91ece3a | client/src/components/Settings/Clients/ClientsTable.js |
sortable: false,
resizable: false, | <mask> accessor: 'actions',
<mask> maxWidth: 150,
<mask> // eslint-disable-next-line react/display-name
<mask> Cell: (row) => {
<mask> const { ip, mac, hostname } = row.original;
<mask>
<m... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d3f39b0aa168ddf89755e769a1477ae3c91ece3a | client/src/components/Settings/Dhcp/StaticLeases/index.js |
"encoding/base64" | <mask> "bytes"
<mask> "context"
<mask> "crypto/tls"
<mask> "crypto/x509"
<mask> "encoding/json"
<mask> "encoding/pem"
<mask> "fmt"
<mask> "io/ioutil"
<mask> "net"
</s> /tls/configure -- certificates/keys are now transferred encoded with base64 </s> remove pemblock := []byte(data.CertificateChain)
<... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d42718465da849a76569332fc2fe97d2fc47e5cf | control.go |
certPEM, err := base64.StdEncoding.DecodeString(data.CertificateChain)
if err != nil {
httpError(w, http.StatusBadRequest, "Failed to base64-decode certificate chain: %s", err)
return
}
keyPEM, err := base64.StdEncoding.DecodeString(data.PrivateKey)
if err != nil {
httpError(w, http.StatusBadRequest, "Faile... | <mask> httpError(w, http.StatusBadRequest, "Failed to parse new TLS config json: %s", err)
<mask> return
<mask> }
<mask>
<mask> _, err = tls.X509KeyPair([]byte(data.CertificateChain), []byte(data.PrivateKey))
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "Invalid certificate or key:... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d42718465da849a76569332fc2fe97d2fc47e5cf | control.go |
pemblock := []byte(certPEM) | <mask> // now do a more extended validation
<mask> var certs []*pem.Block // PEM-encoded certificates
<mask> var skippedBytes []string // skipped bytes
<mask>
<mask> pemblock := []byte(data.CertificateChain)
<mask> for {
<mask> var decoded *pem.Block
<mask> decoded, pemblock = pem.Decode(pemblock)
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d42718465da849a76569332fc2fe97d2fc47e5cf | control.go |
// TODO: let self-signed certs through | <mask> _, err = mainCert.Verify(opts)
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "Your certificate does not verify: %s", err)
<mask> return
<mask> }
<mask> // spew.Dump(chains)
<mask>
<mask> config.TLS = data
</s> /tls/configure -- certificates/keys are now transferred encoded ... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d42718465da849a76569332fc2fe97d2fc47e5cf | control.go |
data := validateCertificates(config.TLS)
if data.WarningValidation != "" {
log.Fatal(data.WarningValidation) | <mask> httpsServer.cond.Wait()
<mask> }
<mask> address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.TLS.PortHTTPS))
<mask> // validate current TLS config and update warnings (it could have been loaded from file)
<mask> data, err := validateCertificates(config.TLS)
<mask> if err != n... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | app.go |
httpError(w, http.StatusInternalServerError, "Couldn't write config file: %s", err) | <mask>
<mask> func httpUpdateConfigReloadDNSReturnOK(w http.ResponseWriter, r *http.Request) {
<mask> err := writeAllConfigsAndReloadDNS()
<mask> if err != nil {
<mask> errorText := fmt.Sprintf("Couldn't write config file: %s", err)
<mask> log.Println(errorText)
<mask> http.Error(w, errorText, http.Stat... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
marshalTLS(w, config.TLS) | <mask> // ---
<mask> // TLS
<mask> // ---
<mask> func handleTLSStatus(w http.ResponseWriter, r *http.Request) {
<mask> data := config.TLS
<mask> if data.CertificateChain != "" {
<mask> encoded := base64.StdEncoding.EncodeToString([]byte(data.CertificateChain))
<mask> data.CertificateChain = string(encoded... | [
"keep",
"keep",
"keep",
"keep",
"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/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
data = validateCertificates(data)
marshalTLS(w, data) | <mask> httpError(w, http.StatusBadRequest, "Failed to unmarshal TLS config: %s", err)
<mask> return
<mask> }
<mask>
<mask> data, err = validateCertificates(data)
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "New TLS configuration does not validate: %s", err)
<mask> return
<mask... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
restartHTTPS := false
data = validateCertificates(data)
if data.WarningValidation == "" {
if !reflect.DeepEqual(config.TLS.tlsConfigSettings, data.tlsConfigSettings) {
log.Printf("tls config settings have changed, will restart HTTPS server")
restartHTTPS = true
}
config.TLS = data
}
err = writeAllConfi... | <mask> httpError(w, http.StatusBadRequest, "Failed to unmarshal TLS config: %s", err)
<mask> return
<mask> }
<mask>
<mask> data, err = validateCertificates(data)
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "New TLS configuration does not validate: %s", err)
<mask> return
<mask... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
httpError(w, http.StatusInternalServerError, "Couldn't write config file: %s", err) | <mask> }
<mask>
<mask> data, err = validateCertificates(data)
<mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "New TLS configuration does not validate: %s", err)
<mask> return
<mask> }
<mask> restartHTTPS := false
<mask> if !reflect.DeepEqual(config.TLS.tlsConfigSettings, data.tlsC... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
marshalTLS(w, data) | <mask> if err != nil {
<mask> httpError(w, http.StatusBadRequest, "New TLS configuration does not validate: %s", err)
<mask> return
<mask> }
<mask> restartHTTPS := false
<mask> if !reflect.DeepEqual(config.TLS.tlsConfigSettings, data.tlsConfigSettings) {
<mask> log.Printf("tls config settings have chan... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
func validateCertificates(data tlsConfig) tlsConfig { | <mask> }()
<mask> }
<mask> }
<mask>
<mask> func validateCertificates(data tlsConfig) (tlsConfig, error) {
<mask> var err error
<mask>
<mask> // clear out status for certificates
<mask> data.tlsConfigStatus = tlsConfigStatus{}
<mask>
</s> /tls/configure and /tls/validate -- make validation failures n... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
data.WarningValidation = fmt.Sprintf("Failed to parse certificate: %s", err)
return data | <mask>
<mask> for _, cert := range certs {
<mask> parsed, err := x509.ParseCertificate(cert.Bytes)
<mask> if err != nil {
<mask> return data, errorx.Decorate(err, "Failed to parse certificate")
<mask> }
<mask> parsedCerts = append(parsedCerts, parsed)
<mask> }
<mask>
<mask> if len(pars... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
data.WarningValidation = fmt.Sprintf("You have specified an empty certificate")
return data | <mask> parsedCerts = append(parsedCerts, parsed)
<mask> }
<mask>
<mask> if len(parsedCerts) == 0 {
<mask> return data, fmt.Errorf("You have specified an empty certificate")
<mask> }
<mask>
<mask> // spew.Dump(parsedCerts)
<mask>
<mask> opts := x509.VerifyOptions{
</s> /tls/configure and /t... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
data.WarningValidation = "No valid keys were found"
return data | <mask> }
<mask> }
<mask>
<mask> if key == nil {
<mask> return data, fmt.Errorf("No valid keys were found")
<mask> }
<mask>
<mask> // parse the decoded key
<mask> _, keytype, err := parsePrivateKey(key.Bytes)
<mask> if err != nil {
</s> /tls/configure and /tls/validate -- make validation f... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
data.WarningValidation = fmt.Sprintf("Failed to parse private key: %s", err)
return data | <mask>
<mask> // parse the decoded key
<mask> _, keytype, err := parsePrivateKey(key.Bytes)
<mask> if err != nil {
<mask> return data, errorx.Decorate(err, "Failed to parse private key")
<mask> }
<mask>
<mask> data.ValidKey = true
<mask> data.KeyType = keytype
<mask> }
</s> /tls/configure a... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
data.WarningValidation = fmt.Sprintf("Invalid certificate or key: %s", err)
return data | <mask> // if both are set, validate both in unison
<mask> if data.PrivateKey != "" && data.CertificateChain != "" {
<mask> _, err = tls.X509KeyPair([]byte(data.CertificateChain), []byte(data.PrivateKey))
<mask> if err != nil {
<mask> return data, errorx.Decorate(err, "Invalid certificate or key")
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
return data | <mask> return data, errorx.Decorate(err, "Invalid certificate or key")
<mask> }
<mask> }
<mask>
<mask> return data, nil
<mask> }
<mask>
<mask> // Attempt to parse the given private key DER block. OpenSSL 0.9.8 generates
<mask> // PKCS#1 private keys by default, while OpenSSL 1.0.0 generates PKCS#8 key... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d44f68e844591efa64f5912d71c20bed366e5510 | control.go |
successMessage = 'disabled_filtering_toast'; | <mask> // TODO move setting keys to constants
<mask> switch (settingKey) {
<mask> case 'filtering':
<mask> if (status) {
<mask> successMessage = 'Disabled filtering';
<mask> await apiClient.disableFiltering();
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'enabled_filtering_toast'; | <mask> if (status) {
<mask> successMessage = 'Disabled filtering';
<mask> await apiClient.disableFiltering();
<mask> } else {
<mask> successMessage = 'Enabled filtering';
<mask> await apiClient.enableFi... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'disabled_safe_browsing_toast'; | <mask> dispatch(toggleSettingStatus({ settingKey }));
<mask> break;
<mask> case 'safebrowsing':
<mask> if (status) {
<mask> successMessage = 'Disabled safebrowsing';
<mask> await apiClient.disableSafebrowsing();
<... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'enabled_safe_browsing_toast'; | <mask> if (status) {
<mask> successMessage = 'Disabled safebrowsing';
<mask> await apiClient.disableSafebrowsing();
<mask> } else {
<mask> successMessage = 'Enabled safebrowsing';
<mask> await apiClient... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'disabled_parental_toast'; | <mask> dispatch(toggleSettingStatus({ settingKey }));
<mask> break;
<mask> case 'parental':
<mask> if (status) {
<mask> successMessage = 'Disabled parental control';
<mask> await apiClient.disableParentalControl();... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'enabled_parental_toast'; | <mask> if (status) {
<mask> successMessage = 'Disabled parental control';
<mask> await apiClient.disableParentalControl();
<mask> } else {
<mask> successMessage = 'Enabled parental control';
<mask> awai... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'disabled_safe_search_toast'; | <mask> dispatch(toggleSettingStatus({ settingKey }));
<mask> break;
<mask> case 'safesearch':
<mask> if (status) {
<mask> successMessage = 'Disabled safe search';
<mask> await apiClient.disableSafesearch();
<mask>... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'enabled_save_search_toast'; | <mask> if (status) {
<mask> successMessage = 'Disabled safe search';
<mask> await apiClient.disableSafesearch();
<mask> } else {
<mask> successMessage = 'Enabled safe search';
<mask> await apiClient.ena... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'disabled_protection'; | <mask> let successMessage = '';
<mask>
<mask> try {
<mask> if (status) {
<mask> successMessage = 'Disabled protection';
<mask> await apiClient.disableGlobalProtection();
<mask> } else {
<mask> successMessage = 'Enabled protection';
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'enabled_protection'; | <mask> if (status) {
<mask> successMessage = 'Disabled protection';
<mask> await apiClient.disableGlobalProtection();
<mask> } else {
<mask> successMessage = 'Enabled protection';
<mask> await apiClient.enableGlobalProtection();
<mask> }
<m... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'query_log_disabled_toast'; | <mask> let toggleMethod;
<mask> let successMessage;
<mask> if (queryLogEnabled) {
<mask> toggleMethod = apiClient.disableQueryLog.bind(apiClient);
<mask> successMessage = 'disabled';
<mask> } else {
<mask> toggleMethod = apiClient.enableQueryLog.bind(apiClient);
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
successMessage = 'query_log_enabled_toast'; | <mask> toggleMethod = apiClient.disableQueryLog.bind(apiClient);
<mask> successMessage = 'disabled';
<mask> } else {
<mask> toggleMethod = apiClient.enableQueryLog.bind(apiClient);
<mask> successMessage = 'enabled';
<mask> }
<mask> try {
<mask> await toggleMet... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
dispatch(addSuccessToast(successMessage)); | <mask> successMessage = 'enabled';
<mask> }
<mask> try {
<mask> await toggleMethod();
<mask> dispatch(addSuccessToast(`Query log ${successMessage}`));
<mask> dispatch(toggleLogStatusSuccess());
<mask> } catch (error) {
<mask> dispatch(addErrorToast({ error }))... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
dispatch(addSuccessToast('updated_custom_filtering_toast')); | <mask> const replacedLineEndings = rules
<mask> .replace(/^\n/g, '')
<mask> .replace(/\n\s*\n/g, '\n');
<mask> await apiClient.setRules(replacedLineEndings);
<mask> dispatch(addSuccessToast('Updated the custom filtering rules'));
<mask> dispatch(setRulesSucc... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
dispatch(addSuccessToast('all_filters_up_to_date_toast')); | <mask> dispatch(refreshFiltersSuccess);
<mask>
<mask> if (refreshText.includes('OK')) {
<mask> if (refreshText.includes('OK 0')) {
<mask> dispatch(addSuccessToast('All filters are already up-to-date'));
<mask> } else {
<mask> dispatch(addSu... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
dispatch(addSuccessToast('updated_upstream_dns_toast')); | <mask> export const setUpstream = url => async (dispatch) => {
<mask> dispatch(setUpstreamRequest());
<mask> try {
<mask> await apiClient.setUpstream(url);
<mask> dispatch(addSuccessToast('Updated the upstream DNS servers'));
<mask> dispatch(setUpstreamSuccess());
<mask> } cat... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
dispatch(addErrorToast({ error: t('dns_test_not_ok_toast', { key }) })); | <mask>
<mask> const testMessages = Object.keys(upstreamResponse).map((key) => {
<mask> const message = upstreamResponse[key];
<mask> if (message !== 'OK') {
<mask> dispatch(addErrorToast({ error: t('Server "{{key}}": could not be used, please check that you\'ve writ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
dispatch(addSuccessToast('dns_test_ok_toast')); | <mask> return message;
<mask> });
<mask>
<mask> if (testMessages.every(message => message === 'OK')) {
<mask> dispatch(addSuccessToast('Specified DNS servers are working correctly'));
<mask> }
<mask>
<mask> dispatch(testUpstreamSuccess());
<mask> } ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/actions/index.js |
Header: <Trans>requests_count</Trans>, | <mask> </div>
<mask> );
<mask> },
<mask> }, {
<mask> Header: <Trans>Requests count</Trans>,
<mask> accessor: 'domain',
<mask> maxWidth: 190,
<mask> Cell: ({ value }) => {
<mask> const {
<mask> blockedFiltering,... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/components/Dashboard/BlockedDomains.js |
<Card title={ t('top_blocked_domains') } subtitle={ t('for_last_24_hours') } bodyType="card-table" refresh={this.props.refreshButton}> | <mask>
<mask> render() {
<mask> const { t } = this.props;
<mask> return (
<mask> <Card title={ t('Top blocked domains') } subtitle={ t('for the last 24 hours') } bodyType="card-table" refresh={this.props.refreshButton}>
<mask> <ReactTable
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/components/Dashboard/BlockedDomains.js |
noDataText={ t('no_domains_found') } | <mask> { ip: prop, domain: value }
<mask> ))}
<mask> columns={this.columns}
<mask> showPagination={false}
<mask> noDataText={ t('No domains found') }
<mask> minRows={6}
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/components/Dashboard/BlockedDomains.js |
Header: <Trans>requests_count</Trans>, | <mask> accessor: 'ip',
<mask> Cell: ({ value }) => (<div className="logs__row logs__row--overflow"><span className="logs__text" title={value}>{value}</span></div>),
<mask> sortMethod: (a, b) => parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10),
<mask> }, {
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/d47a23269da9731f941609997ae9ae063524a18e | client/src/components/Dashboard/Clients.js |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.