docstring_tokens
stringlengths 18
16.9k
| code_tokens
stringlengths 75
1.81M
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|
keep keep add keep keep keep keep keep keep
|
<mask> }),
<mask> ipCh: make(chan net.IP, defaultRDNSIPChSize),
<mask> }
<mask>
<mask> go rDNS.workerLoop()
<mask>
<mask> return rDNS
<mask> }
<mask>
</s> Pull request: 3184 disable private ptr
Merge in DNS/adguard-home from 3184-disable-ptr to master
Updates #3184.
Squashed commit of the following:
commit b78ac2eeb1b408586808ddbd1c87107f373b11b0
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 17:20:34 2021 +0300
all: rename dns config field
commit 36512134822a5f6b8b296ccbd7e7d5a9b8e87f26
Author: Ildar Kamalov <[email protected]>
Date: Wed May 26 15:55:44 2021 +0300
client: handle local ips rdns
commit 9a691830d45db93e078332d85bc0efa7dc7b6ac6
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:43:13 2021 +0300
all: imp naming
commit 771b7a3d5d25f91408dd97ba3287efb641028ccf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:24:38 2021 +0300
all: imp docs, code
commit be960893e8bbb7375a944ca0345b50c857a2d7cf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 13:23:56 2021 +0300
all: imp docs & log changes
commit 4e645a520f6bb584ef951435ee833ad30769af98
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 12:49:44 2021 +0300
all: add the field into structs
commit 22b5b6163f086560a3189234532ba877be7ba940
Author: Eugene Burkov <[email protected]>
Date: Tue May 25 15:10:31 2021 +0300
dnsforward: entitle lock, imp code </s> remove Exchanger: aghtest.Exchanger{
</s> add ex: aghtest.Exchanger{ </s> add use_private_ptr_resolvers, </s> remove return &res, nil
</s> add return res, nil </s> add s.serverLock.RLock()
defer s.serverLock.RUnlock()
</s> remove if s.subnetDetector.IsLocallyServedNetwork(ip) {
err = s.localResolvers.Resolve(ctx)
} else {
err = s.internalProxy.Resolve(ctx)
}
</s> add err = resolver.Resolve(ctx) </s> add s.conf.UsePrivateRDNS = true
|
https://github.com/AdguardTeam/AdGuardHome/commit/557bbcbf37a8f1d6092a51064e329ecc50bebb9d
|
internal/home/rdns.go
|
keep keep keep replace replace replace keep keep keep replace keep keep keep
|
<mask> return rDNS
<mask> }
<mask>
<mask> // Begin adds the ip to the resolving queue if it is not cached or already
<mask> // resolved.
<mask> func (r *RDNS) Begin(ip net.IP) {
<mask> now := uint64(time.Now().Unix())
<mask> if expire := r.ipCache.Get(ip); len(expire) != 0 {
<mask> if binary.BigEndian.Uint64(expire) > now {
<mask> return
<mask> }
<mask> }
<mask>
</s> Pull request: 3184 disable private ptr
Merge in DNS/adguard-home from 3184-disable-ptr to master
Updates #3184.
Squashed commit of the following:
commit b78ac2eeb1b408586808ddbd1c87107f373b11b0
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 17:20:34 2021 +0300
all: rename dns config field
commit 36512134822a5f6b8b296ccbd7e7d5a9b8e87f26
Author: Ildar Kamalov <[email protected]>
Date: Wed May 26 15:55:44 2021 +0300
client: handle local ips rdns
commit 9a691830d45db93e078332d85bc0efa7dc7b6ac6
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:43:13 2021 +0300
all: imp naming
commit 771b7a3d5d25f91408dd97ba3287efb641028ccf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:24:38 2021 +0300
all: imp docs, code
commit be960893e8bbb7375a944ca0345b50c857a2d7cf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 13:23:56 2021 +0300
all: imp docs & log changes
commit 4e645a520f6bb584ef951435ee833ad30769af98
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 12:49:44 2021 +0300
all: add the field into structs
commit 22b5b6163f086560a3189234532ba877be7ba940
Author: Eugene Burkov <[email protected]>
Date: Tue May 25 15:10:31 2021 +0300
dnsforward: entitle lock, imp code </s> add return false
}
// Begin adds the ip to the resolving queue if it is not cached or already
// resolved.
func (r *RDNS) Begin(ip net.IP) {
r.ensurePrivateCache()
if r.isCached(ip) {
return
}
</s> remove s.Lock()
defer s.Unlock()
</s> add s.serverLock.Lock()
defer s.serverLock.Unlock() </s> remove resp, err := e.Exchanger.Exchange(req)
</s> add resp, err := e.ex.Exchange(req) </s> remove s.RLock()
defer s.RUnlock()
</s> add s.serverLock.RLock()
defer s.serverLock.RUnlock()
</s> add // ResolvesPrivatePTR returns true if the RDNSExchanger is able to
// resolve PTR requests for locally-served addresses.
ResolvesPrivatePTR() (ok bool)
|
https://github.com/AdguardTeam/AdGuardHome/commit/557bbcbf37a8f1d6092a51064e329ecc50bebb9d
|
internal/home/rdns.go
|
keep keep add keep keep keep keep keep keep
|
<mask> binary.BigEndian.PutUint64(ttl, now+defaultRDNSCacheTTL)
<mask> r.ipCache.Set(ip, ttl)
<mask>
<mask> id := ip.String()
<mask> if r.clients.Exists(id, ClientSourceRDNS) {
<mask> return
<mask> }
<mask>
<mask> select {
</s> Pull request: 3184 disable private ptr
Merge in DNS/adguard-home from 3184-disable-ptr to master
Updates #3184.
Squashed commit of the following:
commit b78ac2eeb1b408586808ddbd1c87107f373b11b0
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 17:20:34 2021 +0300
all: rename dns config field
commit 36512134822a5f6b8b296ccbd7e7d5a9b8e87f26
Author: Ildar Kamalov <[email protected]>
Date: Wed May 26 15:55:44 2021 +0300
client: handle local ips rdns
commit 9a691830d45db93e078332d85bc0efa7dc7b6ac6
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:43:13 2021 +0300
all: imp naming
commit 771b7a3d5d25f91408dd97ba3287efb641028ccf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:24:38 2021 +0300
all: imp docs, code
commit be960893e8bbb7375a944ca0345b50c857a2d7cf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 13:23:56 2021 +0300
all: imp docs & log changes
commit 4e645a520f6bb584ef951435ee833ad30769af98
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 12:49:44 2021 +0300
all: add the field into structs
commit 22b5b6163f086560a3189234532ba877be7ba940
Author: Eugene Burkov <[email protected]>
Date: Tue May 25 15:10:31 2021 +0300
dnsforward: entitle lock, imp code </s> remove err := s.localResolvers.Resolve(d)
if err != nil {
ctx.err = err
</s> add if s.conf.UsePrivateRDNS {
if err := s.localResolvers.Resolve(d); err != nil {
ctx.err = err </s> remove resp, err := e.Exchanger.Exchange(req)
</s> add resp, err := e.ex.Exchange(req) </s> remove return
</s> add return true </s> remove return resultCodeError
</s> add return resultCodeError
} </s> add var resolver *proxy.Proxy = s.localResolvers
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
resolver = s.internalProxy
} else if !s.conf.UsePrivateRDNS {
return "", nil
}
</s> add } else if res == nil {
continue
|
https://github.com/AdguardTeam/AdGuardHome/commit/557bbcbf37a8f1d6092a51064e329ecc50bebb9d
|
internal/home/rdns.go
|
keep keep add keep keep keep keep keep
|
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/miekg/dns"
<mask> "github.com/stretchr/testify/assert"
<mask> )
<mask>
<mask> func TestRDNS_Begin(t *testing.T) {
<mask> aghtest.ReplaceLogLevel(t, log.DEBUG)
<mask> w := &bytes.Buffer{}
</s> Pull request: 3184 disable private ptr
Merge in DNS/adguard-home from 3184-disable-ptr to master
Updates #3184.
Squashed commit of the following:
commit b78ac2eeb1b408586808ddbd1c87107f373b11b0
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 17:20:34 2021 +0300
all: rename dns config field
commit 36512134822a5f6b8b296ccbd7e7d5a9b8e87f26
Author: Ildar Kamalov <[email protected]>
Date: Wed May 26 15:55:44 2021 +0300
client: handle local ips rdns
commit 9a691830d45db93e078332d85bc0efa7dc7b6ac6
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:43:13 2021 +0300
all: imp naming
commit 771b7a3d5d25f91408dd97ba3287efb641028ccf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:24:38 2021 +0300
all: imp docs, code
commit be960893e8bbb7375a944ca0345b50c857a2d7cf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 13:23:56 2021 +0300
all: imp docs & log changes
commit 4e645a520f6bb584ef951435ee833ad30769af98
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 12:49:44 2021 +0300
all: add the field into structs
commit 22b5b6163f086560a3189234532ba877be7ba940
Author: Eugene Burkov <[email protected]>
Date: Tue May 25 15:10:31 2021 +0300
dnsforward: entitle lock, imp code </s> remove func TestLocalRestriction(t *testing.T) {
</s> add func TestServer_ProcessRestrictLocal(t *testing.T) { </s> remove host, eerr := dns.Exchange(tc.req)
</s> add host, eerr := srv.Exchange(tc.req) </s> remove dns.conf.ResolveClients = false
for _, tc := range testCases {
host, eerr := dns.Exchange(tc.req)
</s> add srv.conf.UsePrivateRDNS = false </s> add "sync/atomic" </s> remove s.RLock()
defer s.RUnlock()
</s> add s.serverLock.RLock()
defer s.serverLock.RUnlock() </s> remove dns.localResolvers = &proxy.Proxy{
</s> add srv.localResolvers = &proxy.Proxy{
|
https://github.com/AdguardTeam/AdGuardHome/commit/557bbcbf37a8f1d6092a51064e329ecc50bebb9d
|
internal/home/rdns_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> ttl := make([]byte, binary.Size(uint64(0)))
<mask> binary.BigEndian.PutUint64(ttl, uint64(time.Now().Add(100*time.Hour).Unix()))
<mask>
<mask> rdns := &RDNS{
<mask> ipCache: ipCache,
<mask> clients: &clientsContainer{
<mask> list: map[string]*Client{},
<mask> idIndex: tc.cliIDIndex,
<mask> ipToRC: map[string]*RuntimeClient{},
<mask> allTags: aghstrings.NewSet(),
</s> Pull request: 3184 disable private ptr
Merge in DNS/adguard-home from 3184-disable-ptr to master
Updates #3184.
Squashed commit of the following:
commit b78ac2eeb1b408586808ddbd1c87107f373b11b0
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 17:20:34 2021 +0300
all: rename dns config field
commit 36512134822a5f6b8b296ccbd7e7d5a9b8e87f26
Author: Ildar Kamalov <[email protected]>
Date: Wed May 26 15:55:44 2021 +0300
client: handle local ips rdns
commit 9a691830d45db93e078332d85bc0efa7dc7b6ac6
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:43:13 2021 +0300
all: imp naming
commit 771b7a3d5d25f91408dd97ba3287efb641028ccf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:24:38 2021 +0300
all: imp docs, code
commit be960893e8bbb7375a944ca0345b50c857a2d7cf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 13:23:56 2021 +0300
all: imp docs & log changes
commit 4e645a520f6bb584ef951435ee833ad30769af98
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 12:49:44 2021 +0300
all: add the field into structs
commit 22b5b6163f086560a3189234532ba877be7ba940
Author: Eugene Burkov <[email protected]>
Date: Tue May 25 15:10:31 2021 +0300
dnsforward: entitle lock, imp code </s> remove Exchanger: aghtest.Exchanger{
</s> add ex: aghtest.Exchanger{ </s> add usePrivate bool, </s> remove return
</s> add return true </s> add return false
}
// Begin adds the ip to the resolving queue if it is not cached or already
// resolved.
func (r *RDNS) Begin(ip net.IP) {
r.ensurePrivateCache()
if r.isCached(ip) {
return
}
</s> add usePrivateRDNS := s.conf.UsePrivateRDNS </s> remove s.RLock()
defer s.RUnlock()
</s> add s.serverLock.RLock()
defer s.serverLock.RUnlock()
|
https://github.com/AdguardTeam/AdGuardHome/commit/557bbcbf37a8f1d6092a51064e329ecc50bebb9d
|
internal/home/rdns_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> }
<mask>
<mask> // rDNSExchanger is a mock dnsforward.RDNSExchanger implementation for tests.
<mask> type rDNSExchanger struct {
<mask> aghtest.Exchanger
<mask> }
<mask>
<mask> // Exchange implements dnsforward.RDNSExchanger interface for *RDNSExchanger.
<mask> func (e *rDNSExchanger) Exchange(ip net.IP) (host string, err error) {
<mask> req := &dns.Msg{
</s> Pull request: 3184 disable private ptr
Merge in DNS/adguard-home from 3184-disable-ptr to master
Updates #3184.
Squashed commit of the following:
commit b78ac2eeb1b408586808ddbd1c87107f373b11b0
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 17:20:34 2021 +0300
all: rename dns config field
commit 36512134822a5f6b8b296ccbd7e7d5a9b8e87f26
Author: Ildar Kamalov <[email protected]>
Date: Wed May 26 15:55:44 2021 +0300
client: handle local ips rdns
commit 9a691830d45db93e078332d85bc0efa7dc7b6ac6
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:43:13 2021 +0300
all: imp naming
commit 771b7a3d5d25f91408dd97ba3287efb641028ccf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:24:38 2021 +0300
all: imp docs, code
commit be960893e8bbb7375a944ca0345b50c857a2d7cf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 13:23:56 2021 +0300
all: imp docs & log changes
commit 4e645a520f6bb584ef951435ee833ad30769af98
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 12:49:44 2021 +0300
all: add the field into structs
commit 22b5b6163f086560a3189234532ba877be7ba940
Author: Eugene Burkov <[email protected]>
Date: Tue May 25 15:10:31 2021 +0300
dnsforward: entitle lock, imp code </s> remove s.RLock()
defer s.RUnlock()
</s> add s.serverLock.RLock()
defer s.serverLock.RUnlock() </s> add // ResolvesPrivatePTR returns true if the RDNSExchanger is able to
// resolve PTR requests for locally-served addresses.
ResolvesPrivatePTR() (ok bool) </s> remove s.RLock()
defer s.RUnlock()
</s> add s.serverLock.RLock()
defer s.serverLock.RUnlock()
</s> remove // If response contains CNAME, A or AAAA records, we apply filtering to each canonical host name or IP address.
// If this is a match, we set a new response in d.Res and return.
</s> add // checkHostRules checks the host against filters. It is safe for concurrent
// use.
func (s *Server) checkHostRules(host string, qtype uint16, setts *filtering.Settings) (
r *filtering.Result,
err error,
) {
s.serverLock.RLock()
defer s.serverLock.RUnlock()
if s.dnsFilter == nil {
return nil, nil
}
var res filtering.Result
res, err = s.dnsFilter.CheckHostRules(host, qtype, setts)
if err != nil {
return nil, err
}
return &res, err
}
// If response contains CNAME, A or AAAA records, we apply filtering to each
// canonical host name or IP address. If this is a match, we set a new response
// in d.Res and return. </s> add // ResolvesPrivatePTR implements the RDNSExchanger interface for *Server.
func (s *Server) ResolvesPrivatePTR() (ok bool) {
s.serverLock.RLock()
defer s.serverLock.RUnlock()
return s.conf.UsePrivateRDNS
}
</s> add // UsePrivateRDNS defines if the PTR requests for unknown addresses from
// locally-served networks should be resolved via private PTR resolvers.
UsePrivateRDNS bool `yaml:"use_private_ptr_resolvers"`
|
https://github.com/AdguardTeam/AdGuardHome/commit/557bbcbf37a8f1d6092a51064e329ecc50bebb9d
|
internal/home/rdns_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> Qtype: dns.TypePTR,
<mask> }},
<mask> }
<mask>
<mask> resp, err := e.Exchanger.Exchange(req)
<mask> if err != nil {
<mask> return "", err
<mask> }
<mask>
<mask> if len(resp.Answer) == 0 {
</s> Pull request: 3184 disable private ptr
Merge in DNS/adguard-home from 3184-disable-ptr to master
Updates #3184.
Squashed commit of the following:
commit b78ac2eeb1b408586808ddbd1c87107f373b11b0
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 17:20:34 2021 +0300
all: rename dns config field
commit 36512134822a5f6b8b296ccbd7e7d5a9b8e87f26
Author: Ildar Kamalov <[email protected]>
Date: Wed May 26 15:55:44 2021 +0300
client: handle local ips rdns
commit 9a691830d45db93e078332d85bc0efa7dc7b6ac6
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:43:13 2021 +0300
all: imp naming
commit 771b7a3d5d25f91408dd97ba3287efb641028ccf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:24:38 2021 +0300
all: imp docs, code
commit be960893e8bbb7375a944ca0345b50c857a2d7cf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 13:23:56 2021 +0300
all: imp docs & log changes
commit 4e645a520f6bb584ef951435ee833ad30769af98
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 12:49:44 2021 +0300
all: add the field into structs
commit 22b5b6163f086560a3189234532ba877be7ba940
Author: Eugene Burkov <[email protected]>
Date: Tue May 25 15:10:31 2021 +0300
dnsforward: entitle lock, imp code </s> remove err := s.localResolvers.Resolve(d)
if err != nil {
ctx.err = err
</s> add if s.conf.UsePrivateRDNS {
if err := s.localResolvers.Resolve(d); err != nil {
ctx.err = err </s> remove if s.subnetDetector.IsLocallyServedNetwork(ip) {
err = s.localResolvers.Resolve(ctx)
} else {
err = s.internalProxy.Resolve(ctx)
}
</s> add err = resolver.Resolve(ctx) </s> remove return resultCodeError
</s> add return resultCodeError
} </s> add if ctx.setts == nil {
ctx.setts = s.getClientRequestFilteringSettings(ctx)
}
var err error
ctx.result, err = s.filterDNSRequest(ctx) </s> add } else if res == nil {
continue </s> remove err := s.ipset.Close()
if err != nil {
</s> add if err := s.ipset.Close(); err != nil {
|
https://github.com/AdguardTeam/AdGuardHome/commit/557bbcbf37a8f1d6092a51064e329ecc50bebb9d
|
internal/home/rdns_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> }
<mask> ch := make(chan net.IP)
<mask> rdns := &RDNS{
<mask> exchanger: &rDNSExchanger{
<mask> Exchanger: aghtest.Exchanger{
<mask> Ups: tc.ups,
<mask> },
<mask> },
<mask> clients: cc,
<mask> ipCh: ch,
</s> Pull request: 3184 disable private ptr
Merge in DNS/adguard-home from 3184-disable-ptr to master
Updates #3184.
Squashed commit of the following:
commit b78ac2eeb1b408586808ddbd1c87107f373b11b0
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 17:20:34 2021 +0300
all: rename dns config field
commit 36512134822a5f6b8b296ccbd7e7d5a9b8e87f26
Author: Ildar Kamalov <[email protected]>
Date: Wed May 26 15:55:44 2021 +0300
client: handle local ips rdns
commit 9a691830d45db93e078332d85bc0efa7dc7b6ac6
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:43:13 2021 +0300
all: imp naming
commit 771b7a3d5d25f91408dd97ba3287efb641028ccf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:24:38 2021 +0300
all: imp docs, code
commit be960893e8bbb7375a944ca0345b50c857a2d7cf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 13:23:56 2021 +0300
all: imp docs & log changes
commit 4e645a520f6bb584ef951435ee833ad30769af98
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 12:49:44 2021 +0300
all: add the field into structs
commit 22b5b6163f086560a3189234532ba877be7ba940
Author: Eugene Burkov <[email protected]>
Date: Tue May 25 15:10:31 2021 +0300
dnsforward: entitle lock, imp code </s> remove ipCache: ipCache,
</s> add ipCache: ipCache,
exchanger: &rDNSExchanger{}, </s> add if usePrivate {
rDNS.usePrivate = 1
} </s> add usePrivate bool, </s> remove dns := NewCustomServer(&proxy.Proxy{
</s> add srv := NewCustomServer(&proxy.Proxy{ </s> remove func TestLocalRestriction(t *testing.T) {
</s> add func TestServer_ProcessRestrictLocal(t *testing.T) { </s> remove dns.localResolvers = &proxy.Proxy{
</s> add srv.localResolvers = &proxy.Proxy{
|
https://github.com/AdguardTeam/AdGuardHome/commit/557bbcbf37a8f1d6092a51064e329ecc50bebb9d
|
internal/home/rdns_test.go
|
keep keep keep add keep keep keep keep
|
<mask> 'enum':
<mask> - ''
<mask> - 'parallel'
<mask> - 'fastest_addr'
<mask> 'resolve_clients':
<mask> 'type': 'boolean'
<mask> 'local_ptr_upstreams':
<mask> 'type': 'array'
</s> Pull request: 3184 disable private ptr
Merge in DNS/adguard-home from 3184-disable-ptr to master
Updates #3184.
Squashed commit of the following:
commit b78ac2eeb1b408586808ddbd1c87107f373b11b0
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 17:20:34 2021 +0300
all: rename dns config field
commit 36512134822a5f6b8b296ccbd7e7d5a9b8e87f26
Author: Ildar Kamalov <[email protected]>
Date: Wed May 26 15:55:44 2021 +0300
client: handle local ips rdns
commit 9a691830d45db93e078332d85bc0efa7dc7b6ac6
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:43:13 2021 +0300
all: imp naming
commit 771b7a3d5d25f91408dd97ba3287efb641028ccf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 14:24:38 2021 +0300
all: imp docs, code
commit be960893e8bbb7375a944ca0345b50c857a2d7cf
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 13:23:56 2021 +0300
all: imp docs & log changes
commit 4e645a520f6bb584ef951435ee833ad30769af98
Author: Eugene Burkov <[email protected]>
Date: Wed May 26 12:49:44 2021 +0300
all: add the field into structs
commit 22b5b6163f086560a3189234532ba877be7ba940
Author: Eugene Burkov <[email protected]>
Date: Tue May 25 15:10:31 2021 +0300
dnsforward: entitle lock, imp code </s> remove s.Lock()
</s> add s.serverLock.Lock()
defer s.serverLock.Unlock()
</s> remove
s.Unlock()
</s> add </s> remove s.RLock()
</s> add s.serverLock.RLock()
defer s.serverLock.RUnlock()
</s> remove return aghstrings.CloneSlice(s.conf.LocalPTRResolvers), s.conf.ResolveClients
</s> add return aghstrings.CloneSlice(s.conf.LocalPTRResolvers),
s.conf.ResolveClients,
s.conf.UsePrivateRDNS </s> remove func (s *Server) RDNSSettings() (localPTRResolvers []string, resolveClients bool) {
s.RLock()
defer s.RUnlock()
</s> add func (s *Server) RDNSSettings() (localPTRResolvers []string, resolveClients, resolvePTR bool) {
s.serverLock.RLock()
defer s.serverLock.RUnlock() </s> remove // Close - close object
</s> add // Close gracefully closes the server. It is safe for concurrent use.
//
// TODO(e.burkov): A better approach would be making Stop method waiting for all
// its workers finished. But it would require the upstream.Upstream to have the
// Close method to prevent from hanging while waiting for unresponsive server to
// respond.
|
https://github.com/AdguardTeam/AdGuardHome/commit/557bbcbf37a8f1d6092a51064e329ecc50bebb9d
|
openapi/openapi.yaml
|
keep keep add keep keep keep keep
|
<mask> import (
<mask> "bufio"
<mask> "fmt"
<mask> "net"
<mask> "net/http"
<mask> "os"
<mask> "os/signal"
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> add "log" </s> add "log" </s> add "log" </s> add "log" </s> add "log" </s> remove log "github.com/sirupsen/logrus"
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
app.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "syscall"
<mask> "time"
<mask>
<mask> "github.com/gobuffalo/packr"
<mask> log "github.com/sirupsen/logrus"
<mask> "golang.org/x/crypto/ssh/terminal"
<mask> )
<mask>
<mask> // VersionString will be set through ldflags, contains current version
<mask> var VersionString = "undefined"
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log.Debugf("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule)
</s> add // trace("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule)
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
app.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> panic("Got port that is not a number")
<mask> }
<mask> bindPort = &v
<mask> }, nil},
<mask> {"verbose", "v", "enable verbose output", nil, func() { log.SetLevel(log.TraceLevel) }},
<mask> {"help", "h", "print this help", nil, func() { printHelp(); os.Exit(64) }},
<mask> }
<mask> printHelp = func() {
<mask> fmt.Printf("Usage:\n\n")
<mask> fmt.Printf("%s [options]\n\n", os.Args[0])
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> remove log.Debugf("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule)
</s> add // trace("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule) </s> remove log.Warnf("Couldn't generate A record for up replacement host '%s': %s", ip.String(), err)
</s> add log.Printf("Couldn't generate A record for replacement host '%s': %s", ip.String(), err) </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
app.go
|
keep keep keep add keep keep keep keep
|
<mask>
<mask> import (
<mask> "errors"
<mask> "fmt"
<mask> "net"
<mask> "strings"
<mask> "sync"
<mask> "time"
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> add "log" </s> add "log" </s> remove log "github.com/sirupsen/logrus"
</s> add </s> add "log" </s> add "log" </s> add "log"
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/dnsforward.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/dnsproxy/upstream"
<mask> "github.com/joomcode/errorx"
<mask> "github.com/miekg/dns"
<mask> log "github.com/sirupsen/logrus"
<mask> )
<mask>
<mask> // DefaultTimeout is the default upstream timeout
<mask> const DefaultTimeout = 10 * time.Second
<mask>
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log.Debugf("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule)
</s> add // trace("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule) </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove {"verbose", "v", "enable verbose output", nil, func() { log.SetLevel(log.TraceLevel) }},
</s> add // {"verbose", "v", "enable verbose output", nil, func() { log.SetLevel(log.TraceLevel) }},
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/dnsforward.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> if err != nil {
<mask> // Return immediately if there's an error
<mask> return nil, errorx.Decorate(err, "dnsfilter failed to check host '%s'", host)
<mask> } else if res.IsFiltered {
<mask> log.Debugf("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule)
<mask> d.Res = s.genDNSFilterMessage(d, &res)
<mask> }
<mask>
<mask> return &res, err
<mask> }
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> remove log.Warnf("Couldn't generate A record for up replacement host '%s': %s", ip.String(), err)
</s> add log.Printf("Couldn't generate A record for replacement host '%s': %s", ip.String(), err) </s> remove {"verbose", "v", "enable verbose output", nil, func() { log.SetLevel(log.TraceLevel) }},
</s> add // {"verbose", "v", "enable verbose output", nil, func() { log.SetLevel(log.TraceLevel) }}, </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/dnsforward.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> resp := dns.Msg{}
<mask> resp.SetReply(request)
<mask> answer, err := dns.NewRR(fmt.Sprintf("%s %d A %s", request.Question[0].Name, s.BlockedResponseTTL, ip.String()))
<mask> if err != nil {
<mask> log.Warnf("Couldn't generate A record for up replacement host '%s': %s", ip.String(), err)
<mask> return s.genServerFailure(request)
<mask> }
<mask> resp.Answer = append(resp.Answer, answer)
<mask> return &resp
<mask> }
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> remove log.Debugf("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule)
</s> add // trace("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule) </s> remove {"verbose", "v", "enable verbose output", nil, func() { log.SetLevel(log.TraceLevel) }},
</s> add // {"verbose", "v", "enable verbose output", nil, func() { log.SetLevel(log.TraceLevel) }}, </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/dnsforward.go
|
keep keep keep add keep keep keep keep
|
<mask>
<mask> import (
<mask> "encoding/json"
<mask> "fmt"
<mask> "net"
<mask> "net/http"
<mask> "strconv"
<mask> "strings"
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> add "log" </s> add "log" </s> add "log" </s> add "log" </s> add "log" </s> remove log "github.com/sirupsen/logrus"
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/querylog.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter"
<mask> "github.com/miekg/dns"
<mask> log "github.com/sirupsen/logrus"
<mask> )
<mask>
<mask> const (
<mask> logBufferCap = 5000 // maximum capacity of logBuffer before it's flushed to disk
<mask> queryLogTimeLimit = time.Hour * 24 // how far in the past we care about querylogs
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log.Debugf("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule)
</s> add // trace("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule) </s> add "log"
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/querylog.go
|
keep keep keep add keep keep keep keep keep keep
|
<mask> "bytes"
<mask> "compress/gzip"
<mask> "encoding/json"
<mask> "fmt"
<mask> "os"
<mask> "sync"
<mask> "time"
<mask>
<mask> "github.com/go-test/deep"
<mask> )
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> add "log" </s> remove log "github.com/sirupsen/logrus"
</s> add </s> add "log" </s> add "log" </s> add "log" </s> add "log"
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/querylog_file.go
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> "os"
<mask> "sync"
<mask> "time"
<mask>
<mask> log "github.com/sirupsen/logrus"
<mask>
<mask> "github.com/go-test/deep"
<mask> )
<mask>
<mask> var (
<mask> fileWriteLock sync.Mutex
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> add "log" </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> add "log" </s> add "log"
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/querylog_file.go
|
keep keep keep add keep keep keep keep keep
|
<mask>
<mask> import (
<mask> "bytes"
<mask> "fmt"
<mask> "net/http"
<mask> "os"
<mask> "path"
<mask> "runtime"
<mask> "sort"
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> add "log" </s> add "log" </s> add "log" </s> add "log" </s> add "log" </s> remove log "github.com/sirupsen/logrus"
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/querylog_top.go
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> "strings"
<mask> "sync"
<mask> "time"
<mask>
<mask> log "github.com/sirupsen/logrus"
<mask>
<mask> "github.com/bluele/gcache"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
<mask> type hourTop struct {
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> add "log" </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> add "log" </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/querylog_top.go
|
keep keep add keep keep keep keep keep keep
|
<mask> import (
<mask> "encoding/json"
<mask> "fmt"
<mask> "net/http"
<mask> "sync"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter"
<mask> )
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> add "log" </s> remove log "github.com/sirupsen/logrus"
</s> add </s> add "log" </s> add "log" </s> add "log" </s> add "log"
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/stats.go
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> "net/http"
<mask> "sync"
<mask> "time"
<mask>
<mask> log "github.com/sirupsen/logrus"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/dnsfilter"
<mask> )
<mask>
<mask> var (
<mask> requests = newDNSCounter("requests_total")
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> remove log "github.com/sirupsen/logrus"
</s> add </s> add "log" </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
dnsforward/stats.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> github.com/patrickmn/go-cache v2.1.0+incompatible
<mask> github.com/pkg/errors v0.8.0
<mask> github.com/shirou/gopsutil v2.18.10+incompatible
<mask> github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
<mask> github.com/sirupsen/logrus v1.2.0
<mask> go.uber.org/goleak v0.10.0
<mask> golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
<mask> golang.org/x/net v0.0.0-20181220203305-927f97764cc3
<mask> gopkg.in/asaskevich/govalidator.v4 v4.0.0-20160518190739-766470278477
<mask> gopkg.in/yaml.v2 v2.2.1
</s> Get rid of logrus, it's TTY output is not friendly or human parseable if we will want users to send us logs. </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log "github.com/sirupsen/logrus"
</s> add </s> remove log.Debugf("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule)
</s> add // trace("Host %s is filtered, reason - '%s', matched rule: '%s'", host, res.Reason, res.Rule) </s> remove {"verbose", "v", "enable verbose output", nil, func() { log.SetLevel(log.TraceLevel) }},
</s> add // {"verbose", "v", "enable verbose output", nil, func() { log.SetLevel(log.TraceLevel) }}, </s> remove log "github.com/sirupsen/logrus"
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/55a7ff7447e328bd75b816c90c902c36bf723fa0
|
go.mod
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> 'uses': 'actions/setup-node@v1'
<mask> 'with':
<mask> 'node-version': '${{ env.NODE_VERSION }}'
<mask> - 'name': 'Set up Go modules cache'
<mask> 'uses': 'actions/cache@v2'
<mask> 'with':
<mask> 'path': '~/go/pkg/mod'
<mask> 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}"
<mask> 'restore-keys': '${{ runner.os }}-go-'
<mask> - 'name': 'Get npm cache directory'
</s> Pull request: all: fix gh cache action version
Merge in DNS/adguard-home from fix-cache-action to master
Squashed commit of the following:
commit d0bd209566e8385813a2a233b453f25495752398
Merge: 38761671 00700c13
Author: Ainar Garipov <[email protected]>
Date: Mon Feb 8 12:47:59 2021 +0300
Merge branch 'master' into fix-cache-action
commit 3876167155d6100342b9bf020663ebb5fd90b7de
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:36:33 2021 +0300
all: don't build frontend twice
commit f3a628dbafb5e8c0375e5c7b19e72a7c4d136f44
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:23:14 2021 +0300
all: more fix
commit 89ff42a271dc49d2c4de88db9ba39105558e1468
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:17:55 2021 +0300
all: fix gh cache action version </s> remove 'uses': 'actions/cache@v2'
</s> add # TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]' </s> remove 'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release build-docker'
</s> add 'run': 'make SIGN=0 VERBOSE=1 build-release build-docker' </s> remove 'uses': 'actions/cache@v2'
</s> add # TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]' </s> remove - 'name': 'Set up node_modules cache'
'uses': 'actions/cache@v2'
</s> add - 'name': 'Set up npm cache'
# TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]'
|
https://github.com/AdguardTeam/AdGuardHome/commit/55bde69691ec3d63abac1f41828d58f90ccbf583
|
.github/workflows/build.yml
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> - 'name': 'Get npm cache directory'
<mask> 'id': 'npm-cache'
<mask> 'run': 'echo "::set-output name=dir::$(npm config get cache)"'
<mask> - 'name': 'Set up npm cache'
<mask> 'uses': 'actions/cache@v2'
<mask> 'with':
<mask> 'path': '${{ steps.npm-cache.outputs.dir }}'
<mask> 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}"
<mask> 'restore-keys': '${{ runner.os }}-node-'
<mask> - 'name': 'Run make ci'
</s> Pull request: all: fix gh cache action version
Merge in DNS/adguard-home from fix-cache-action to master
Squashed commit of the following:
commit d0bd209566e8385813a2a233b453f25495752398
Merge: 38761671 00700c13
Author: Ainar Garipov <[email protected]>
Date: Mon Feb 8 12:47:59 2021 +0300
Merge branch 'master' into fix-cache-action
commit 3876167155d6100342b9bf020663ebb5fd90b7de
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:36:33 2021 +0300
all: don't build frontend twice
commit f3a628dbafb5e8c0375e5c7b19e72a7c4d136f44
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:23:14 2021 +0300
all: more fix
commit 89ff42a271dc49d2c4de88db9ba39105558e1468
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:17:55 2021 +0300
all: fix gh cache action version </s> remove - 'name': 'Set up node_modules cache'
'uses': 'actions/cache@v2'
</s> add - 'name': 'Set up npm cache'
# TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]' </s> remove 'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release build-docker'
</s> add 'run': 'make SIGN=0 VERBOSE=1 build-release build-docker' </s> remove 'uses': 'actions/cache@v2'
</s> add # TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]' </s> remove 'uses': 'actions/cache@v2'
</s> add # TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]'
|
https://github.com/AdguardTeam/AdGuardHome/commit/55bde69691ec3d63abac1f41828d58f90ccbf583
|
.github/workflows/build.yml
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> 'uses': 'actions/setup-node@v1'
<mask> 'with':
<mask> 'node-version': '${{ env.NODE_VERSION }}'
<mask> - 'name': 'Set up Go modules cache'
<mask> 'uses': 'actions/cache@v2'
<mask> 'with':
<mask> 'path': '~/go/pkg/mod'
<mask> 'key': "${{ runner.os }}-go-${{ hashFiles('go.sum') }}"
<mask> 'restore-keys': '${{ runner.os }}-go-'
<mask> - 'name': 'Get npm cache directory'
</s> Pull request: all: fix gh cache action version
Merge in DNS/adguard-home from fix-cache-action to master
Squashed commit of the following:
commit d0bd209566e8385813a2a233b453f25495752398
Merge: 38761671 00700c13
Author: Ainar Garipov <[email protected]>
Date: Mon Feb 8 12:47:59 2021 +0300
Merge branch 'master' into fix-cache-action
commit 3876167155d6100342b9bf020663ebb5fd90b7de
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:36:33 2021 +0300
all: don't build frontend twice
commit f3a628dbafb5e8c0375e5c7b19e72a7c4d136f44
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:23:14 2021 +0300
all: more fix
commit 89ff42a271dc49d2c4de88db9ba39105558e1468
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:17:55 2021 +0300
all: fix gh cache action version
|
https://github.com/AdguardTeam/AdGuardHome/commit/55bde69691ec3d63abac1f41828d58f90ccbf583
|
.github/workflows/build.yml
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> 'restore-keys': '${{ runner.os }}-go-'
<mask> - 'name': 'Get npm cache directory'
<mask> 'id': 'npm-cache'
<mask> 'run': 'echo "::set-output name=dir::$(npm config get cache)"'
<mask> - 'name': 'Set up node_modules cache'
<mask> 'uses': 'actions/cache@v2'
<mask> 'with':
<mask> 'path': '${{ steps.npm-cache.outputs.dir }}'
<mask> 'key': "${{ runner.os }}-node-${{ hashFiles('client/package-lock.json') }}"
<mask> 'restore-keys': '${{ runner.os }}-node-'
<mask> - 'name': 'Set up Snapcraft'
</s> Pull request: all: fix gh cache action version
Merge in DNS/adguard-home from fix-cache-action to master
Squashed commit of the following:
commit d0bd209566e8385813a2a233b453f25495752398
Merge: 38761671 00700c13
Author: Ainar Garipov <[email protected]>
Date: Mon Feb 8 12:47:59 2021 +0300
Merge branch 'master' into fix-cache-action
commit 3876167155d6100342b9bf020663ebb5fd90b7de
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:36:33 2021 +0300
all: don't build frontend twice
commit f3a628dbafb5e8c0375e5c7b19e72a7c4d136f44
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:23:14 2021 +0300
all: more fix
commit 89ff42a271dc49d2c4de88db9ba39105558e1468
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:17:55 2021 +0300
all: fix gh cache action version </s> remove 'uses': 'actions/cache@v2'
</s> add # TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]' </s> remove 'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release build-docker'
</s> add 'run': 'make SIGN=0 VERBOSE=1 build-release build-docker' </s> remove 'uses': 'actions/cache@v2'
</s> add # TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]' </s> remove 'uses': 'actions/cache@v2'
</s> add # TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]'
|
https://github.com/AdguardTeam/AdGuardHome/commit/55bde69691ec3d63abac1f41828d58f90ccbf583
|
.github/workflows/build.yml
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> 'uses': 'docker/setup-qemu-action@v1'
<mask> - 'name': 'Set up Docker Buildx'
<mask> 'uses': 'docker/setup-buildx-action@v1'
<mask> - 'name': 'Run snapshot build'
<mask> 'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release build-docker'
<mask>
<mask> 'notify':
<mask> 'needs':
<mask> - 'build-release'
<mask> # Secrets are not passed to workflows that are triggered by a pull request
</s> Pull request: all: fix gh cache action version
Merge in DNS/adguard-home from fix-cache-action to master
Squashed commit of the following:
commit d0bd209566e8385813a2a233b453f25495752398
Merge: 38761671 00700c13
Author: Ainar Garipov <[email protected]>
Date: Mon Feb 8 12:47:59 2021 +0300
Merge branch 'master' into fix-cache-action
commit 3876167155d6100342b9bf020663ebb5fd90b7de
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:36:33 2021 +0300
all: don't build frontend twice
commit f3a628dbafb5e8c0375e5c7b19e72a7c4d136f44
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:23:14 2021 +0300
all: more fix
commit 89ff42a271dc49d2c4de88db9ba39105558e1468
Author: Ainar Garipov <[email protected]>
Date: Fri Feb 5 20:17:55 2021 +0300
all: fix gh cache action version </s> remove 'uses': 'actions/cache@v2'
</s> add # TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]' </s> remove 'uses': 'actions/cache@v2'
</s> add # TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]' </s> remove 'uses': 'actions/cache@v2'
</s> add # TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]' </s> remove - 'name': 'Set up node_modules cache'
'uses': 'actions/cache@v2'
</s> add - 'name': 'Set up npm cache'
# TODO(a.garipov): Update when they fix the macOS issue. The issue is
# most probably https://github.com/actions/cache/issues/527.
'uses': 'actions/[email protected]'
|
https://github.com/AdguardTeam/AdGuardHome/commit/55bde69691ec3d63abac1f41828d58f90ccbf583
|
.github/workflows/build.yml
|
keep keep keep replace keep keep keep keep replace replace
|
<mask> httpsServer.cond.Wait()
<mask> }
<mask> address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.TLS.PortHTTPS))
<mask> cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
<mask> if err != nil {
<mask> log.Fatal(err)
<mask> os.Exit(1)
<mask> }
<mask> config := &tls.Config{
<mask> Certificates: []tls.Certificate{cert},
</s> Validate certificates and update certificate statuses on launch as well. </s> remove Addr: address,
TLSConfig: config,
</s> add Addr: address,
TLSConfig: &tls.Config{
Certificates: []tls.Certificate{cert},
}, </s> add httpsServer.cond.L.Unlock()
// prepare HTTPS server </s> add // clear out all warnings and statuses
data.tlsConfigStatus = tlsConfigStatus{}
</s> remove httpsServer.cond.L.Unlock()
</s> add </s> add // field ordering is not important -- these are for API and are recalculated on each run
type tlsConfigStatus struct {
StatusCertificate string `yaml:"-" json:"status_cert,omitempty"`
StatusKey string `yaml:"-" json:"status_key,omitempty"`
Warning string `yaml:"-" json:"warning,omitempty"`
WarningValidation string `yaml:"-" json:"warning_validation,omitempty"`
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/571be687336ad874eef025061112b3dfed0fab5d
|
app.go
|
keep keep add keep keep keep keep keep
|
<mask> log.Fatal(err)
<mask> os.Exit(1)
<mask> }
<mask> httpsServer.server = &http.Server{
<mask> Addr: address,
<mask> TLSConfig: &tls.Config{
<mask> Certificates: []tls.Certificate{cert},
<mask> },
</s> Validate certificates and update certificate statuses on launch as well. </s> remove Addr: address,
TLSConfig: config,
</s> add Addr: address,
TLSConfig: &tls.Config{
Certificates: []tls.Certificate{cert},
}, </s> remove config := &tls.Config{
Certificates: []tls.Certificate{cert},
</s> add confing.TLS = data // update warnings
// prepare cert for HTTPS server
cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
if err != nil {
log.Fatal(err)
os.Exit(1) </s> remove cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
</s> add // validate current TLS config and update warnings (it could have been loaded from file)
data, err := validateCertificates(config.TLS) </s> add // clear out all warnings and statuses
data.tlsConfigStatus = tlsConfigStatus{}
</s> remove httpsServer.cond.L.Unlock()
</s> add </s> remove
// only for API, no need to be stored in config
StatusCertificate string `yaml:"status_cert" json:"status_cert,omitempty"`
StatusKey string `yaml:"status_key" json:"status_key,omitempty"`
Warning string `yaml:"warning" json:"warning,omitempty"`
WarningValidation string `yaml:"warning_validation" json:"warning_validation,omitempty"`
</s> add tlsConfigStatus `yaml:"-" json:",inline"`
|
https://github.com/AdguardTeam/AdGuardHome/commit/571be687336ad874eef025061112b3dfed0fab5d
|
app.go
|
keep replace replace keep replace keep keep keep
|
<mask> httpsServer.server = &http.Server{
<mask> Addr: address,
<mask> TLSConfig: config,
<mask> }
<mask> httpsServer.cond.L.Unlock()
<mask>
<mask> URL := fmt.Sprintf("https://%s", address)
<mask> log.Println("Go to " + URL)
</s> Validate certificates and update certificate statuses on launch as well. </s> remove config := &tls.Config{
Certificates: []tls.Certificate{cert},
</s> add confing.TLS = data // update warnings
// prepare cert for HTTPS server
cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
if err != nil {
log.Fatal(err)
os.Exit(1) </s> add httpsServer.cond.L.Unlock()
// prepare HTTPS server </s> add // clear out all warnings and statuses
data.tlsConfigStatus = tlsConfigStatus{}
</s> remove
// only for API, no need to be stored in config
StatusCertificate string `yaml:"status_cert" json:"status_cert,omitempty"`
StatusKey string `yaml:"status_key" json:"status_key,omitempty"`
Warning string `yaml:"warning" json:"warning,omitempty"`
WarningValidation string `yaml:"warning_validation" json:"warning_validation,omitempty"`
</s> add tlsConfigStatus `yaml:"-" json:",inline"` </s> remove cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
</s> add // validate current TLS config and update warnings (it could have been loaded from file)
data, err := validateCertificates(config.TLS)
|
https://github.com/AdguardTeam/AdGuardHome/commit/571be687336ad874eef025061112b3dfed0fab5d
|
app.go
|
keep keep add keep keep keep keep keep keep
|
<mask> dnsforward.TLSConfig `yaml:",inline" json:",inline"`
<mask> }
<mask>
<mask> // field ordering is important -- yaml fields will mirror ordering from here
<mask> type tlsConfig struct {
<mask> tlsConfigSettings `yaml:",inline" json:",inline"`
<mask> tlsConfigStatus `yaml:"-" json:",inline"`
<mask> }
<mask>
</s> Validate certificates and update certificate statuses on launch as well. </s> remove
// only for API, no need to be stored in config
StatusCertificate string `yaml:"status_cert" json:"status_cert,omitempty"`
StatusKey string `yaml:"status_key" json:"status_key,omitempty"`
Warning string `yaml:"warning" json:"warning,omitempty"`
WarningValidation string `yaml:"warning_validation" json:"warning_validation,omitempty"`
</s> add tlsConfigStatus `yaml:"-" json:",inline"` </s> remove cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
</s> add // validate current TLS config and update warnings (it could have been loaded from file)
data, err := validateCertificates(config.TLS) </s> add // clear out all warnings and statuses
data.tlsConfigStatus = tlsConfigStatus{}
</s> remove config := &tls.Config{
Certificates: []tls.Certificate{cert},
</s> add confing.TLS = data // update warnings
// prepare cert for HTTPS server
cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
if err != nil {
log.Fatal(err)
os.Exit(1) </s> add httpsServer.cond.L.Unlock()
// prepare HTTPS server </s> remove httpsServer.cond.L.Unlock()
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/571be687336ad874eef025061112b3dfed0fab5d
|
config.go
|
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
|
<mask>
<mask> // field ordering is important -- yaml fields will mirror ordering from here
<mask> type tlsConfig struct {
<mask> tlsConfigSettings `yaml:",inline" json:",inline"`
<mask>
<mask> // only for API, no need to be stored in config
<mask> StatusCertificate string `yaml:"status_cert" json:"status_cert,omitempty"`
<mask> StatusKey string `yaml:"status_key" json:"status_key,omitempty"`
<mask> Warning string `yaml:"warning" json:"warning,omitempty"`
<mask> WarningValidation string `yaml:"warning_validation" json:"warning_validation,omitempty"`
<mask> }
<mask>
<mask> // initialize to default values, will be changed later when reading config or parsing command line
<mask> var config = configuration{
<mask> ourConfigFilename: "AdGuardHome.yaml",
</s> Validate certificates and update certificate statuses on launch as well. </s> add // field ordering is not important -- these are for API and are recalculated on each run
type tlsConfigStatus struct {
StatusCertificate string `yaml:"-" json:"status_cert,omitempty"`
StatusKey string `yaml:"-" json:"status_key,omitempty"`
Warning string `yaml:"-" json:"warning,omitempty"`
WarningValidation string `yaml:"-" json:"warning_validation,omitempty"`
}
</s> add // clear out all warnings and statuses
data.tlsConfigStatus = tlsConfigStatus{}
</s> remove cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
</s> add // validate current TLS config and update warnings (it could have been loaded from file)
data, err := validateCertificates(config.TLS) </s> remove config := &tls.Config{
Certificates: []tls.Certificate{cert},
</s> add confing.TLS = data // update warnings
// prepare cert for HTTPS server
cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
if err != nil {
log.Fatal(err)
os.Exit(1) </s> remove httpsServer.cond.L.Unlock()
</s> add </s> add httpsServer.cond.L.Unlock()
// prepare HTTPS server
|
https://github.com/AdguardTeam/AdGuardHome/commit/571be687336ad874eef025061112b3dfed0fab5d
|
config.go
|
keep keep keep add keep keep keep keep
|
<mask> }
<mask> opts.Intermediates = pool
<mask> }
<mask>
<mask> // TODO: save it as a warning rather than error it out -- shouldn't be a big problem
<mask> mainCert := parsedCerts[0]
<mask> _, err := mainCert.Verify(opts)
<mask> if err != nil {
</s> Validate certificates and update certificate statuses on launch as well. </s> remove config := &tls.Config{
Certificates: []tls.Certificate{cert},
</s> add confing.TLS = data // update warnings
// prepare cert for HTTPS server
cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
if err != nil {
log.Fatal(err)
os.Exit(1) </s> remove cert, err := tls.X509KeyPair([]byte(config.TLS.CertificateChain), []byte(config.TLS.PrivateKey))
</s> add // validate current TLS config and update warnings (it could have been loaded from file)
data, err := validateCertificates(config.TLS) </s> remove
// only for API, no need to be stored in config
StatusCertificate string `yaml:"status_cert" json:"status_cert,omitempty"`
StatusKey string `yaml:"status_key" json:"status_key,omitempty"`
Warning string `yaml:"warning" json:"warning,omitempty"`
WarningValidation string `yaml:"warning_validation" json:"warning_validation,omitempty"`
</s> add tlsConfigStatus `yaml:"-" json:",inline"` </s> remove httpsServer.cond.L.Unlock()
</s> add </s> remove Addr: address,
TLSConfig: config,
</s> add Addr: address,
TLSConfig: &tls.Config{
Certificates: []tls.Certificate{cert},
}, </s> add // field ordering is not important -- these are for API and are recalculated on each run
type tlsConfigStatus struct {
StatusCertificate string `yaml:"-" json:"status_cert,omitempty"`
StatusKey string `yaml:"-" json:"status_key,omitempty"`
Warning string `yaml:"-" json:"warning,omitempty"`
WarningValidation string `yaml:"-" json:"warning_validation,omitempty"`
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/571be687336ad874eef025061112b3dfed0fab5d
|
control.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> import (
<mask> "io/fs"
<mask> "net"
<mask> "os"
<mask> "path"
<mask> "strings"
<mask> "sync/atomic"
<mask> "testing"
<mask> "testing/fstest"
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> add "io/fs" </s> add "os" </s> remove "os/exec"
"runtime"
</s> add </s> remove "strings"
</s> add </s> remove testdata := os.DirFS("./testdata")
</s> add </s> remove testdata := os.DirFS("./testdata")
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/aghnet/hostscontainer_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> })
<mask> }
<mask>
<mask> func TestHostsContainer_Translate(t *testing.T) {
<mask> testdata := os.DirFS("./testdata")
<mask> stubWatcher := aghtest.FSWatcher{
<mask> OnEvents: func() (e <-chan struct{}) { return nil },
<mask> OnAdd: func(name string) (err error) { return nil },
<mask> OnClose: func() (err error) { panic("not implemented") },
<mask> }
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove testdata := os.DirFS("./testdata")
</s> add </s> remove return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out))
</s> add return 1, "", fmt.Errorf("command %q failed: %w: %s", command, err, out) </s> remove // MaxCmdOutputSize is the maximum length of performed shell command output.
const MaxCmdOutputSize = 2 * 1024
</s> add // MaxCmdOutputSize is the maximum length of performed shell command output in
// bytes.
const MaxCmdOutputSize = 64 * 1024 </s> remove func RunCommand(command string, arguments ...string) (int, string, error) {
</s> add func RunCommand(command string, arguments ...string) (code int, output string, err error) { </s> remove cmd := exec.Command("arp", "-a")
log.Tracef("executing %q %q", cmd.Path, cmd.Args)
data, err := cmd.Output()
if err != nil || cmd.ProcessState.ExitCode() != 0 {
log.Debug("command %q has failed: %q code:%d",
cmd.Path, err, cmd.ProcessState.ExitCode())
</s> add ns := clients.arpdb.Neighbors()
if len(ns) == 0 {
log.Debug("refreshing arp container: the update is empty")
</s> add // testdata is the filesystem containing data for testing the package.
var testdata fs.FS = os.DirFS("./testdata")
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/aghnet/hostscontainer_test.go
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask>
<mask> func TestHostsContainer(t *testing.T) {
<mask> const listID = 1234
<mask>
<mask> testdata := os.DirFS("./testdata")
<mask>
<mask> testCases := []struct {
<mask> want []*rules.DNSRewrite
<mask> name string
<mask> req urlfilter.DNSRequest
<mask> }{{
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove testdata := os.DirFS("./testdata")
</s> add </s> add // testdata is the filesystem containing data for testing the package.
var testdata fs.FS = os.DirFS("./testdata")
</s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove // MaxCmdOutputSize is the maximum length of performed shell command output.
const MaxCmdOutputSize = 2 * 1024
</s> add // MaxCmdOutputSize is the maximum length of performed shell command output in
// bytes.
const MaxCmdOutputSize = 64 * 1024 </s> remove func RunCommand(command string, arguments ...string) (int, string, error) {
</s> add func RunCommand(command string, arguments ...string) (code int, output string, err error) { </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil)
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/aghnet/hostscontainer_test.go
|
keep keep add keep keep keep keep keep
|
<mask> package aghnet
<mask>
<mask> import (
<mask> "net"
<mask> "os"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove "os"
</s> add </s> add "os" </s> remove "os/exec"
"runtime"
</s> add </s> remove "strings"
</s> add </s> remove testdata := os.DirFS("./testdata")
</s> add </s> remove testdata := os.DirFS("./testdata")
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/aghnet/net_test.go
|
keep add keep keep keep keep keep
|
<mask> "io/fs"
<mask> "net"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> "github.com/AdguardTeam/golibs/testutil"
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> add "io/fs" </s> remove "os"
</s> add </s> remove "strings"
</s> add </s> remove "os/exec"
"runtime"
</s> add </s> remove testdata := os.DirFS("./testdata")
</s> add </s> remove testdata := os.DirFS("./testdata")
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/aghnet/net_test.go
|
keep keep add keep keep keep keep
|
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> func TestMain(m *testing.M) {
<mask> aghtest.DiscardLogOutput(m)
<mask> }
<mask>
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> add arpdb aghnet.ARPDB, </s> remove testdata := os.DirFS("./testdata")
</s> add </s> remove return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out))
</s> add return 1, "", fmt.Errorf("command %q failed: %w: %s", command, err, out) </s> remove n := 0
// TODO(a.garipov): Rewrite to use bufio.Scanner.
lines := strings.Split(string(data), "\n")
for _, ln := range lines {
lparen := strings.Index(ln, " (")
rparen := strings.Index(ln, ") ")
if lparen == -1 || rparen == -1 || lparen >= rparen {
continue
}
host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if netutil.ValidateDomainName(host) != nil || ip == nil {
continue
}
ok := clients.addHostLocked(ip, host, ClientSourceARP)
if ok {
n++
</s> add added := 0
for _, n := range ns {
if clients.addHostLocked(n.IP, "", ClientSourceARP) {
added++ </s> remove Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
</s> add var arpdb aghnet.ARPDB
arpdb, err = aghnet.NewARPDB()
if err != nil {
log.Info("warning: creating arpdb: %s; using stub", err)
arpdb = aghnet.EmptyARPDB{}
}
Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts, arpdb) </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil)
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/aghnet/net_test.go
|
keep keep keep replace replace keep keep replace keep keep
|
<mask> return haveAdminRights()
<mask> }
<mask>
<mask> // MaxCmdOutputSize is the maximum length of performed shell command output.
<mask> const MaxCmdOutputSize = 2 * 1024
<mask>
<mask> // RunCommand runs shell command.
<mask> func RunCommand(command string, arguments ...string) (int, string, error) {
<mask> cmd := exec.Command(command, arguments...)
<mask> out, err := cmd.Output()
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove if runtime.GOOS == "windows" {
</s> add if err := clients.arpdb.Refresh(); err != nil {
log.Error("refreshing arp container: %s", err)
clients.arpdb = aghnet.EmptyARPDB{}
</s> remove cmd := exec.Command("arp", "-a")
log.Tracef("executing %q %q", cmd.Path, cmd.Args)
data, err := cmd.Output()
if err != nil || cmd.ProcessState.ExitCode() != 0 {
log.Debug("command %q has failed: %q code:%d",
cmd.Path, err, cmd.ProcessState.ExitCode())
</s> add ns := clients.arpdb.Neighbors()
if len(ns) == 0 {
log.Debug("refreshing arp container: the update is empty")
</s> remove testdata := os.DirFS("./testdata")
</s> add </s> remove testdata := os.DirFS("./testdata")
</s> add </s> add // testdata is the filesystem containing data for testing the package.
var testdata fs.FS = os.DirFS("./testdata")
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/aghos/os.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> if errors.As(err, new(*exec.ExitError)) {
<mask> return cmd.ProcessState.ExitCode(), string(out), nil
<mask> } else if err != nil {
<mask> return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out))
<mask> }
<mask>
<mask> return cmd.ProcessState.ExitCode(), string(out), nil
<mask> }
<mask>
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove cmd := exec.Command("arp", "-a")
log.Tracef("executing %q %q", cmd.Path, cmd.Args)
data, err := cmd.Output()
if err != nil || cmd.ProcessState.ExitCode() != 0 {
log.Debug("command %q has failed: %q code:%d",
cmd.Path, err, cmd.ProcessState.ExitCode())
</s> add ns := clients.arpdb.Neighbors()
if len(ns) == 0 {
log.Debug("refreshing arp container: the update is empty")
</s> remove Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
</s> add var arpdb aghnet.ARPDB
arpdb, err = aghnet.NewARPDB()
if err != nil {
log.Info("warning: creating arpdb: %s; using stub", err)
arpdb = aghnet.EmptyARPDB{}
}
Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts, arpdb) </s> remove if runtime.GOOS == "windows" {
</s> add if err := clients.arpdb.Refresh(); err != nil {
log.Error("refreshing arp container: %s", err)
clients.arpdb = aghnet.EmptyARPDB{}
</s> remove testdata := os.DirFS("./testdata")
</s> add </s> add arpdb aghnet.ARPDB, </s> remove n := 0
// TODO(a.garipov): Rewrite to use bufio.Scanner.
lines := strings.Split(string(data), "\n")
for _, ln := range lines {
lparen := strings.Index(ln, " (")
rparen := strings.Index(ln, ") ")
if lparen == -1 || rparen == -1 || lparen >= rparen {
continue
}
host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if netutil.ValidateDomainName(host) != nil || ip == nil {
continue
}
ok := clients.addHostLocked(ip, host, ClientSourceARP)
if ok {
n++
</s> add added := 0
for _, n := range ns {
if clients.addHostLocked(n.IP, "", ClientSourceARP) {
added++
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/aghos/os.go
|
keep keep replace replace keep replace keep
|
<mask> "fmt"
<mask> "net"
<mask> "os/exec"
<mask> "runtime"
<mask> "sort"
<mask> "strings"
<mask> "sync"
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove "os"
</s> add </s> add "os" </s> add "io/fs" </s> remove testdata := os.DirFS("./testdata")
</s> add </s> remove testdata := os.DirFS("./testdata")
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/clients.go
|
keep keep keep add keep keep keep keep
|
<mask> // etcHosts contains list of rewrite rules taken from the operating system's
<mask> // hosts database.
<mask> etcHosts *aghnet.HostsContainer
<mask>
<mask> testing bool // if TRUE, this object is used for internal tests
<mask> }
<mask>
<mask> // Init initializes clients container
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> add // testdata is the filesystem containing data for testing the package.
var testdata fs.FS = os.DirFS("./testdata")
</s> remove log.Debug("clients: added %d client aliases from 'arp -a' command output", n)
</s> add log.Debug("clients: added %d client aliases from arp neighborhood", added) </s> remove // MaxCmdOutputSize is the maximum length of performed shell command output.
const MaxCmdOutputSize = 2 * 1024
</s> add // MaxCmdOutputSize is the maximum length of performed shell command output in
// bytes.
const MaxCmdOutputSize = 64 * 1024 </s> remove if runtime.GOOS == "windows" {
</s> add if err := clients.arpdb.Refresh(); err != nil {
log.Error("refreshing arp container: %s", err)
clients.arpdb = aghnet.EmptyARPDB{}
</s> add arpdb aghnet.ARPDB, </s> remove func RunCommand(command string, arguments ...string) (int, string, error) {
</s> add func RunCommand(command string, arguments ...string) (code int, output string, err error) {
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/clients.go
|
keep keep add keep keep keep keep
|
<mask> objects []*clientObject,
<mask> dhcpServer *dhcpd.Server,
<mask> etcHosts *aghnet.HostsContainer,
<mask> ) {
<mask> if clients.list != nil {
<mask> log.Fatal("clients.list != nil")
<mask> }
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> add clients.arpdb = arpdb </s> remove Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
</s> add var arpdb aghnet.ARPDB
arpdb, err = aghnet.NewARPDB()
if err != nil {
log.Info("warning: creating arpdb: %s; using stub", err)
arpdb = aghnet.EmptyARPDB{}
}
Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts, arpdb) </s> remove return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out))
</s> add return 1, "", fmt.Errorf("command %q failed: %w: %s", command, err, out) </s> remove cmd := exec.Command("arp", "-a")
log.Tracef("executing %q %q", cmd.Path, cmd.Args)
data, err := cmd.Output()
if err != nil || cmd.ProcessState.ExitCode() != 0 {
log.Debug("command %q has failed: %q code:%d",
cmd.Path, err, cmd.ProcessState.ExitCode())
</s> add ns := clients.arpdb.Neighbors()
if len(ns) == 0 {
log.Debug("refreshing arp container: the update is empty")
</s> remove if runtime.GOOS == "windows" {
</s> add if err := clients.arpdb.Refresh(); err != nil {
log.Error("refreshing arp container: %s", err)
clients.arpdb = aghnet.EmptyARPDB{}
</s> remove n := 0
// TODO(a.garipov): Rewrite to use bufio.Scanner.
lines := strings.Split(string(data), "\n")
for _, ln := range lines {
lparen := strings.Index(ln, " (")
rparen := strings.Index(ln, ") ")
if lparen == -1 || rparen == -1 || lparen >= rparen {
continue
}
host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if netutil.ValidateDomainName(host) != nil || ip == nil {
continue
}
ok := clients.addHostLocked(ip, host, ClientSourceARP)
if ok {
n++
</s> add added := 0
for _, n := range ns {
if clients.addHostLocked(n.IP, "", ClientSourceARP) {
added++
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/clients.go
|
keep keep keep add keep keep keep keep
|
<mask> clients.allTags = stringutil.NewSet(clientTags...)
<mask>
<mask> clients.dhcpServer = dhcpServer
<mask> clients.etcHosts = etcHosts
<mask> clients.addFromConfig(objects)
<mask>
<mask> if clients.testing {
<mask> return
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> add arpdb aghnet.ARPDB, </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
</s> add var arpdb aghnet.ARPDB
arpdb, err = aghnet.NewARPDB()
if err != nil {
log.Info("warning: creating arpdb: %s; using stub", err)
arpdb = aghnet.EmptyARPDB{}
}
Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts, arpdb) </s> remove if runtime.GOOS == "windows" {
</s> add if err := clients.arpdb.Refresh(); err != nil {
log.Error("refreshing arp container: %s", err)
clients.arpdb = aghnet.EmptyARPDB{}
</s> remove func RunCommand(command string, arguments ...string) (int, string, error) {
</s> add func RunCommand(command string, arguments ...string) (code int, output string, err error) { </s> remove // MaxCmdOutputSize is the maximum length of performed shell command output.
const MaxCmdOutputSize = 2 * 1024
</s> add // MaxCmdOutputSize is the maximum length of performed shell command output in
// bytes.
const MaxCmdOutputSize = 64 * 1024
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/clients.go
|
keep keep keep replace keep keep keep replace replace replace replace replace replace keep keep keep
|
<mask> // addFromSystemARP adds the IP-hostname pairings from the output of the arp -a
<mask> // command.
<mask> func (clients *clientsContainer) addFromSystemARP() {
<mask> if runtime.GOOS == "windows" {
<mask> return
<mask> }
<mask>
<mask> cmd := exec.Command("arp", "-a")
<mask> log.Tracef("executing %q %q", cmd.Path, cmd.Args)
<mask> data, err := cmd.Output()
<mask> if err != nil || cmd.ProcessState.ExitCode() != 0 {
<mask> log.Debug("command %q has failed: %q code:%d",
<mask> cmd.Path, err, cmd.ProcessState.ExitCode())
<mask> return
<mask> }
<mask>
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out))
</s> add return 1, "", fmt.Errorf("command %q failed: %w: %s", command, err, out) </s> remove log.Debug("clients: added %d client aliases from 'arp -a' command output", n)
</s> add log.Debug("clients: added %d client aliases from arp neighborhood", added) </s> remove // MaxCmdOutputSize is the maximum length of performed shell command output.
const MaxCmdOutputSize = 2 * 1024
</s> add // MaxCmdOutputSize is the maximum length of performed shell command output in
// bytes.
const MaxCmdOutputSize = 64 * 1024 </s> remove func RunCommand(command string, arguments ...string) (int, string, error) {
</s> add func RunCommand(command string, arguments ...string) (code int, output string, err error) { </s> remove n := 0
// TODO(a.garipov): Rewrite to use bufio.Scanner.
lines := strings.Split(string(data), "\n")
for _, ln := range lines {
lparen := strings.Index(ln, " (")
rparen := strings.Index(ln, ") ")
if lparen == -1 || rparen == -1 || lparen >= rparen {
continue
}
host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if netutil.ValidateDomainName(host) != nil || ip == nil {
continue
}
ok := clients.addHostLocked(ip, host, ClientSourceARP)
if ok {
n++
</s> add added := 0
for _, n := range ns {
if clients.addHostLocked(n.IP, "", ClientSourceARP) {
added++
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/clients.go
|
keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep replace
|
<mask> clients.rmHostsBySrc(ClientSourceARP)
<mask>
<mask> n := 0
<mask> // TODO(a.garipov): Rewrite to use bufio.Scanner.
<mask> lines := strings.Split(string(data), "\n")
<mask> for _, ln := range lines {
<mask> lparen := strings.Index(ln, " (")
<mask> rparen := strings.Index(ln, ") ")
<mask> if lparen == -1 || rparen == -1 || lparen >= rparen {
<mask> continue
<mask> }
<mask>
<mask> host := ln[:lparen]
<mask> ipStr := ln[lparen+2 : rparen]
<mask> ip := net.ParseIP(ipStr)
<mask> if netutil.ValidateDomainName(host) != nil || ip == nil {
<mask> continue
<mask> }
<mask>
<mask> ok := clients.addHostLocked(ip, host, ClientSourceARP)
<mask> if ok {
<mask> n++
<mask> }
<mask> }
<mask>
<mask> log.Debug("clients: added %d client aliases from 'arp -a' command output", n)
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove cmd := exec.Command("arp", "-a")
log.Tracef("executing %q %q", cmd.Path, cmd.Args)
data, err := cmd.Output()
if err != nil || cmd.ProcessState.ExitCode() != 0 {
log.Debug("command %q has failed: %q code:%d",
cmd.Path, err, cmd.ProcessState.ExitCode())
</s> add ns := clients.arpdb.Neighbors()
if len(ns) == 0 {
log.Debug("refreshing arp container: the update is empty")
</s> remove if runtime.GOOS == "windows" {
</s> add if err := clients.arpdb.Refresh(); err != nil {
log.Error("refreshing arp container: %s", err)
clients.arpdb = aghnet.EmptyARPDB{}
</s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
</s> add var arpdb aghnet.ARPDB
arpdb, err = aghnet.NewARPDB()
if err != nil {
log.Info("warning: creating arpdb: %s; using stub", err)
arpdb = aghnet.EmptyARPDB{}
}
Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts, arpdb) </s> remove testdata := os.DirFS("./testdata")
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/clients.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> func TestClients(t *testing.T) {
<mask> clients := clientsContainer{}
<mask> clients.testing = true
<mask>
<mask> clients.Init(nil, nil, nil)
<mask>
<mask> t.Run("add_success", func(t *testing.T) {
<mask> c := &Client{
<mask> IDs: []string{"1.1.1.1", "1:2:3::4", "aa:aa:aa:aa:aa:aa"},
<mask> Name: "client1",
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove testdata := os.DirFS("./testdata")
</s> add </s> remove testdata := os.DirFS("./testdata")
</s> add </s> add clients.arpdb = arpdb
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/clients_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> func TestClientsWHOIS(t *testing.T) {
<mask> clients := clientsContainer{
<mask> testing: true,
<mask> }
<mask> clients.Init(nil, nil, nil)
<mask> whois := &RuntimeClientWHOISInfo{
<mask> Country: "AU",
<mask> Orgname: "Example Org",
<mask> }
<mask>
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove testdata := os.DirFS("./testdata")
</s> add </s> remove n := 0
// TODO(a.garipov): Rewrite to use bufio.Scanner.
lines := strings.Split(string(data), "\n")
for _, ln := range lines {
lparen := strings.Index(ln, " (")
rparen := strings.Index(ln, ") ")
if lparen == -1 || rparen == -1 || lparen >= rparen {
continue
}
host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if netutil.ValidateDomainName(host) != nil || ip == nil {
continue
}
ok := clients.addHostLocked(ip, host, ClientSourceARP)
if ok {
n++
</s> add added := 0
for _, n := range ns {
if clients.addHostLocked(n.IP, "", ClientSourceARP) {
added++ </s> remove testdata := os.DirFS("./testdata")
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/clients_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> func TestClientsAddExisting(t *testing.T) {
<mask> clients := clientsContainer{
<mask> testing: true,
<mask> }
<mask> clients.Init(nil, nil, nil)
<mask>
<mask> t.Run("simple", func(t *testing.T) {
<mask> ip := net.IP{1, 1, 1, 1}
<mask>
<mask> // Add a client.
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out))
</s> add return 1, "", fmt.Errorf("command %q failed: %w: %s", command, err, out) </s> remove n := 0
// TODO(a.garipov): Rewrite to use bufio.Scanner.
lines := strings.Split(string(data), "\n")
for _, ln := range lines {
lparen := strings.Index(ln, " (")
rparen := strings.Index(ln, ") ")
if lparen == -1 || rparen == -1 || lparen >= rparen {
continue
}
host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if netutil.ValidateDomainName(host) != nil || ip == nil {
continue
}
ok := clients.addHostLocked(ip, host, ClientSourceARP)
if ok {
n++
</s> add added := 0
for _, n := range ns {
if clients.addHostLocked(n.IP, "", ClientSourceARP) {
added++ </s> remove testdata := os.DirFS("./testdata")
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/clients_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> func TestClientsCustomUpstream(t *testing.T) {
<mask> clients := clientsContainer{
<mask> testing: true,
<mask> }
<mask> clients.Init(nil, nil, nil)
<mask>
<mask> // Add client with upstreams.
<mask> ok, err := clients.Add(&Client{
<mask> IDs: []string{"1.1.1.1", "1:2:3::4", "aa:aa:aa:aa:aa:aa"},
<mask> Name: "client1",
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove clients.Init(nil, nil, nil)
</s> add clients.Init(nil, nil, nil, nil) </s> remove log.Debug("clients: added %d client aliases from 'arp -a' command output", n)
</s> add log.Debug("clients: added %d client aliases from arp neighborhood", added) </s> remove n := 0
// TODO(a.garipov): Rewrite to use bufio.Scanner.
lines := strings.Split(string(data), "\n")
for _, ln := range lines {
lparen := strings.Index(ln, " (")
rparen := strings.Index(ln, ") ")
if lparen == -1 || rparen == -1 || lparen >= rparen {
continue
}
host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if netutil.ValidateDomainName(host) != nil || ip == nil {
continue
}
ok := clients.addHostLocked(ip, host, ClientSourceARP)
if ok {
n++
</s> add added := 0
for _, n := range ns {
if clients.addHostLocked(n.IP, "", ClientSourceARP) {
added++ </s> remove testdata := os.DirFS("./testdata")
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/clients_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> return err
<mask> }
<mask> }
<mask>
<mask> Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
<mask>
<mask> if args.bindPort != 0 {
<mask> uc := aghalg.UniqChecker{}
<mask> addPorts(
<mask> uc,
</s> Pull request: 3597 arpdb
Merge in DNS/adguard-home from 3597-wrt-netlink to master
Updates #3597.
Squashed commit of the following:
commit 1709582cd204bb80c84775feabae8723ed3340f6
Merge: 0507b6ed e7b3c996
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:25:18 2022 +0300
Merge branch 'master' into 3597-wrt-netlink
commit 0507b6ede1162554ca8ac7399d827264aca64f98
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 15 20:21:29 2022 +0300
all: imp code
commit 71f9758d854b3e2cf90cbd3655ae4818cfbcf528
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 18:03:48 2022 +0500
aghnet: imp naming
commit c949e765104f130aa3e5ba465bdebc3286bebe44
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 9 17:26:30 2022 +0500
all: imp code, docs
commit cf605ddb401b6e7b0a7a4bb1b175a4dc588d253a
Author: Eugene Burkov <[email protected]>
Date: Tue Mar 8 15:33:52 2022 +0500
all: imp code, docs
commit 2960c6549a7e4944cc0072ca47a0cd4e82ec850e
Author: Eugene Burkov <[email protected]>
Date: Sun Mar 6 21:34:58 2022 +0500
all: imp code & docs, fix tests
commit 29c049f3aee91a826c3416961686396d562a7066
Author: Eugene Burkov <[email protected]>
Date: Wed Mar 2 20:45:34 2022 +0300
all: add arpdb </s> remove cmd := exec.Command("arp", "-a")
log.Tracef("executing %q %q", cmd.Path, cmd.Args)
data, err := cmd.Output()
if err != nil || cmd.ProcessState.ExitCode() != 0 {
log.Debug("command %q has failed: %q code:%d",
cmd.Path, err, cmd.ProcessState.ExitCode())
</s> add ns := clients.arpdb.Neighbors()
if len(ns) == 0 {
log.Debug("refreshing arp container: the update is empty")
</s> remove return 1, "", fmt.Errorf("exec.Command(%s) failed: %w: %s", command, err, string(out))
</s> add return 1, "", fmt.Errorf("command %q failed: %w: %s", command, err, out) </s> remove n := 0
// TODO(a.garipov): Rewrite to use bufio.Scanner.
lines := strings.Split(string(data), "\n")
for _, ln := range lines {
lparen := strings.Index(ln, " (")
rparen := strings.Index(ln, ") ")
if lparen == -1 || rparen == -1 || lparen >= rparen {
continue
}
host := ln[:lparen]
ipStr := ln[lparen+2 : rparen]
ip := net.ParseIP(ipStr)
if netutil.ValidateDomainName(host) != nil || ip == nil {
continue
}
ok := clients.addHostLocked(ip, host, ClientSourceARP)
if ok {
n++
</s> add added := 0
for _, n := range ns {
if clients.addHostLocked(n.IP, "", ClientSourceARP) {
added++ </s> remove if runtime.GOOS == "windows" {
</s> add if err := clients.arpdb.Refresh(); err != nil {
log.Error("refreshing arp container: %s", err)
clients.arpdb = aghnet.EmptyARPDB{}
</s> add arpdb aghnet.ARPDB, </s> remove testdata := os.DirFS("./testdata")
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/573cbafe3f2f222d7c6413d8fe30c90ae295882d
|
internal/home/home.go
|
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask>
<mask> const COLUMN_MIN_WIDTH = 200;
<mask>
<mask> class AutoClients extends Component {
<mask> getStats = (ip, stats) => {
<mask> if (stats) {
<mask> const statsForCurrentIP = stats.find(item => item.name === ip);
<mask> return statsForCurrentIP && statsForCurrentIP.count;
<mask> }
<mask>
<mask> return '';
<mask> };
<mask>
<mask> columns = [
<mask> {
<mask> Header: this.props.t('table_client'),
<mask> accessor: 'ip',
<mask> minWidth: COLUMN_MIN_WIDTH,
</s> - client: sort clients table by requests count by default </s> remove getStats = (name, stats) => {
if (stats) {
const currentStats = stats.find(item => item.info && item.info.name === name);
return currentStats && currentStats.count;
}
return '';
};
</s> add </s> remove const clientIP = row.original.ip;
const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
</s> add const { value: clientStats } = row; </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
</s> remove const { name } = row.original;
const clientStats = this.getStats(name, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove accessor: 'statistics',
</s> add accessor: row => this.props.normalizedTopClients[row.ip] || 0,
sortMethod: (a, b) => b - a,
id: 'statistics', </s> remove accessor: 'statistics',
</s> add id: 'statistics',
accessor: row => this.props.normalizedTopClients[row.name] || 0,
sortMethod: (a, b) => b - a,
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/components/Settings/Clients/AutoClients.js
|
keep replace keep keep replace replace keep
|
<mask> Header: this.props.t('requests_count'),
<mask> accessor: 'statistics',
<mask> minWidth: COLUMN_MIN_WIDTH,
<mask> Cell: (row) => {
<mask> const clientIP = row.original.ip;
<mask> const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
<mask>
</s> - client: sort clients table by requests count by default </s> remove const { name } = row.original;
const clientStats = this.getStats(name, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove accessor: 'statistics',
</s> add id: 'statistics',
accessor: row => this.props.normalizedTopClients[row.name] || 0,
sortMethod: (a, b) => b - a, </s> remove getStats = (ip, stats) => {
if (stats) {
const statsForCurrentIP = stats.find(item => item.name === ip);
return statsForCurrentIP && statsForCurrentIP.count;
}
return '';
};
</s> add </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
</s> remove getStats = (name, stats) => {
if (stats) {
const currentStats = stats.find(item => item.info && item.info.name === name);
return currentStats && currentStats.count;
}
return '';
};
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/components/Settings/Clients/AutoClients.js
|
keep keep add keep keep keep keep
|
<mask> <ReactTable
<mask> data={autoClients || []}
<mask> columns={this.columns}
<mask> className="-striped -highlight card-table-overflow"
<mask> showPagination={true}
<mask> defaultPageSize={10}
<mask> minRows={5}
</s> - client: sort clients table by requests count by default </s> add defaultSorted={[
{
id: 'statistics',
asc: true,
},
]} </s> remove accessor: 'statistics',
</s> add id: 'statistics',
accessor: row => this.props.normalizedTopClients[row.name] || 0,
sortMethod: (a, b) => b - a, </s> remove accessor: 'statistics',
</s> add accessor: row => this.props.normalizedTopClients[row.ip] || 0,
sortMethod: (a, b) => b - a,
id: 'statistics', </s> add normalizedTopClients: normalizeTopClients(topClients), </s> add import { normalizeTopClients } from '../helpers/helpers'; </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/components/Settings/Clients/AutoClients.js
|
keep keep keep keep replace keep keep keep
|
<mask>
<mask> AutoClients.propTypes = {
<mask> t: PropTypes.func.isRequired,
<mask> autoClients: PropTypes.array.isRequired,
<mask> topClients: PropTypes.array.isRequired,
<mask> };
<mask>
<mask> export default withNamespaces()(AutoClients);
</s> - client: sort clients table by requests count by default </s> remove topClients: PropTypes.array.isRequired,
</s> add normalizedTopClients: PropTypes.object.isRequired, </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
</s> remove getStats = (name, stats) => {
if (stats) {
const currentStats = stats.find(item => item.info && item.info.name === name);
return currentStats && currentStats.count;
}
return '';
};
</s> add </s> remove getStats = (ip, stats) => {
if (stats) {
const statsForCurrentIP = stats.find(item => item.name === ip);
return statsForCurrentIP && statsForCurrentIP.count;
}
return '';
};
</s> add </s> remove const { name } = row.original;
const clientStats = this.getStats(name, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove const clientIP = row.original.ip;
const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
</s> add const { value: clientStats } = row;
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/components/Settings/Clients/AutoClients.js
|
keep keep keep keep replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask> use_global_blocked_services: true,
<mask> };
<mask> };
<mask>
<mask> getStats = (name, stats) => {
<mask> if (stats) {
<mask> const currentStats = stats.find(item => item.info && item.info.name === name);
<mask> return currentStats && currentStats.count;
<mask> }
<mask>
<mask> return '';
<mask> };
<mask>
<mask> handleDelete = (data) => {
<mask> // eslint-disable-next-line no-alert
<mask> if (window.confirm(this.props.t('client_confirm_delete', { key: data.name }))) {
<mask> this.props.deleteClient(data);
<mask> }
</s> - client: sort clients table by requests count by default </s> remove getStats = (ip, stats) => {
if (stats) {
const statsForCurrentIP = stats.find(item => item.name === ip);
return statsForCurrentIP && statsForCurrentIP.count;
}
return '';
};
</s> add </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
</s> remove const clientIP = row.original.ip;
const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove const { name } = row.original;
const clientStats = this.getStats(name, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove topClients: PropTypes.array.isRequired,
</s> add normalizedTopClients: PropTypes.object.isRequired, </s> remove accessor: 'statistics',
</s> add id: 'statistics',
accessor: row => this.props.normalizedTopClients[row.name] || 0,
sortMethod: (a, b) => b - a,
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/components/Settings/Clients/ClientsTable.js
|
keep keep keep replace keep keep replace replace keep keep keep
|
<mask> },
<mask> {
<mask> Header: this.props.t('requests_count'),
<mask> accessor: 'statistics',
<mask> minWidth: 120,
<mask> Cell: (row) => {
<mask> const { name } = row.original;
<mask> const clientStats = this.getStats(name, this.props.topClients);
<mask>
<mask> if (clientStats) {
<mask> return (
</s> - client: sort clients table by requests count by default </s> remove const clientIP = row.original.ip;
const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove accessor: 'statistics',
</s> add accessor: row => this.props.normalizedTopClients[row.ip] || 0,
sortMethod: (a, b) => b - a,
id: 'statistics', </s> remove getStats = (ip, stats) => {
if (stats) {
const statsForCurrentIP = stats.find(item => item.name === ip);
return statsForCurrentIP && statsForCurrentIP.count;
}
return '';
};
</s> add </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
</s> remove getStats = (name, stats) => {
if (stats) {
const currentStats = stats.find(item => item.info && item.info.name === name);
return currentStats && currentStats.count;
}
return '';
};
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/components/Settings/Clients/ClientsTable.js
|
keep add keep keep keep keep
|
<mask> data={clients || []}
<mask> columns={this.columns}
<mask> className="-striped -highlight card-table-overflow"
<mask> showPagination={true}
<mask> defaultPageSize={10}
<mask> minRows={5}
</s> - client: sort clients table by requests count by default </s> add defaultSorted={[
{
id: 'statistics',
asc: true,
},
]} </s> remove accessor: 'statistics',
</s> add id: 'statistics',
accessor: row => this.props.normalizedTopClients[row.name] || 0,
sortMethod: (a, b) => b - a, </s> remove accessor: 'statistics',
</s> add accessor: row => this.props.normalizedTopClients[row.ip] || 0,
sortMethod: (a, b) => b - a,
id: 'statistics', </s> add normalizedTopClients: normalizeTopClients(topClients), </s> add import { normalizeTopClients } from '../helpers/helpers'; </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/components/Settings/Clients/ClientsTable.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> ClientsTable.propTypes = {
<mask> t: PropTypes.func.isRequired,
<mask> clients: PropTypes.array.isRequired,
<mask> topClients: PropTypes.array.isRequired,
<mask> toggleClientModal: PropTypes.func.isRequired,
<mask> deleteClient: PropTypes.func.isRequired,
<mask> addClient: PropTypes.func.isRequired,
<mask> updateClient: PropTypes.func.isRequired,
<mask> isModalOpen: PropTypes.bool.isRequired,
</s> - client: sort clients table by requests count by default </s> remove topClients: PropTypes.array.isRequired,
</s> add normalizedTopClients: PropTypes.object.isRequired, </s> remove getStats = (ip, stats) => {
if (stats) {
const statsForCurrentIP = stats.find(item => item.name === ip);
return statsForCurrentIP && statsForCurrentIP.count;
}
return '';
};
</s> add </s> remove const { name } = row.original;
const clientStats = this.getStats(name, this.props.topClients);
</s> add const { value: clientStats } = row; </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
</s> remove getStats = (name, stats) => {
if (stats) {
const currentStats = stats.find(item => item.info && item.info.name === name);
return currentStats && currentStats.count;
}
return '';
};
</s> add </s> remove const clientIP = row.original.ip;
const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
</s> add const { value: clientStats } = row;
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/components/Settings/Clients/ClientsTable.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> {!stats.processingStats && !dashboard.processingClients && (
<mask> <Fragment>
<mask> <ClientsTable
<mask> clients={dashboard.clients}
<mask> topClients={stats.topClients}
<mask> isModalOpen={clients.isModalOpen}
<mask> modalClientName={clients.modalClientName}
<mask> modalType={clients.modalType}
<mask> addClient={addClient}
<mask> updateClient={updateClient}
</s> - client: sort clients table by requests count by default </s> remove topClients={stats.topClients}
</s> add normalizedTopClients={stats.normalizedTopClients} </s> remove const clientIP = row.original.ip;
const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove const { name } = row.original;
const clientStats = this.getStats(name, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove getStats = (name, stats) => {
if (stats) {
const currentStats = stats.find(item => item.info && item.info.name === name);
return currentStats && currentStats.count;
}
return '';
};
</s> add </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
</s> remove accessor: 'statistics',
</s> add accessor: row => this.props.normalizedTopClients[row.ip] || 0,
sortMethod: (a, b) => b - a,
id: 'statistics',
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/components/Settings/Clients/index.js
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> processingUpdating={clients.processingUpdating}
<mask> />
<mask> <AutoClients
<mask> autoClients={dashboard.autoClients}
<mask> topClients={stats.topClients}
<mask> />
<mask> </Fragment>
<mask> )}
<mask> </Fragment>
<mask> );
</s> - client: sort clients table by requests count by default </s> remove topClients={stats.topClients}
</s> add normalizedTopClients={stats.normalizedTopClients} </s> add normalizedTopClients: normalizeTopClients(topClients), </s> add import { normalizeTopClients } from '../helpers/helpers'; </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
</s> remove topClients: PropTypes.array.isRequired,
</s> add normalizedTopClients: PropTypes.object.isRequired, </s> add defaultSorted={[
{
id: 'statistics',
asc: true,
},
]}
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/components/Settings/Clients/index.js
|
keep keep add keep keep keep keep keep keep
|
<mask>
<mask> export const normalizeTextarea = text => text && text.replace(/[;, ]/g, '\n').split('\n').filter(n => n);
<mask>
<mask> export const getClientInfo = (clients, ip) => {
<mask> const client = clients
<mask> .find(item => item.ip_addrs && item.ip_addrs.find(clientIp => clientIp === ip));
<mask>
<mask> if (!client) {
<mask> return '';
</s> - client: sort clients table by requests count by default </s> remove getStats = (ip, stats) => {
if (stats) {
const statsForCurrentIP = stats.find(item => item.name === ip);
return statsForCurrentIP && statsForCurrentIP.count;
}
return '';
};
</s> add </s> remove getStats = (name, stats) => {
if (stats) {
const currentStats = stats.find(item => item.info && item.info.name === name);
return currentStats && currentStats.count;
}
return '';
};
</s> add </s> remove const clientIP = row.original.ip;
const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove const { name } = row.original;
const clientStats = this.getStats(name, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove topClients: PropTypes.array.isRequired,
</s> add normalizedTopClients: PropTypes.object.isRequired, </s> remove accessor: 'statistics',
</s> add accessor: row => this.props.normalizedTopClients[row.ip] || 0,
sortMethod: (a, b) => b - a,
id: 'statistics',
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/helpers/helpers.js
|
add keep keep keep keep keep keep
|
<mask> import { handleActions } from 'redux-actions';
<mask>
<mask> import * as actions from '../actions/stats';
<mask>
<mask> const defaultStats = {
<mask> dnsQueries: [],
<mask> blockedFiltering: [],
</s> - client: sort clients table by requests count by default </s> remove const { name } = row.original;
const clientStats = this.getStats(name, this.props.topClients);
</s> add const { value: clientStats } = row; </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
</s> remove const clientIP = row.original.ip;
const clientStats = clientIP && this.getStats(clientIP, this.props.topClients);
</s> add const { value: clientStats } = row; </s> remove getStats = (ip, stats) => {
if (stats) {
const statsForCurrentIP = stats.find(item => item.name === ip);
return statsForCurrentIP && statsForCurrentIP.count;
}
return '';
};
</s> add </s> remove getStats = (name, stats) => {
if (stats) {
const currentStats = stats.find(item => item.info && item.info.name === name);
return currentStats && currentStats.count;
}
return '';
};
</s> add </s> remove accessor: 'statistics',
</s> add id: 'statistics',
accessor: row => this.props.normalizedTopClients[row.name] || 0,
sortMethod: (a, b) => b - a,
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/reducers/stats.js
|
keep add keep keep keep keep
|
<mask> topBlockedDomains,
<mask> topClients,
<mask> topQueriedDomains,
<mask> numBlockedFiltering,
<mask> numDnsQueries,
<mask> numReplacedParental,
</s> - client: sort clients table by requests count by default </s> add import { normalizeTopClients } from '../helpers/helpers'; </s> add export const normalizeTopClients = clients => clients.reduce((accumulator, clientObj) => {
const { name, count } = clientObj;
const idToCountMap = accumulator;
idToCountMap[name] = count;
return idToCountMap;
}, {});
</s> remove topClients={stats.topClients}
</s> add normalizedTopClients={stats.normalizedTopClients} </s> remove topClients={stats.topClients}
</s> add normalizedTopClients={stats.normalizedTopClients} </s> remove topClients: PropTypes.array.isRequired,
</s> add normalizedTopClients: PropTypes.object.isRequired, </s> add defaultSorted={[
{
id: 'statistics',
asc: true,
},
]}
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c031c1c6eb765ad4d32da6d4744cecfdc19a41
|
client/src/reducers/stats.js
|
keep keep keep keep replace keep keep replace keep keep keep keep
|
<mask> func New(c *Config, filters map[int]string) *Dnsfilter {
<mask>
<mask> if c != nil {
<mask> // initialize objects only once
<mask> if c.SafeBrowsingEnabled && gctx.safebrowsingCache == nil {
<mask> gctx.safebrowsingCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build()
<mask> }
<mask> if c.SafeSearchEnabled && gctx.safeSearchCache == nil {
<mask> gctx.safeSearchCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build()
<mask> }
<mask> if c.ParentalEnabled && gctx.parentalCache == nil {
<mask> gctx.parentalCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build()
</s> - dnsfilter: fix crash when global setting 'SafeSearch' is off
but per-client setting is on </s> remove if c.ParentalEnabled && gctx.parentalCache == nil {
</s> add if gctx.parentalCache == nil {
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c510631e44d8a36a7fb086b23143b36110a956
|
dnsfilter/dnsfilter.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> }
<mask> if c.SafeSearchEnabled && gctx.safeSearchCache == nil {
<mask> gctx.safeSearchCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build()
<mask> }
<mask> if c.ParentalEnabled && gctx.parentalCache == nil {
<mask> gctx.parentalCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build()
<mask> }
<mask> if len(c.ResolverAddress) != 0 && gctx.dialCache == nil {
<mask> gctx.dialCache = gcache.New(maxDialCacheSize).LRU().Expiration(defaultCacheTime).Build()
<mask> }
</s> - dnsfilter: fix crash when global setting 'SafeSearch' is off
but per-client setting is on </s> remove if c.SafeBrowsingEnabled && gctx.safebrowsingCache == nil {
</s> add if gctx.safebrowsingCache == nil { </s> remove if c.SafeSearchEnabled && gctx.safeSearchCache == nil {
</s> add if gctx.safeSearchCache == nil {
|
https://github.com/AdguardTeam/AdGuardHome/commit/57c510631e44d8a36a7fb086b23143b36110a956
|
dnsfilter/dnsfilter.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> go 1.19
<mask>
<mask> require (
<mask> github.com/AdguardTeam/dnsproxy v0.48.3
<mask> github.com/AdguardTeam/golibs v0.13.2
<mask> github.com/AdguardTeam/urlfilter v0.16.1
<mask> github.com/NYTimes/gziphandler v1.1.1
<mask> github.com/ameshkov/dnscrypt/v2 v2.2.7
<mask> github.com/digineo/go-ipset/v2 v2.2.1
</s> Pull request 1835: bootstrap-plain
Merge in DNS/adguard-home from bootstrap-plain to master
Updates AdguardTeam/dnsproxy#324.
Squashed commit of the following:
commit bd5d569dc26154985857977e81650eb0a51559a5
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:41:53 2023 +0300
querylog: rm proxyutil dep
commit 9db4053555e06eba264f7d3e6c75c747f8d73b56
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:34:29 2023 +0300
all: upd proxy </s> remove github.com/AdguardTeam/dnsproxy v0.48.3 h1:h9xgDSmd1MqsPFNApyaPVXolmSTtzOWOcfWvPeDEP6s=
github.com/AdguardTeam/dnsproxy v0.48.3/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw=
</s> add github.com/AdguardTeam/dnsproxy v0.49.1 h1:JpStBK05uCgA3ldleaNLRmIwE9V7vRg7/kVJQSdnQYg=
github.com/AdguardTeam/dnsproxy v0.49.1/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw= </s> remove ip := proxyutil.IPFromRR(msg.Answer[0]).To16()
assert.Equal(t, answer, ip)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, msg.Answer[0])
assert.Equal(t, answer, a.A.To16()) </s> remove "github.com/AdguardTeam/dnsproxy/proxyutil"
</s> add </s> remove assert.True(t, strings.HasSuffix(s, tc.want),
"got %q", s)
</s> add assert.True(t, strings.HasSuffix(s, tc.want), "got %q", s) </s> remove wantSet: `checking bootstrap a: invalid address: ` +
`Resolver a is not eligible to be a bootstrap DNS server`,
</s> add wantSet: `checking bootstrap a: invalid address: bootstrap a:53: ` +
`ParseAddr("a"): unable to parse IP`,
|
https://github.com/AdguardTeam/AdGuardHome/commit/584182e2649fb3617fb423d7838592608ab8612d
|
go.mod
|
replace replace keep keep keep keep keep
|
<mask> github.com/AdguardTeam/dnsproxy v0.48.3 h1:h9xgDSmd1MqsPFNApyaPVXolmSTtzOWOcfWvPeDEP6s=
<mask> github.com/AdguardTeam/dnsproxy v0.48.3/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw=
<mask> github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
<mask> github.com/AdguardTeam/golibs v0.10.4/go.mod h1:rSfQRGHIdgfxriDDNgNJ7HmE5zRoURq8R+VdR81Zuzw=
<mask> github.com/AdguardTeam/golibs v0.13.2 h1:BPASsyQKmb+b8VnvsNOHp7bKfcZl9Z+Z2UhPjOiupSc=
<mask> github.com/AdguardTeam/golibs v0.13.2/go.mod h1:7ylQLv2Lqsc3UW3jHoITynYk6Y1tYtgEMkR09ppfsN8=
<mask> github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU=
</s> Pull request 1835: bootstrap-plain
Merge in DNS/adguard-home from bootstrap-plain to master
Updates AdguardTeam/dnsproxy#324.
Squashed commit of the following:
commit bd5d569dc26154985857977e81650eb0a51559a5
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:41:53 2023 +0300
querylog: rm proxyutil dep
commit 9db4053555e06eba264f7d3e6c75c747f8d73b56
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:34:29 2023 +0300
all: upd proxy </s> remove github.com/AdguardTeam/dnsproxy v0.48.3
</s> add github.com/AdguardTeam/dnsproxy v0.49.1 </s> remove ip := proxyutil.IPFromRR(msg.Answer[0]).To16()
assert.Equal(t, answer, ip)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, msg.Answer[0])
assert.Equal(t, answer, a.A.To16()) </s> remove "github.com/AdguardTeam/dnsproxy/proxyutil"
</s> add </s> remove assert.True(t, strings.HasSuffix(s, tc.want),
"got %q", s)
</s> add assert.True(t, strings.HasSuffix(s, tc.want), "got %q", s) </s> remove wantSet: `checking bootstrap a: invalid address: ` +
`Resolver a is not eligible to be a bootstrap DNS server`,
</s> add wantSet: `checking bootstrap a: invalid address: bootstrap a:53: ` +
`ParseAddr("a"): unable to parse IP`,
|
https://github.com/AdguardTeam/AdGuardHome/commit/584182e2649fb3617fb423d7838592608ab8612d
|
go.sum
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> name: "upstream_dns_bad",
<mask> wantSet: `validating upstream servers: validating upstream "!!!": not an ip:port`,
<mask> }, {
<mask> name: "bootstraps_bad",
<mask> wantSet: `checking bootstrap a: invalid address: ` +
<mask> `Resolver a is not eligible to be a bootstrap DNS server`,
<mask> }, {
<mask> name: "cache_bad_ttl",
<mask> wantSet: `cache_ttl_min must be less or equal than cache_ttl_max`,
<mask> }, {
<mask> name: "upstream_mode_bad",
</s> Pull request 1835: bootstrap-plain
Merge in DNS/adguard-home from bootstrap-plain to master
Updates AdguardTeam/dnsproxy#324.
Squashed commit of the following:
commit bd5d569dc26154985857977e81650eb0a51559a5
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:41:53 2023 +0300
querylog: rm proxyutil dep
commit 9db4053555e06eba264f7d3e6c75c747f8d73b56
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:34:29 2023 +0300
all: upd proxy </s> remove assert.True(t, strings.HasSuffix(s, tc.want),
"got %q", s)
</s> add assert.True(t, strings.HasSuffix(s, tc.want), "got %q", s) </s> remove ip := proxyutil.IPFromRR(msg.Answer[0]).To16()
assert.Equal(t, answer, ip)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, msg.Answer[0])
assert.Equal(t, answer, a.A.To16()) </s> remove "github.com/AdguardTeam/dnsproxy/proxyutil"
</s> add </s> remove github.com/AdguardTeam/dnsproxy v0.48.3 h1:h9xgDSmd1MqsPFNApyaPVXolmSTtzOWOcfWvPeDEP6s=
github.com/AdguardTeam/dnsproxy v0.48.3/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw=
</s> add github.com/AdguardTeam/dnsproxy v0.49.1 h1:JpStBK05uCgA3ldleaNLRmIwE9V7vRg7/kVJQSdnQYg=
github.com/AdguardTeam/dnsproxy v0.49.1/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw= </s> remove github.com/AdguardTeam/dnsproxy v0.48.3
</s> add github.com/AdguardTeam/dnsproxy v0.49.1
|
https://github.com/AdguardTeam/AdGuardHome/commit/584182e2649fb3617fb423d7838592608ab8612d
|
internal/dnsforward/http_test.go
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> s := logOutput.String()
<mask> if tc.want == "" {
<mask> assert.Empty(t, s)
<mask> } else {
<mask> assert.True(t, strings.HasSuffix(s, tc.want),
<mask> "got %q", s)
<mask> }
<mask>
<mask> logOutput.Reset()
<mask> })
<mask> }
</s> Pull request 1835: bootstrap-plain
Merge in DNS/adguard-home from bootstrap-plain to master
Updates AdguardTeam/dnsproxy#324.
Squashed commit of the following:
commit bd5d569dc26154985857977e81650eb0a51559a5
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:41:53 2023 +0300
querylog: rm proxyutil dep
commit 9db4053555e06eba264f7d3e6c75c747f8d73b56
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:34:29 2023 +0300
all: upd proxy </s> remove ip := proxyutil.IPFromRR(msg.Answer[0]).To16()
assert.Equal(t, answer, ip)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, msg.Answer[0])
assert.Equal(t, answer, a.A.To16()) </s> remove wantSet: `checking bootstrap a: invalid address: ` +
`Resolver a is not eligible to be a bootstrap DNS server`,
</s> add wantSet: `checking bootstrap a: invalid address: bootstrap a:53: ` +
`ParseAddr("a"): unable to parse IP`, </s> remove "github.com/AdguardTeam/dnsproxy/proxyutil"
</s> add </s> remove github.com/AdguardTeam/dnsproxy v0.48.3 h1:h9xgDSmd1MqsPFNApyaPVXolmSTtzOWOcfWvPeDEP6s=
github.com/AdguardTeam/dnsproxy v0.48.3/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw=
</s> add github.com/AdguardTeam/dnsproxy v0.49.1 h1:JpStBK05uCgA3ldleaNLRmIwE9V7vRg7/kVJQSdnQYg=
github.com/AdguardTeam/dnsproxy v0.49.1/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw= </s> remove github.com/AdguardTeam/dnsproxy v0.48.3
</s> add github.com/AdguardTeam/dnsproxy v0.49.1
|
https://github.com/AdguardTeam/AdGuardHome/commit/584182e2649fb3617fb423d7838592608ab8612d
|
internal/querylog/decode_test.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "net"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering"
<mask> "github.com/AdguardTeam/dnsproxy/proxyutil"
<mask> "github.com/AdguardTeam/golibs/stringutil"
<mask> "github.com/AdguardTeam/golibs/testutil"
<mask> "github.com/AdguardTeam/golibs/timeutil"
<mask> "github.com/miekg/dns"
<mask> "github.com/stretchr/testify/assert"
</s> Pull request 1835: bootstrap-plain
Merge in DNS/adguard-home from bootstrap-plain to master
Updates AdguardTeam/dnsproxy#324.
Squashed commit of the following:
commit bd5d569dc26154985857977e81650eb0a51559a5
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:41:53 2023 +0300
querylog: rm proxyutil dep
commit 9db4053555e06eba264f7d3e6c75c747f8d73b56
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:34:29 2023 +0300
all: upd proxy </s> remove ip := proxyutil.IPFromRR(msg.Answer[0]).To16()
assert.Equal(t, answer, ip)
</s> add a := testutil.RequireTypeAssert[*dns.A](t, msg.Answer[0])
assert.Equal(t, answer, a.A.To16()) </s> remove assert.True(t, strings.HasSuffix(s, tc.want),
"got %q", s)
</s> add assert.True(t, strings.HasSuffix(s, tc.want), "got %q", s) </s> remove wantSet: `checking bootstrap a: invalid address: ` +
`Resolver a is not eligible to be a bootstrap DNS server`,
</s> add wantSet: `checking bootstrap a: invalid address: bootstrap a:53: ` +
`ParseAddr("a"): unable to parse IP`, </s> remove github.com/AdguardTeam/dnsproxy v0.48.3 h1:h9xgDSmd1MqsPFNApyaPVXolmSTtzOWOcfWvPeDEP6s=
github.com/AdguardTeam/dnsproxy v0.48.3/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw=
</s> add github.com/AdguardTeam/dnsproxy v0.49.1 h1:JpStBK05uCgA3ldleaNLRmIwE9V7vRg7/kVJQSdnQYg=
github.com/AdguardTeam/dnsproxy v0.49.1/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw= </s> remove github.com/AdguardTeam/dnsproxy v0.48.3
</s> add github.com/AdguardTeam/dnsproxy v0.49.1
|
https://github.com/AdguardTeam/AdGuardHome/commit/584182e2649fb3617fb423d7838592608ab8612d
|
internal/querylog/qlog_test.go
|
keep keep keep keep replace replace keep
|
<mask> msg := &dns.Msg{}
<mask> require.NoError(t, msg.Unpack(entry.Answer))
<mask> require.Len(t, msg.Answer, 1)
<mask>
<mask> ip := proxyutil.IPFromRR(msg.Answer[0]).To16()
<mask> assert.Equal(t, answer, ip)
<mask> }
</s> Pull request 1835: bootstrap-plain
Merge in DNS/adguard-home from bootstrap-plain to master
Updates AdguardTeam/dnsproxy#324.
Squashed commit of the following:
commit bd5d569dc26154985857977e81650eb0a51559a5
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:41:53 2023 +0300
querylog: rm proxyutil dep
commit 9db4053555e06eba264f7d3e6c75c747f8d73b56
Author: Eugene Burkov <[email protected]>
Date: Tue Apr 18 17:34:29 2023 +0300
all: upd proxy </s> remove assert.True(t, strings.HasSuffix(s, tc.want),
"got %q", s)
</s> add assert.True(t, strings.HasSuffix(s, tc.want), "got %q", s) </s> remove "github.com/AdguardTeam/dnsproxy/proxyutil"
</s> add </s> remove wantSet: `checking bootstrap a: invalid address: ` +
`Resolver a is not eligible to be a bootstrap DNS server`,
</s> add wantSet: `checking bootstrap a: invalid address: bootstrap a:53: ` +
`ParseAddr("a"): unable to parse IP`, </s> remove github.com/AdguardTeam/dnsproxy v0.48.3 h1:h9xgDSmd1MqsPFNApyaPVXolmSTtzOWOcfWvPeDEP6s=
github.com/AdguardTeam/dnsproxy v0.48.3/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw=
</s> add github.com/AdguardTeam/dnsproxy v0.49.1 h1:JpStBK05uCgA3ldleaNLRmIwE9V7vRg7/kVJQSdnQYg=
github.com/AdguardTeam/dnsproxy v0.49.1/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw= </s> remove github.com/AdguardTeam/dnsproxy v0.48.3
</s> add github.com/AdguardTeam/dnsproxy v0.49.1
|
https://github.com/AdguardTeam/AdGuardHome/commit/584182e2649fb3617fb423d7838592608ab8612d
|
internal/querylog/qlog_test.go
|
keep keep keep add keep keep keep keep keep
|
<mask> err = parseConfig()
<mask> if err != nil {
<mask> log.Fatal(err)
<mask> }
<mask> if bindHost != nil {
<mask> config.BindHost = *bindHost
<mask> }
<mask> if bindPort != nil {
<mask> config.BindPort = *bindPort
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> add // Saving it to the filters dir now
err = filter.save()
if err != nil {
log.Fatal(err)
} </s> remove err = writeFileSafe(corefile, []byte(configtext))
</s> add err = writeFileSafe(coreFile, []byte(configText)) </s> remove err = writeFileSafe(configfile, yamlText)
</s> add err = writeFileSafe(configFile, yamlText) </s> add // Saving it to the filters dir now
err = filter.save()
if err != nil {
log.Printf("Failed to save the updated filter %d: %s", filter.ID, err)
continue
}
</s> remove jsonentry["status"] = status.String()
</s> add jsonEntry["status"] = status.String() </s> remove data = append(data, jsonentry)
</s> add data = append(data, jsonEntry)
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
app.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> }
<mask>
<mask> address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
<mask>
<mask> runFilterRefreshers()
<mask>
<mask> http.Handle("/", optionalAuthHandler(http.FileServer(box)))
<mask> registerControlHandlers()
<mask>
<mask> err = startDNSServer()
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove data = append(data, jsonentry)
</s> add data = append(data, jsonEntry) </s> remove if force != "" {
config.Lock()
for i := range config.Filters {
filter := &config.Filters[i] // otherwise we will be operating on a copy
filter.LastUpdated = time.Unix(0, 0)
}
config.Unlock() // not defer because refreshFiltersIfNeccessary locks it too
}
updated := refreshFiltersIfNeccessary()
</s> add updated := checkFiltersUpdates(force != "") </s> add // Saving it to the filters dir now
err = filter.save()
if err != nil {
log.Fatal(err)
} </s> remove for range time.Tick(time.Second) {
refreshFiltersIfNeccessary()
</s> add for range time.Tick(time.Minute) {
checkFiltersUpdates(false) </s> remove func runFilterRefreshers() {
</s> add // Sets up a timer that will be checking for filters updates periodically
func runFiltersUpdatesTimer() { </s> remove yamlFile, err := ioutil.ReadFile(configfile)
</s> add yamlFile, err := ioutil.ReadFile(configFile)
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
app.go
|
keep keep keep add keep keep keep keep keep
|
<mask> _, err := filter.update(true)
<mask> if err != nil {
<mask> log.Fatal(err)
<mask> }
<mask> }
<mask>
<mask> // No more "dnsfilter.txt", filters are now loaded from config.ourDataDir/filters/
<mask> dnsFilterPath := filepath.Join(config.ourBinaryDir, "dnsfilter.txt")
<mask> _, err := os.Stat(dnsFilterPath)
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configfile)
if _, err := os.Stat(configfile); os.IsNotExist(err) {
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configFile)
if _, err := os.Stat(configFile); os.IsNotExist(err) { </s> add // Loads configuration from the YAML file </s> remove hosts := []string{}
</s> add hosts := make([]string, 0) </s> remove log.Printf("YAML file doesn't exist, skipping: %s", configfile)
</s> add log.Printf("YAML file doesn't exist, skipping: %s", configFile) </s> add // Set necessary properties
filter.ID = NextFilterId
filter.Enabled = true
NextFilterId++
// Download the filter contents </s> remove corefile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", corefile)
configtext, err := generateCoreDNSConfigText()
</s> add coreFile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", coreFile)
configText, err := generateCoreDNSConfigText()
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
app.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> export const normalizeFilteringStatus = (filteringStatus) => {
<mask> const { enabled, filters, user_rules: userRules } = filteringStatus;
<mask> const newFilters = filters ? filters.map((filter) => {
<mask> const {
<mask> url, enabled, last_updated: lastUpdated = Date.now(), name = 'Default name', rules_count: rulesCount = 0,
<mask> } = filter;
<mask>
<mask> return {
<mask> url, enabled, lastUpdated: formatTime(lastUpdated), name, rulesCount,
<mask> };
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove coredns_plugin "github.com/AdguardTeam/AdGuardHome/coredns_plugin"
</s> add coreDnsPlugin "github.com/AdguardTeam/AdGuardHome/coredns_plugin" </s> remove var filterTitle = regexp.MustCompile(`^! Title: +(.*)$`)
</s> add var filterTitleRegexp = regexp.MustCompile(`^! Title: +(.*)$`) </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile))
filter.contents = filterFile
</s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents))
filter.contents = filterFileContents
// Now extract the rules count
rulesCount, _ := parseFilterContents(filter.contents)
filter.RulesCount = rulesCount
</s> remove jsonentry["status"] = status.String()
</s> add jsonEntry["status"] = status.String() </s> remove jsonentry["rule"] = entry.Result.Rule
</s> add jsonEntry["rule"] = entry.Result.Rule
jsonEntry["filterId"] = entry.Result.FilterID </s> remove // Saving it to the filters dir now
err = filter.save()
if err != nil {
return false, nil
}
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
client/src/helpers/helpers.js
|
keep keep keep add keep keep keep keep keep keep
|
<mask>
<mask> // Directory where we'll store all downloaded filters contents
<mask> const FiltersDir = "filters"
<mask>
<mask> // configuration is loaded from YAML
<mask> type configuration struct {
<mask> // Config filename (can be overriden via the command line arguments)
<mask> ourConfigFilename string
<mask> // Basically, this is our working directory
<mask> ourBinaryDir string
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> add // Config filename (can be overriden via the command line arguments) </s> remove ourBinaryDir string
</s> add // Basically, this is our working directory
ourBinaryDir string </s> remove ID int `json:"ID"` // auto-assigned when filter is added
</s> add ID int `json:"id" yaml:"id"` // auto-assigned when filter is added (see NextFilterId) </s> remove LastUpdated time.Time `json:"last_updated" yaml:"-"`
</s> add LastUpdated time.Time `json:"lastUpdated" yaml:"last_updated"` </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile))
filter.contents = filterFile
</s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents))
filter.contents = filterFileContents
// Now extract the rules count
rulesCount, _ := parseFilterContents(filter.contents)
filter.RulesCount = rulesCount
</s> add // Loads configuration from the YAML file
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep add keep keep keep keep keep
|
<mask> var NextFilterId int
<mask>
<mask> // configuration is loaded from YAML
<mask> type configuration struct {
<mask> ourConfigFilename string
<mask> // Basically, this is our working directory
<mask> ourBinaryDir string
<mask> // Directory to store data (i.e. filters contents)
<mask> ourDataDir string
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove ourBinaryDir string
</s> add // Basically, this is our working directory
ourBinaryDir string </s> add // Just a counter that we use for incrementing the filter ID
var NextFilterId int
</s> remove ID int `json:"ID"` // auto-assigned when filter is added
</s> add ID int `json:"id" yaml:"id"` // auto-assigned when filter is added (see NextFilterId) </s> remove RulesCount int `json:"rules_count" yaml:"-"`
</s> add RulesCount int `json:"rulesCount" yaml:"-"` </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile))
filter.contents = filterFile
</s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents))
filter.contents = filterFileContents
// Now extract the rules count
rulesCount, _ := parseFilterContents(filter.contents)
filter.RulesCount = rulesCount
</s> add // Loads configuration from the YAML file
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> // configuration is loaded from YAML
<mask> type configuration struct {
<mask> ourConfigFilename string
<mask> ourBinaryDir string
<mask> // Directory to store data (i.e. filters contents)
<mask> ourDataDir string
<mask>
<mask> // Schema version of the config file. This value is used when performing the app updates.
<mask> SchemaVersion int `yaml:"schema_version"`
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> add // Config filename (can be overriden via the command line arguments) </s> add // Just a counter that we use for incrementing the filter ID
var NextFilterId int
</s> remove ID int `json:"ID"` // auto-assigned when filter is added
</s> add ID int `json:"id" yaml:"id"` // auto-assigned when filter is added (see NextFilterId) </s> remove RulesCount int `json:"rules_count" yaml:"-"`
</s> add RulesCount int `json:"rulesCount" yaml:"-"` </s> remove func refreshFiltersIfNeccessary() int {
</s> add // Checks filters updates if necessary
// If force is true, it ignores the filter.LastUpdated field value
func checkFiltersUpdates(force bool) int { </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile))
filter.contents = filterFile
</s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents))
filter.contents = filterFileContents
// Now extract the rules count
rulesCount, _ := parseFilterContents(filter.contents)
filter.RulesCount = rulesCount
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep replace keep keep keep replace keep
|
<mask>
<mask> type filter struct {
<mask> ID int `json:"ID"` // auto-assigned when filter is added
<mask> URL string `json:"url"`
<mask> Name string `json:"name" yaml:"name"`
<mask> Enabled bool `json:"enabled"`
<mask> RulesCount int `json:"rules_count" yaml:"-"`
<mask> contents []byte
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove LastUpdated time.Time `json:"last_updated" yaml:"-"`
</s> add LastUpdated time.Time `json:"lastUpdated" yaml:"last_updated"` </s> remove ourBinaryDir string
</s> add // Basically, this is our working directory
ourBinaryDir string </s> add // Just a counter that we use for incrementing the filter ID
var NextFilterId int
</s> add // Config filename (can be overriden via the command line arguments) </s> remove queryLogTime time.Time
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> Name string `json:"name" yaml:"name"`
<mask> Enabled bool `json:"enabled"`
<mask> RulesCount int `json:"rules_count" yaml:"-"`
<mask> contents []byte
<mask> LastUpdated time.Time `json:"last_updated" yaml:"-"`
<mask> }
<mask>
<mask> var defaultDNS = []string{"tls://1.1.1.1", "tls://1.0.0.1"}
<mask>
<mask> // initialize to default values, will be changed later when reading config or parsing command line
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove RulesCount int `json:"rules_count" yaml:"-"`
</s> add RulesCount int `json:"rulesCount" yaml:"-"` </s> remove ID int `json:"ID"` // auto-assigned when filter is added
</s> add ID int `json:"id" yaml:"id"` // auto-assigned when filter is added (see NextFilterId) </s> add // Config filename (can be overriden via the command line arguments) </s> add // Just a counter that we use for incrementing the filter ID
var NextFilterId int
</s> remove contents := []byte{}
</s> add var contents []byte </s> remove var filterTitle = regexp.MustCompile(`^! Title: +(.*)$`)
</s> add var filterTitleRegexp = regexp.MustCompile(`^! Title: +(.*)$`)
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> // Creates a helper object for working with the user rules
<mask> func getUserFilter() filter {
<mask>
<mask> // TODO: This should be calculated when UserRules are set
<mask> contents := []byte{}
<mask> for _, rule := range config.UserRules {
<mask> contents = append(contents, []byte(rule)...)
<mask> contents = append(contents, '\n')
<mask> }
<mask>
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove // deduplicate
// TODO: move it somewhere else
{
i := 0 // output index, used for deletion later
urls := map[string]bool{}
for _, filter := range config.Filters {
if _, ok := urls[filter.URL]; !ok {
// we didn't see it before, keep it
urls[filter.URL] = true // remember the URL
config.Filters[i] = filter
i++
}
}
// all entries we want to keep are at front, delete the rest
config.Filters = config.Filters[:i]
}
</s> add </s> add // Saves configuration to the YAML file and also saves the user filter contents to a file </s> add // Just a counter that we use for incrementing the filter ID
var NextFilterId int
</s> remove lines := strings.Split(string(body), "\n")
rulesCount := 0
seenTitle := false
</s> add rulesCount, filterName := parseFilterContents(body) </s> remove func runFilterRefreshers() {
</s> add // Sets up a timer that will be checking for filters updates periodically
func runFiltersUpdatesTimer() { </s> remove log.Printf("Filter %d length is %d", filter.ID, len(filterFile))
filter.contents = filterFile
</s> add log.Printf("Filter %d length is %d", filter.ID, len(filterFileContents))
filter.contents = filterFileContents
// Now extract the rules count
rulesCount, _ := parseFilterContents(filter.contents)
filter.RulesCount = rulesCount
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep add keep keep keep keep
|
<mask>
<mask> return userFilter
<mask> }
<mask>
<mask> func parseConfig() error {
<mask> configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
<mask> log.Printf("Reading YAML file: %s", configFile)
<mask> if _, err := os.Stat(configFile); os.IsNotExist(err) {
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configfile)
if _, err := os.Stat(configfile); os.IsNotExist(err) {
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configFile)
if _, err := os.Stat(configFile); os.IsNotExist(err) { </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configfile)
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configFile) </s> remove log.Printf("YAML file doesn't exist, skipping: %s", configfile)
</s> add log.Printf("YAML file doesn't exist, skipping: %s", configFile) </s> add // Saves configuration to the YAML file and also saves the user filter contents to a file </s> remove corefile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", corefile)
configtext, err := generateCoreDNSConfigText()
</s> add coreFile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", coreFile)
configText, err := generateCoreDNSConfigText() </s> add // Saving it to the filters dir now
err = filter.save()
if err != nil {
log.Fatal(err)
}
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep replace replace replace keep replace keep keep
|
<mask>
<mask> func parseConfig() error {
<mask> configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
<mask> log.Printf("Reading YAML file: %s", configfile)
<mask> if _, err := os.Stat(configfile); os.IsNotExist(err) {
<mask> // do nothing, file doesn't exist
<mask> log.Printf("YAML file doesn't exist, skipping: %s", configfile)
<mask> return nil
<mask> }
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove yamlFile, err := ioutil.ReadFile(configfile)
</s> add yamlFile, err := ioutil.ReadFile(configFile) </s> add // Loads configuration from the YAML file </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configfile)
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configFile) </s> remove filterFile, err := ioutil.ReadFile(filterFilePath)
</s> add filterFileContents, err := ioutil.ReadFile(filterFilePath) </s> add // Saves configuration to the YAML file and also saves the user filter contents to a file
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> // do nothing, file doesn't exist
<mask> log.Printf("YAML file doesn't exist, skipping: %s", configfile)
<mask> return nil
<mask> }
<mask> yamlFile, err := ioutil.ReadFile(configfile)
<mask> if err != nil {
<mask> log.Printf("Couldn't read config file: %s", err)
<mask> return err
<mask> }
<mask> err = yaml.Unmarshal(yamlFile, &config)
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove log.Printf("YAML file doesn't exist, skipping: %s", configfile)
</s> add log.Printf("YAML file doesn't exist, skipping: %s", configFile) </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configfile)
if _, err := os.Stat(configfile); os.IsNotExist(err) {
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configFile)
if _, err := os.Stat(configFile); os.IsNotExist(err) { </s> remove filterFile, err := ioutil.ReadFile(filterFilePath)
</s> add filterFileContents, err := ioutil.ReadFile(filterFilePath) </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configfile)
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configFile) </s> remove err = writeFileSafe(configfile, yamlText)
</s> add err = writeFileSafe(configFile, yamlText) </s> remove err = writeFileSafe(corefile, []byte(configtext))
</s> add err = writeFileSafe(coreFile, []byte(configText))
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep add keep keep keep keep
|
<mask> return nil
<mask> }
<mask>
<mask> func writeConfig() error {
<mask> configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
<mask> log.Printf("Writing YAML file: %s", configFile)
<mask> yamlText, err := yaml.Marshal(&config)
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configfile)
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configFile) </s> add // Loads configuration from the YAML file </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configfile)
if _, err := os.Stat(configfile); os.IsNotExist(err) {
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configFile)
if _, err := os.Stat(configFile); os.IsNotExist(err) { </s> remove log.Printf("YAML file doesn't exist, skipping: %s", configfile)
</s> add log.Printf("YAML file doesn't exist, skipping: %s", configFile) </s> remove corefile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", corefile)
configtext, err := generateCoreDNSConfigText()
</s> add coreFile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", coreFile)
configText, err := generateCoreDNSConfigText() </s> remove err = writeFileSafe(configfile, yamlText)
</s> add err = writeFileSafe(configFile, yamlText)
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> return nil
<mask> }
<mask>
<mask> func writeConfig() error {
<mask> configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
<mask> log.Printf("Writing YAML file: %s", configfile)
<mask> yamlText, err := yaml.Marshal(&config)
<mask> if err != nil {
<mask> log.Printf("Couldn't generate YAML file: %s", err)
<mask> return err
<mask> }
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> add // Saves configuration to the YAML file and also saves the user filter contents to a file </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configfile)
if _, err := os.Stat(configfile); os.IsNotExist(err) {
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configFile)
if _, err := os.Stat(configFile); os.IsNotExist(err) { </s> remove log.Printf("YAML file doesn't exist, skipping: %s", configfile)
</s> add log.Printf("YAML file doesn't exist, skipping: %s", configFile) </s> remove err = writeFileSafe(configfile, yamlText)
</s> add err = writeFileSafe(configFile, yamlText) </s> add // Loads configuration from the YAML file </s> remove corefile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", corefile)
configtext, err := generateCoreDNSConfigText()
</s> add coreFile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", coreFile)
configText, err := generateCoreDNSConfigText()
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> if err != nil {
<mask> log.Printf("Couldn't generate YAML file: %s", err)
<mask> return err
<mask> }
<mask> err = writeFileSafe(configfile, yamlText)
<mask> if err != nil {
<mask> log.Printf("Couldn't save YAML config: %s", err)
<mask> return err
<mask> }
<mask>
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove err = writeFileSafe(corefile, []byte(configtext))
</s> add err = writeFileSafe(coreFile, []byte(configText)) </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configfile)
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configFile) </s> remove configtext := configBytes.String()
</s> add configText := configBytes.String() </s> remove // generate config text
</s> add // generate CoreDNS config text </s> remove corefile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", corefile)
configtext, err := generateCoreDNSConfigText()
</s> add coreFile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", coreFile)
configText, err := generateCoreDNSConfigText() </s> remove log.Printf("YAML file doesn't exist, skipping: %s", configfile)
</s> add log.Printf("YAML file doesn't exist, skipping: %s", configFile)
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep replace replace replace keep keep keep keep replace keep keep keep keep
|
<mask> func writeCoreDNSConfig() error {
<mask> corefile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
<mask> log.Printf("Writing DNS config: %s", corefile)
<mask> configtext, err := generateCoreDNSConfigText()
<mask> if err != nil {
<mask> log.Printf("Couldn't generate DNS config: %s", err)
<mask> return err
<mask> }
<mask> err = writeFileSafe(corefile, []byte(configtext))
<mask> if err != nil {
<mask> log.Printf("Couldn't save DNS config: %s", err)
<mask> return err
<mask> }
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove configtext := configBytes.String()
</s> add configText := configBytes.String() </s> remove // generate config text
</s> add // generate CoreDNS config text </s> remove err = writeFileSafe(configfile, yamlText)
</s> add err = writeFileSafe(configFile, yamlText) </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configfile)
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configFile) </s> remove return fmt.Errorf("Couldn't communicate with DNS server %s: %s", input, err)
</s> add return fmt.Errorf("couldn't communicate with DNS server %s: %s", input, err)
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> `
<mask>
<mask> var removeEmptyLines = regexp.MustCompile("([\t ]*\n)+")
<mask>
<mask> // generate config text
<mask> func generateCoreDNSConfigText() (string, error) {
<mask> t, err := template.New("config").Parse(coreDNSConfigTemplate)
<mask> if err != nil {
<mask> log.Printf("Couldn't generate DNS config: %s", err)
<mask> return "", err
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove corefile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", corefile)
configtext, err := generateCoreDNSConfigText()
</s> add coreFile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", coreFile)
configText, err := generateCoreDNSConfigText() </s> remove configtext := configBytes.String()
</s> add configText := configBytes.String() </s> remove err = writeFileSafe(corefile, []byte(configtext))
</s> add err = writeFileSafe(coreFile, []byte(configText)) </s> remove err = writeFileSafe(configfile, yamlText)
</s> add err = writeFileSafe(configFile, yamlText) </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configfile)
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Writing YAML file: %s", configFile) </s> remove return "", fmt.Errorf("Invalid DNS server field: %s", h)
</s> add return "", fmt.Errorf("invalid DNS server field: %s", h)
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep replace keep keep replace replace
|
<mask> log.Printf("Couldn't generate DNS config: %s", err)
<mask> return "", err
<mask> }
<mask> configtext := configBytes.String()
<mask>
<mask> // remove empty lines from generated config
<mask> configtext = removeEmptyLines.ReplaceAllString(configtext, "\n")
<mask> return configtext, nil
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove // generate config text
</s> add // generate CoreDNS config text </s> remove corefile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", corefile)
configtext, err := generateCoreDNSConfigText()
</s> add coreFile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", coreFile)
configText, err := generateCoreDNSConfigText() </s> remove err = writeFileSafe(corefile, []byte(configtext))
</s> add err = writeFileSafe(coreFile, []byte(configText)) </s> remove err = writeFileSafe(configfile, yamlText)
</s> add err = writeFileSafe(configFile, yamlText) </s> remove return "", fmt.Errorf("Invalid DNS server field: %s", h)
</s> add return "", fmt.Errorf("invalid DNS server field: %s", h)
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
config.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "strconv"
<mask> "strings"
<mask> "time"
<mask>
<mask> coredns_plugin "github.com/AdguardTeam/AdGuardHome/coredns_plugin"
<mask> "github.com/miekg/dns"
<mask> "gopkg.in/asaskevich/govalidator.v4"
<mask> )
<mask>
<mask> const updatePeriod = time.Minute * 30
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove var filterTitle = regexp.MustCompile(`^! Title: +(.*)$`)
</s> add var filterTitleRegexp = regexp.MustCompile(`^! Title: +(.*)$`) </s> remove queryLogAPIPort = "8618" // 8618 is sha512sum of "querylog" then each byte summed
</s> add </s> remove url, enabled, last_updated: lastUpdated = Date.now(), name = 'Default name', rules_count: rulesCount = 0,
</s> add url, enabled, lastUpdated: lastUpdated = Date.now(), name = 'Default name', rulesCount: rulesCount = 0, </s> remove log.Printf("Downloading update for filter %d", filter.ID)
</s> add log.Printf("Downloading update for filter %d from %s", filter.ID, filter.URL) </s> remove queryLogTime time.Time
</s> add </s> add // Just a counter that we use for incrementing the filter ID
var NextFilterId int
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
control.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> )
<mask>
<mask> const updatePeriod = time.Minute * 30
<mask>
<mask> var filterTitle = regexp.MustCompile(`^! Title: +(.*)$`)
<mask>
<mask> // cached version.json to avoid hammering github.io for each page reload
<mask> var versionCheckJSON []byte
<mask> var versionCheckLastTime time.Time
<mask>
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove coredns_plugin "github.com/AdguardTeam/AdGuardHome/coredns_plugin"
</s> add coreDnsPlugin "github.com/AdguardTeam/AdGuardHome/coredns_plugin" </s> remove queryLogAPIPort = "8618" // 8618 is sha512sum of "querylog" then each byte summed
</s> add </s> remove LastUpdated time.Time `json:"last_updated" yaml:"-"`
</s> add LastUpdated time.Time `json:"lastUpdated" yaml:"last_updated"` </s> remove RulesCount int `json:"rules_count" yaml:"-"`
</s> add RulesCount int `json:"rulesCount" yaml:"-"` </s> remove contents := []byte{}
</s> add var contents []byte </s> remove queryLogTime time.Time
</s> add
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
control.go
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> // -------------------
<mask> // coredns run control
<mask> // -------------------
<mask> func tellCoreDNSToReload() {
<mask> coredns_plugin.Reload <- true
<mask> }
<mask>
<mask> func writeAllConfigsAndReloadCoreDNS() error {
<mask> err := writeAllConfigs()
<mask> if err != nil {
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove corefile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", corefile)
configtext, err := generateCoreDNSConfigText()
</s> add coreFile := filepath.Join(config.ourBinaryDir, config.CoreDNS.coreFile)
log.Printf("Writing DNS config: %s", coreFile)
configText, err := generateCoreDNSConfigText() </s> remove errortext := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
</s> add errorText := fmt.Sprintf("Couldn't write config file: %s", err)
log.Println(errorText)
http.Error(w, errorText, http.StatusInternalServerError) </s> remove return nil;
</s> add return nil </s> add // Loads configuration from the YAML file </s> remove errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
</s> add errorText := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errorText)
http.Error(w, errorText, http.StatusInternalServerError) </s> remove configfile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configfile)
if _, err := os.Stat(configfile); os.IsNotExist(err) {
</s> add configFile := filepath.Join(config.ourBinaryDir, config.ourConfigFilename)
log.Printf("Reading YAML file: %s", configFile)
if _, err := os.Stat(configFile); os.IsNotExist(err) {
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
control.go
|
keep keep add keep keep keep keep keep
|
<mask> returnOK(w, r)
<mask> }
<mask>
<mask> func returnOK(w http.ResponseWriter, r *http.Request) {
<mask> _, err := fmt.Fprintf(w, "OK\n")
<mask> if err != nil {
<mask> errortext := fmt.Sprintf("Couldn't write body: %s", err)
<mask> log.Println(errortext)
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> remove errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
</s> add errorText := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errorText)
http.Error(w, errorText, http.StatusInternalServerError) </s> remove // TODO: Start using filter ID
</s> add </s> remove // TODO: Start using filter ID
</s> add </s> remove errortext := fmt.Sprintf("Failed to read request body: %s", err)
log.Println(errortext)
http.Error(w, errortext, 400)
</s> add errorText := fmt.Sprintf("Failed to read request body: %s", err)
log.Println(errorText)
http.Error(w, errorText, 400) </s> remove // TODO: Start using filter ID
</s> add </s> remove errortext := fmt.Sprintf("failed to parse parameters from body: %s", err)
log.Println(errortext)
http.Error(w, errortext, 400)
</s> add errorText := fmt.Sprintf("failed to parse parameters from body: %s", err)
log.Println(errorText)
http.Error(w, errorText, 400)
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
control.go
|
keep keep keep add keep keep keep keep keep keep
|
<mask> http.Error(w, errortext, http.StatusInternalServerError)
<mask> }
<mask> }
<mask>
<mask> func handleStatus(w http.ResponseWriter, r *http.Request) {
<mask> data := map[string]interface{}{
<mask> "dns_address": config.BindHost,
<mask> "dns_port": config.CoreDNS.Port,
<mask> "protection_enabled": config.CoreDNS.ProtectionEnabled,
<mask> "querylog_enabled": config.CoreDNS.QueryLogEnabled,
</s> Added filterId to the querylog
Updated the openapi.yaml accordingly
Some minor refactoring/renaming
Fix other review comments </s> add //noinspection GoUnusedParameter </s> add //noinspection GoUnusedParameter </s> add //noinspection GoUnusedParameter </s> add //noinspection GoUnusedParameter </s> remove // TODO: Start using filter ID
</s> add </s> remove errortext := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errortext)
http.Error(w, errortext, http.StatusInternalServerError)
</s> add errorText := fmt.Sprintf("Couldn't write body: %s", err)
log.Println(errorText)
http.Error(w, errorText, http.StatusInternalServerError)
|
https://github.com/AdguardTeam/AdGuardHome/commit/591065aa3aeff1cdee5cba0abdc7af0ceb09f54e
|
control.go
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.