docstring_tokens stringlengths 0 76.5k | code_tokens stringlengths 75 1.81M | label_window listlengths 4 2.12k | html_url stringlengths 74 116 | file_name stringlengths 3 311 |
|---|---|---|---|---|
// ReadTimeout is an option to pass to http.Server for setting an
// appropriate field.
ReadTimeout time.Duration
// ReadHeaderTimeout is an option to pass to http.Server for setting an
// appropriate field.
ReadHeaderTimeout time.Duration
// WriteTimeout is an option to pass to http.Server for setting an
// ... | <mask> BindPort int
<mask> PortHTTPS int
<mask> }
<mask>
<mask> // HTTPSServer - HTTPS Server
<mask> type HTTPSServer struct {
<mask> server *http.Server
<mask> cond *sync.Cond
</s> Pull request: 2343 http server
Merge in DNS/adguard-home from 2343-http-server to master
Closes #2343.
Squashed co... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b4a35fa887737e737145edd5ce42dd7fdfea2ee4 | internal/home/web.go |
Context.mux.Handle("/", postInstallHandler(optionalAuthHandler(gziphandler.GzipHandler(http.FileServer(box))))) | <mask> // Initialize and run the admin Web interface
<mask> box := packr.NewBox("../../build/static")
<mask>
<mask> // if not configured, redirect / to /install.html, otherwise redirect /install.html to /
<mask> http.Handle("/", postInstallHandler(optionalAuthHandler(gziphandler.GzipHandler(http.FileServer(bo... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b4a35fa887737e737145edd5ce42dd7fdfea2ee4 | internal/home/web.go |
Context.mux.Handle("/install.html", preInstallHandler(http.FileServer(box))) | <mask>
<mask> // add handlers for /install paths, we only need them when we're not configured yet
<mask> if conf.firstRun {
<mask> log.Info("This is the first launch of AdGuard Home, redirecting everything to /install.html ")
<mask> http.Handle("/install.html", preInstallHandler(http.FileServer(box)))
<mas... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b4a35fa887737e737145edd5ce42dd7fdfea2ee4 | internal/home/web.go |
ErrorLog: web.errLogger,
Addr: address,
Handler: withMiddlewares(Context.mux, limitRequestBody),
ReadTimeout: web.conf.ReadTimeout,
ReadHeaderTimeout: web.conf.ReadHeaderTimeout,
WriteTimeout: web.conf.WriteTimeout, | <mask>
<mask> // we need to have new instance, because after Shutdown() the Server is not usable
<mask> address := net.JoinHostPort(web.conf.BindHost, strconv.Itoa(web.conf.BindPort))
<mask> web.httpServer = &http.Server{
<mask> ErrorLog: web.errLogger,
<mask> Addr: address,
<mask> Handler: ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b4a35fa887737e737145edd5ce42dd7fdfea2ee4 | internal/home/web.go |
Handler: Context.mux,
ReadTimeout: web.conf.ReadTimeout,
ReadHeaderTimeout: web.conf.ReadHeaderTimeout,
WriteTimeout: web.conf.WriteTimeout, | <mask> CipherSuites: Context.tlsCiphers,
<mask> },
<mask> }
<mask>
<mask> printHTTPAddresses("https")
<mask> err := web.httpsServer.server.ListenAndServeTLS("", "")
<mask> if err != http.ErrServerClosed {
</s> Pull request: 2343 http server
Merge in DNS/adguard-home from 2343-http-server to mas... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b4a35fa887737e737145edd5ce42dd7fdfea2ee4 | internal/home/web.go |
// CheckHostRules tries to match the host against filtering rules only
func (d *Dnsfilter) CheckHostRules(host string, qtype uint16, setts *RequestFilteringSettings) (Result, error) {
if !setts.FilteringEnabled {
return Result{}, nil
}
return d.matchHost(host, qtype)
}
// CheckHost tries to match the host agains... | <mask> func (r Reason) Matched() bool {
<mask> return r != NotFilteredNotFound
<mask> }
<mask>
<mask> // CheckHost tries to match host against rules, then safebrowsing and parental if they are enabled
<mask> func (d *Dnsfilter) CheckHost(host string, qtype uint16, setts *RequestFilteringSettings) (Result, error... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b4f41116093d3c07695898f4d298205d51908243 | dnsfilter/dnsfilter.go |
res, err = s.filterDNSResponse(d) | <mask> }
<mask>
<mask> } else if res.Reason != dnsfilter.NotFilteredWhiteList {
<mask> origResp2 := d.Res
<mask> res, err = s.filterResponse(d)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> if res != nil {
<mask> origResp = origResp2 // matched by response
</s> -(dnsfi... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b4f41116093d3c07695898f4d298205d51908243 | dnsforward/dnsforward.go |
func (s *Server) filterDNSResponse(d *proxy.DNSContext) (*dnsfilter.Result, error) { | <mask> }
<mask>
<mask> // If response contains CNAME, A or AAAA records, we apply filtering to each canonical host name or IP address.
<mask> // If this is a match, we set a new response in d.Res and return.
<mask> func (s *Server) filterResponse(d *proxy.DNSContext) (*dnsfilter.Result, error) {
<mask> for _, a... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b4f41116093d3c07695898f4d298205d51908243 | dnsforward/dnsforward.go |
res, err := s.dnsFilter.CheckHostRules(host, d.Req.Question[0].Qtype, setts) | <mask> s.RUnlock()
<mask> continue
<mask> }
<mask> setts := s.getClientRequestFilteringSettings(d)
<mask> res, err := s.dnsFilter.CheckHost(host, d.Req.Question[0].Qtype, setts)
<mask> s.RUnlock()
<mask>
<mask> if err != nil {
<mask> return nil, err
<mask>
</s> -(dnsfilter): match DNS re... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b4f41116093d3c07695898f4d298205d51908243 | dnsforward/dnsforward.go |
if filterExists(f.URL) {
httpError(w, http.StatusBadRequest, "Filter URL already added -- %s", f.URL)
return | <mask> return
<mask> }
<mask>
<mask> // Check for duplicates
<mask> config.RLock()
<mask> for i := range config.Filters {
<mask> if config.Filters[i].URL == f.URL {
<mask> config.RUnlock()
<mask> httpError(w, http.StatusBadRequest, "Filter URL already added -- %s", f.URL)
<mask> return
<mas... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b54f540f716d875c0fc7d49d0994e479b843be4e | control.go |
<mask> httpError(w, http.StatusBadRequest, "Filter URL already added -- %s", f.URL)
<mask> return
<mask> }
<mask> }
<mask> config.RUnlock()
<mask>
<mask> // Set necessary properties
<mask> f.ID = assignUniqueFilterID()
<mask> f.Enabled = true
<mask>
</s> * control: refactor: move filter adding... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b54f540f716d875c0fc7d49d0994e479b843be4e | control.go | |
if !filterAdd(f) {
httpError(w, http.StatusBadRequest, "Filter URL already added -- %s", f.URL)
return | <mask> }
<mask>
<mask> // URL is deemed valid, append it to filters, update config, write new filter file and tell dns to reload it
<mask> // TODO: since we directly feed filters in-memory, revisit if writing configs is always necessary
<mask> config.Lock()
<mask>
<mask> // Check for duplicates
<mask> f... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b54f540f716d875c0fc7d49d0994e479b843be4e | control.go |
<mask> return
<mask> }
<mask> }
<mask>
<mask> config.Filters = append(config.Filters, f)
<mask> config.Unlock()
<mask>
<mask> err = writeAllConfigs()
<mask> if err != nil {
<mask> httpError(w, http.StatusInternalServerError, "Couldn't write config file: %s", err)
<mask> return
<mask> }
</s... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b54f540f716d875c0fc7d49d0994e479b843be4e | control.go | |
cond *sync.Cond // Synchronize worker thread with main thread
mutex sync.Mutex // Mutex for 'cond'
running bool // Set if the worker thread is running
stopping bool // Set if the worker thread should be stopped
| <mask>
<mask> ipnet *net.IPNet // if interface name changes, this needs to be reset
<mask>
<mask> // leases
<mask> leases []*Lease
<mask> leaseStart net.IP // parsed from config RangeStart
<mask> leaseStop net.IP // parsed from config RangeEnd
<mask> leaseTime time.Duration /... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b5f0d48e7f7b403b86b87d125ae48c518485dc82 | dhcpd/dhcpd.go |
s.cond = sync.NewCond(&s.mutex) | <mask>
<mask> s.conn = c
<mask>
<mask> s.running = true
<mask> go func() {
<mask> // operate on c instead of c.conn because c.conn can change over time
</s> * DHCP: Stop(): wait until the worker is stopped </s> remove if err != nil {
</s> add if err != nil && !s.stopping { | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b5f0d48e7f7b403b86b87d125ae48c518485dc82 | dhcpd/dhcpd.go |
s.running = true | <mask> s.cond = sync.NewCond(&s.mutex)
<mask>
<mask> go func() {
<mask> // operate on c instead of c.conn because c.conn can change over time
<mask> err := dhcp4.Serve(c, s)
<mask> if err != nil && !s.stopping {
</s> * DHCP: Stop(): wait until the worker is stopped </s> remove if err != nil {
</s> ad... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b5f0d48e7f7b403b86b87d125ae48c518485dc82 | dhcpd/dhcpd.go |
if err != nil && !s.stopping { | <mask>
<mask> go func() {
<mask> // operate on c instead of c.conn because c.conn can change over time
<mask> err := dhcp4.Serve(c, s)
<mask> if err != nil {
<mask> log.Printf("dhcp4.Serve() returned with error: %s", err)
<mask> }
<mask> c.Close() // in case Serve() exits for other reason than li... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b5f0d48e7f7b403b86b87d125ae48c518485dc82 | dhcpd/dhcpd.go |
s.running = false
s.cond.Signal() | <mask> log.Printf("dhcp4.Serve() returned with error: %s", err)
<mask> }
<mask> c.Close() // in case Serve() exits for other reason than listening socket closure
<mask> }()
<mask>
<mask> return nil
<mask> }
<mask>
</s> * DHCP: Stop(): wait until the worker is stopped </s> remove if err != nil {
<... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b5f0d48e7f7b403b86b87d125ae48c518485dc82 | dhcpd/dhcpd.go |
s.stopping = true
| <mask> return nil
<mask> }
<mask> err := s.closeConn()
<mask> if err != nil {
<mask> return wrapErrPrint(err, "Couldn't close UDP listening socket")
<mask> }
</s> * DHCP: Stop(): wait until the worker is stopped </s> remove if err != nil {
</s> add if err != nil && !s.stopping { | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b5f0d48e7f7b403b86b87d125ae48c518485dc82 | dhcpd/dhcpd.go |
// We've just closed the listening socket.
// Worker thread should exit right after it tries to read from the socket.
s.mutex.Lock()
for s.running {
s.cond.Wait()
}
s.mutex.Unlock()
| <mask> return wrapErrPrint(err, "Couldn't close UDP listening socket")
<mask> }
<mask>
<mask> s.dbStore()
<mask> return nil
<mask> }
<mask>
</s> * DHCP: Stop(): wait until the worker is stopped </s> remove if err != nil {
</s> add if err != nil && !s.stopping { | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b5f0d48e7f7b403b86b87d125ae48c518485dc82 | dhcpd/dhcpd.go |
restart := false
if (status & statusEnabledChanged) != 0 {
// we must add or remove filter rules
restart = true
}
if (status&statusUpdateRequired) != 0 && fj.Data.Enabled { | <mask> return
<mask> }
<mask>
<mask> onConfigModified()
<mask> if (status&(statusURLChanged|statusEnabledChanged)) != 0 && fj.Data.Enabled {
<mask> // download new filter and apply its rules
<mask> _, _ = refreshFilters(fj.Whitelist, true)
<mask> }
<mask> }
<mask>
</s> Merge: - filters: 'enable/d... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/control_filtering.go |
flags := FilterRefreshBlocklists
if fj.Whitelist {
flags = FilterRefreshAllowlists
}
nUpdated, _ := refreshFilters(flags, true)
// if at least 1 filter has been updated, refreshFilters() restarts the filtering automatically
// if not - we restart the filtering ourselves
restart = false
if nUpdated ==... | <mask>
<mask> onConfigModified()
<mask> if (status&(statusURLChanged|statusEnabledChanged)) != 0 && fj.Data.Enabled {
<mask> // download new filter and apply its rules
<mask> _, _ = refreshFilters(fj.Whitelist, true)
<mask> }
<mask> }
<mask>
<mask> func handleFilteringSetRules(w http.ResponseWriter, r... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/control_filtering.go |
flags := FilterRefreshBlocklists
if req.White {
flags = FilterRefreshAllowlists
}
resp.Updated, err = refreshFilters(flags|FilterRefreshForce, false) | <mask> return
<mask> }
<mask>
<mask> Context.controlLock.Unlock()
<mask> resp.Updated, err = refreshFilters(req.White, false)
<mask> Context.controlLock.Lock()
<mask> if err != nil {
<mask> httpError(w, http.StatusInternalServerError, "%s", err)
<mask> return
<mask> }
</s> Merge: - filters: 'ena... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/control_filtering.go |
statusUpdateRequired = 0x10 | <mask> statusEnabledChanged = 2
<mask> statusURLChanged = 4
<mask> statusURLExists = 8
<mask> )
<mask>
<mask> // Update properties for a filter specified by its URL
<mask> // Return status* flags.
<mask> func filterSetProperties(url string, newf filter, whitelist bool) int {
</s> Merge: - filters:... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/filter.go |
r |= statusURLChanged | statusUpdateRequired | <mask> f.URL, newf.Name, newf.URL, newf.Enabled)
<mask> f.Name = newf.Name
<mask>
<mask> if f.URL != newf.URL {
<mask> r |= statusURLChanged
<mask> if filterExistsNoLock(newf.URL) {
<mask> return statusURLExists
<mask> }
<mask> f.URL = newf.URL
<mask> f.unload()
</s> Merge: - filte... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/filter.go |
f.checksum = 0
f.RulesCount = 0 | <mask> f.unload()
<mask> f.LastUpdated = time.Time{}
<mask> }
<mask>
<mask> if f.Enabled != newf.Enabled {
<mask> r |= statusEnabledChanged
<mask> f.Enabled = newf.Enabled
</s> Merge: - filters: 'enable/disable filter' didn't work
Squashed commit of the following:
commit c4c616162b66f2e89932a... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/filter.go |
<mask> e := f.load()
<mask> if e != nil {
<mask> // This isn't a fatal error,
<mask> // because it may occur when someone removes the file from disk.
<mask> // In this case the periodic update task will try to download the file.
<mask> f.LastUpdated = time.Time{}
<mask> }
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/filter.go | |
f.checksum = 0
f.RulesCount = 0
r |= statusUpdateRequired | <mask> // because it may occur when someone removes the file from disk.
<mask> f.LastUpdated = time.Time{}
<mask> }
<mask> }
<mask> } else {
<mask> f.unload()
<mask> }
<mask> }
</s> Merge: - filters: 'enable/disable filter' didn't work
Squashed commit of the following:
commi... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/filter.go |
// flags: FilterRefresh* | <mask>
<mask> // Refresh filters
<mask> // important:
<mask> // TRUE: ignore the fact that we're currently updating the filters
<mask> func refreshFilters(flags int, important bool) (int, error) {
<mask> set := atomic.CompareAndSwapUint32(&refreshStatus, 0, 1)
<mask> if !important && !set {
<mask> return ... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/filter.go |
func refreshFilters(flags int, important bool) (int, error) { | <mask>
<mask> // Refresh filters
<mask> // important:
<mask> // TRUE: ignore the fact that we're currently updating the filters
<mask> func refreshFilters(whitelist bool, important bool) (int, error) {
<mask> set := atomic.CompareAndSwapUint32(&refreshStatus, 0, 1)
<mask> if !important && !set {
<mask> re... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/filter.go |
nUpdated, _ := refreshFiltersIfNecessary(flags) | <mask> return 0, fmt.Errorf("Filters update procedure is already running")
<mask> }
<mask>
<mask> refreshLock.Lock()
<mask> flags := FilterRefreshBlocklists
<mask> if whitelist {
<mask> flags = FilterRefreshAllowlists
<mask> }
<mask> nUpdated, _ := refreshFiltersIfNecessary(flags | FilterRefreshForc... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b600d7b09d3f11b9f1635af67e0e7388cf62189c | home/filter.go |
log.Info("sighdlr: reconfiguring: exiting with status %d", status) | <mask> log.Info("sighdlr: reconfiguring adguard home")
<mask>
<mask> status := h.shutdown()
<mask> if status != statusSuccess {
<mask> log.Info("sighdlr: reconfiruging: exiting with status %d", status)
<mask>
<mask> os.Exit(status)
<mask> }
<mask>
<mask> // TODO(a.garipov): This is a very rough wa... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/next/cmd/signal.go |
go svc.relaunch(updCtx, cancelUpd, newConf)
} | <mask> }
<mask>
<mask> // Launch the new HTTP service in a separate goroutine to let this handler
<mask> // finish and thus, this server to shutdown.
<mask> go func() {
<mask> defer cancelUpd()
<mask>
<mask> updErr := svc.confMgr.UpdateWeb(updCtx, newConf)
<mask> if updErr != nil {
<mask> write... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/next/websvc/http.go |
// relaunch updates the web service in the configuration manager and starts it.
// It is intended to be used as a goroutine.
func (svc *Service) relaunch(ctx context.Context, cancel context.CancelFunc, newConf *Config) {
defer log.OnPanic("websvc: relaunching") | <mask> // finish and thus, this server to shutdown.
<mask> go func() {
<mask> defer cancelUpd()
<mask>
<mask> updErr := svc.confMgr.UpdateWeb(updCtx, newConf)
<mask> if updErr != nil {
<mask> writeJSONErrorResponse(w, r, fmt.Errorf("updating: %w", updErr))
<mask>
<mask> return
<mask> }
<mas... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/next/websvc/http.go |
defer cancel() | <mask> updErr := svc.confMgr.UpdateWeb(updCtx, newConf)
<mask> if updErr != nil {
<mask> writeJSONErrorResponse(w, r, fmt.Errorf("updating: %w", updErr))
<mask>
<mask> return
<mask> }
<mask>
<mask> // TODO(a.garipov): Consider better ways to do this.
<mask> const maxUpdDur = 10 * time.Second
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/next/websvc/http.go |
err := svc.confMgr.UpdateWeb(ctx, newConf)
if err != nil {
log.Error("websvc: updating web: %s", err) | <mask>
<mask> return
<mask> }
<mask>
<mask> // TODO(a.garipov): Consider better ways to do this.
<mask> const maxUpdDur = 10 * time.Second
<mask> updStart := time.Now()
<mask> var newSvc agh.ServiceWithConfig[*Config]
<mask> for newSvc = svc.confMgr.Web(); newSvc == svc; {
<mask> if time.S... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/next/websvc/http.go |
return
} | <mask> for newSvc = svc.confMgr.Web(); newSvc == svc; {
<mask> if time.Since(updStart) >= maxUpdDur {
<mask> log.Error("websvc: failed to update svc after %s", maxUpdDur)
<mask>
<mask> return
<mask> }
<mask>
<mask> log.Debug("websvc: waiting for new websvc to be configured")
<mask> time... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/next/websvc/http.go |
// TODO(a.garipov): Consider better ways to do this.
const maxUpdDur = 5 * time.Second
updStart := time.Now()
var newSvc agh.ServiceWithConfig[*Config]
for newSvc = svc.confMgr.Web(); newSvc == svc; {
if time.Since(updStart) >= maxUpdDur {
log.Error("websvc: failed to update svc after %s", maxUpdDur) | <mask>
<mask> return
<mask> }
<mask>
<mask> log.Debug("websvc: waiting for new websvc to be configured")
<mask> time.Sleep(1 * time.Second)
<mask> }
<mask>
<mask> updErr = newSvc.Start()
<mask> if updErr != nil {
<mask> log.Error("websvc: new svc failed to start with error: %s", updE... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/next/websvc/http.go |
return | <mask> log.Debug("websvc: waiting for new websvc to be configured")
<mask> time.Sleep(1 * time.Second)
<mask> }
<mask>
<mask> updErr = newSvc.Start()
<mask> if updErr != nil {
<mask> log.Error("websvc: new svc failed to start with error: %s", updErr)
<mask> }
<mask> }()
<mask> }
</s> Pull ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/next/websvc/http.go |
log.Debug("websvc: waiting for new websvc to be configured")
time.Sleep(100 * time.Millisecond)
}
err = newSvc.Start()
if err != nil {
log.Error("websvc: new svc failed to start with error: %s", err)
} | <mask> updErr = newSvc.Start()
<mask> if updErr != nil {
<mask> log.Error("websvc: new svc failed to start with error: %s", updErr)
<mask> }
<mask> }()
<mask> }
</s> Pull request 1875: next-gocognit
Merge in DNS/adguard-home from next-gocognit to master
Squashed commit of the following:
commit 55445... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/next/websvc/http.go |
// newMux returns a new HTTP request multiplexer for the AdGuard Home web | <mask>
<mask> return svc, nil
<mask> }
<mask>
<mask> // newMux returns a new HTTP request multiplexor for the AdGuard Home web
<mask> // service.
<mask> func newMux(svc *Service) (mux *httptreemux.ContextMux) {
<mask> mux = httptreemux.NewContextMux()
<mask>
<mask> routes := []struct {
</s> Pull reques... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/next/websvc/websvc.go |
github.com/uudashr/gocognit v1.0.6
golang.org/x/tools v0.10.0 | <mask> github.com/gordonklaus/ineffassign v0.0.0-20230107090616-13ace0543b28
<mask> github.com/kisielk/errcheck v1.6.3
<mask> github.com/kyoh86/looppointer v0.2.1
<mask> github.com/securego/gosec/v2 v2.16.0
<mask> golang.org/x/tools v0.9.3
<mask> golang.org/x/vuln v0.1.0
<mask> honnef.co/go/tools v0.4.3
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/tools/go.mod |
golang.org/x/mod v0.11.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.9.0 // indirect | <mask> github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
<mask> github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
<mask> golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
<mask> golang.org/x/exp/typeparams v0.0.0-20230522175609-2e198f4a06a1 // indire... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/tools/go.mod |
github.com/uudashr/gocognit v1.0.6 h1:2Cgi6MweCsdB6kpcVQp7EW4U23iBFQWfTXiWlyp842Y=
github.com/uudashr/gocognit v1.0.6/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= | <mask> github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
<mask> github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
<mask> github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
<mask> github.co... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/tools/go.sum |
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU=
golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= | <mask> golang.org/x/exp/typeparams v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
<mask> golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
<mask> golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
<mask> golang.org/x... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/tools/go.sum |
golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= | <mask> golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
<mask> golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
<mask> golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/tools/go.sum |
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= | <mask> golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
<mask> golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
<mask> golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
<mask>... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/tools/go.sum |
golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | <mask> golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
<mask> golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
<mask> golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/tools/go.sum |
golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4=
golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg=
golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= | <mask> golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
<mask> golang.org/x/tools v0.0.0-20201007032633-0806396f153e/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
<mask> golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOk... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/tools/go.sum |
_ "github.com/uudashr/gocognit/cmd/gocognit" | <mask> _ "github.com/kisielk/errcheck"
<mask> _ "github.com/kyoh86/looppointer"
<mask> _ "github.com/securego/gosec/v2/cmd/gosec"
<mask> _ "golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness"
<mask> _ "golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow"
<mask> _ "golang.org/x/vuln/cmd/govulnchec... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/tools/tools.go |
writeCommitTime(b) | <mask> vFmtGoHdr,
<mask> runtime.Version(),
<mask> )
<mask>
<mask> if committime != "" {
<mask> commitTimeUnix, err := strconv.ParseInt(committime, 10, 64)
<mask> if err != nil {
<mask> stringutil.WriteToBuilder(b, nl, vFmtTimeHdr, fmt.Sprintf("parse error: %s", err))
<mask> } else {
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | internal/version/version.go |
, "ASN" | <mask> # See https://github.com/dominikh/go-tools/blob/master/config/config.go.
<mask> #
<mask> # Do not add "PTR" since we use "Ptr" as a suffix.
<mask> "inherit"
<mask> , "DHCP"
<mask> , "DNSSEC"
<mask> # E.g. SentryDSN.
<mask> , "DSN"
<mask> , "ECS"
</s> Pull request 1875: next-gocognit
Merge in... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | staticcheck.conf |
, "DNSSEC"
# E.g. SentryDSN.
, "DSN"
, "ECS" | <mask> "inherit"
<mask> , "ASN"
<mask> , "DHCP"
<mask> , "EDNS"
<mask> , "MX"
<mask> , "QUIC"
<mask> , "RA"
</s> Pull request 1875: next-gocognit
Merge in DNS/adguard-home from next-gocognit to master
Squashed commit of the following:
commit 554458a63b44e71244b4364168e6e9903b880638
Author: Ainar Garipov <A... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | staticcheck.conf |
, "RRSIG" | <mask> , "QUIC"
<mask> , "RA"
<mask> , "SDNS"
<mask> , "SLAAC"
<mask> , "SOA"
<mask> , "SVCB"
<mask> , "TLD"
</s> Pull request 1875: next-gocognit
Merge in DNS/adguard-home from next-gocognit to master
Squashed commit of the following:
commit 554458a63b44e71244b4364168e6e9903b880638
Author: Ainar Garipov <A.... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | staticcheck.conf |
, "SOA" | <mask> , "RRSIG"
<mask> , "SDNS"
<mask> , "SLAAC"
<mask> , "SVCB"
<mask> , "TLD"
<mask> , "WHOIS"
<mask> ]
</s> Pull request 1875: next-gocognit
Merge in DNS/adguard-home from next-gocognit to master
Squashed commit of the following:
commit 554458a63b44e71244b4364168e6e9903b880638
Author: Ainar Garipov <A.Ga... | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b6d00f774bfa73c1890fec12db61c0cd4aa776ed | staticcheck.conf |
w.Write(getVersionResp(data)) | <mask>
<mask> if cached {
<mask> // return cached copy
<mask> w.Header().Set("Content-Type", "application/json")
<mask> w.Write(data)
<mask> return
<mask> }
<mask>
<mask> resp, err := client.Get(versionCheckURL)
<mask> if err != nil {
</s> * control: /version.json: use new JSON format </s> remo... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b72ca4d1270a9703b9d39daa5ffaa754a42404bc | control_update.go |
<mask> httpError(w, http.StatusBadGateway, "Couldn't read response body from %s: %s", versionCheckURL, err)
<mask> return
<mask> }
<mask>
<mask> w.Header().Set("Content-Type", "application/json")
<mask> _, err = w.Write(body)
<mask> if err != nil {
<mask> httpError(w, http.StatusInternalServerError, ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b72ca4d1270a9703b9d39daa5ffaa754a42404bc | control_update.go | |
w.Header().Set("Content-Type", "application/json")
_, err = w.Write(getVersionResp(body))
if err != nil {
httpError(w, http.StatusInternalServerError, "Couldn't write body: %s", err)
} | <mask> versionCheckJSON = body
<mask> controlLock.Unlock()
<mask> }
<mask>
<mask> // Copy file on disk
<mask> func copyFile(src, dst string) error {
<mask> d, e := ioutil.ReadFile(src)
</s> * control: /version.json: use new JSON format </s> remove w.Write(data)
</s> add w.Write(getVersionResp(data)) </... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b72ca4d1270a9703b9d39daa5ffaa754a42404bc | control_update.go |
<mask>
<mask> require (
<mask> github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f // indirect
<mask> github.com/beefsack/go-rate v0.0.0-20180408011153-efa7637bb9b6
<mask> github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
<mask> github.com/bluele/gcache v0.0.0-20171010155617-... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.mod | |
<mask> github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f // indirect
<mask> github.com/beefsack/go-rate v0.0.0-20180408011153-efa7637bb9b6
<mask> github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect
<mask> github.com/bluele/gcache v0.0.0-20171010155617-472614239ac7
<mask> githu... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.mod | |
<mask> github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
<mask> github.com/go-ole/go-ole v1.2.1 // indirect
<mask> github.com/go-test/deep v1.0.1
<mask> github.com/gobuffalo/packr v1.19.0
<mask> github.com/google/uuid v1.0.0 // indirect
<mask> github.com/grpc-ecosystem/grpc-opentracin... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.mod | |
<mask> github.com/gobuffalo/packr v1.19.0
<mask> github.com/google/uuid v1.0.0 // indirect
<mask> github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
<mask> github.com/joomcode/errorx v0.1.0
<mask> github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
<mask... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.mod | |
<mask> github.com/joomcode/errorx v0.1.0
<mask> github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
<mask> github.com/mholt/caddy v0.11.0
<mask> github.com/miekg/dns v1.0.15
<mask> github.com/opentracing/opentracing-go v1.0.2 // indirect
<mask> github.com/patrickmn/go-cache v2.1.0+incompatib... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.mod | |
<mask> github.com/mholt/caddy v0.11.0
<mask> github.com/miekg/dns v1.0.15
<mask> github.com/opentracing/opentracing-go v1.0.2 // indirect
<mask> github.com/patrickmn/go-cache v2.1.0+incompatible
<mask> github.com/pkg/errors v0.8.0
<mask> github.com/prometheus/client_golang v0.9.0-pre1
<mask> github.com/pr... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.mod | |
<mask> go.uber.org/goleak v0.10.0
<mask> golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd
<mask> golang.org/x/net v0.0.0-20181108082009-03003ca0c849
<mask> golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect
<mask> google.golang.org/grpc v1.16.0 // indirect
<mask> gopkg.in/asaskevich/goval... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.mod | |
<mask> cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
<mask> github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f h1:5ZfJxyXo8KyX8DgGXC5B7ILL8y51fci/qYz2B4j8iLY=
<mask> github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF... | [
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f h1:5ZfJxyXo8KyX8DgGXC5B7ILL8y51fci/qYz2B4j8iLY=
<mask> github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
<mask> github.com/beefsack/go-rate v0.0.0-20180408011153-efa7637bb9b6 h1... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
<mask> github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
<mask> github.com/bluele/gcache v0.0.0-20171010155617-472614239ac7 h1:NpQ+gkFOH27A... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> github.com/coredns/coredns v1.2.6 h1:QIAOkBqVE44Zx0ttrFqgE5YhCEn64XPIngU60JyuTGM=
<mask> github.com/coredns/coredns v1.2.6/go.mod h1:zASH/MVDgR6XZTbxvOnsZfffS+31vg6Ackf/wo1+AM0=
<mask> github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
<mask> github.com/davecgh/go-spew v1.1.1/g... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264 h1:roWyi0eEdiFreSqW9V1wT9pNOVzrpo2NWsxja53slX0=
<mask> github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI=
<mask> github.com/gobuffalo/packr v1.19.0 h1:3UDmBDxesCOPF8iZdMDBBWKfkBoYujI... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
<mask> github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
<mask> github.com/joomcode/errorx v0.1.0 h1:QmJMiI1DE1UFje2aI1ZWO/VMT5a32qBoXUclGOt8vsc=
<mask> github.com/joomcode/errorx v0.1.0/go.mo... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> github.com/joomcode/errorx v0.1.0/go.mod h1:kgco15ekB6cs+4Xjzo7SPeXzx38PbJzBwbnu9qfVNHQ=
<mask> github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
<mask> github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4 h1:Mlji5gkcpzkqTROyE4ZxZ8hN7osunMb2RuGVrbvMvCc=
<mask> g... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> github.com/mholt/caddy v0.11.0 h1:cuhEyR7So/SBBRiAaiRBe9BoccDu6uveIPuM9FMMavg=
<mask> github.com/mholt/caddy v0.11.0/go.mod h1:Wb1PlT4DAYSqOEd03MsqkdkXnTxA8v9pKjdpxbqM1kY=
<mask> github.com/miekg/dns v1.0.15 h1:9+UupePBQCG6zf1q/bGmTO1vumoG13jsrbWOSX1W6Tw=
<mask> github.com/miekg/dns v1.0.15/go.mod h1:W1PPwlI... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
<mask> github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
<mask> github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
<mask> github.com/pmezard/go-difflib v1.0.0/go.mo... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> go.uber.org/goleak v0.10.0 h1:G3eWbSNIskeRqtsN/1uI5B+eP73y3JUuBsv9AZjehb4=
<mask> go.uber.org/goleak v0.10.0/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI=
<mask> golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd h1:VtIkGDhk0ph3t+THbvXHfMZ8QHgsBO39Nh52+74pq7w=
<mask> golang.org/x/crypto v0.0.0-2... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
<mask> golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
<mask> golang.org/x/net v0.0.0-20181108082009-03003ca0c849 h1:FSqE2GGG7wzsYUsWiQ8MZrvEd1E... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
<mask> golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
<mask> golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6Z... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
<mask> golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
<mask> golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 h1:YoY1wS6JYVRpIfFngRf2HHo9R9... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
<mask> gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
<mask> gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
<mask> gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
<mask> gopkg.i... | [
"keep",
"keep",
"keep",
"keep",
"replace"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b84786631026b78e3d04ed3ab42555aabbc9b88c | go.sum | |
statsConf := stats.Config{
Filename: filepath.Join(baseDir, "stats.db"),
LimitDays: config.DNS.StatsInterval,
}
config.stats, err = stats.New(statsConf) | <mask> if err != nil {
<mask> log.Fatalf("Cannot create DNS data dir at %s: %s", baseDir, err)
<mask> }
<mask>
<mask> statsDBFilename := filepath.Join(baseDir, "stats.db")
<mask> config.stats, err = stats.New(statsDBFilename, config.DNS.StatsInterval, nil)
<mask> if err != nil {
<mask> log.Fatal("Coul... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | home/dns.go |
// Config - module configuration
type Config struct {
Filename string // database file name
LimitDays uint32 // time limit (in days)
UnitID unitIDCallback // user function to get the current unit ID. If nil, the current time hour is used.
}
| <mask> type unitIDCallback func() uint32
<mask>
<mask> // New - create object
<mask> func New(conf Config) (Stats, error) {
<mask> return createObject(conf)
<mask> }
<mask>
</s> * stats: pass configuration object via stats.New() </s> remove // filename: DB file name
// limit: time limit (in days)
// unitID: ... | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats.go |
func New(conf Config) (Stats, error) {
return createObject(conf) | <mask>
<mask> type unitIDCallback func() uint32
<mask>
<mask> // New - create object
<mask> // filename: DB file name
<mask> // limit: time limit (in days)
<mask> // unitID: user function to get the current unit ID. If nil, the current time hour is used.
<mask> func New(filename string, limit uint32, unitID ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats.go |
conf := Config{
Filename: "./stats.db",
LimitDays: 1,
}
s, _ := New(conf) | <mask> return true
<mask> }
<mask>
<mask> func TestStats(t *testing.T) {
<mask> s, _ := New("./stats.db", 1, nil)
<mask>
<mask> e := Entry{}
<mask>
<mask> e.Domain = "domain"
<mask> e.Client = net.ParseIP("127.0.0.1")
</s> * stats: pass configuration object via stats.New() </s> remove fn := "./stats... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_test.go |
os.Remove(conf.Filename) | <mask> assert.True(t, d["avg_processing_time"].(float64) == 0.123456)
<mask>
<mask> s.Clear()
<mask> s.Close()
<mask> os.Remove("./stats.db")
<mask> }
<mask>
<mask> func TestLargeNumbers(t *testing.T) {
<mask> var hour int32
<mask> hour = 1
</s> * stats: pass configuration object via stats.New() </s>... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_test.go |
conf := Config{
Filename: "./stats.db",
LimitDays: 1,
UnitID: newID,
}
os.Remove(conf.Filename)
s, _ := New(conf) | <mask> return uint32(atomic.LoadInt32(&hour))
<mask> }
<mask>
<mask> // log.SetLevel(log.DEBUG)
<mask> fn := "./stats.db"
<mask> os.Remove(fn)
<mask> s, _ := New(fn, 1, newID)
<mask> e := Entry{}
<mask>
<mask> n := 1000 // number of distinct clients and domains every hour
<mask> for h := 0; h != ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_test.go |
os.Remove(conf.Filename) | <mask> d := s.GetData(Hours)
<mask> assert.True(t, d["num_dns_queries"].(uint64) == uint64(int(hour)*n))
<mask>
<mask> s.Close()
<mask> os.Remove(fn)
<mask> }
</s> * stats: pass configuration object via stats.New() </s> remove os.Remove("./stats.db")
</s> add os.Remove(conf.Filename) </s> remove fn := "... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_test.go |
limit uint32 // maximum time we need to keep data for (in hours)
db *bolt.DB
conf Config | <mask> )
<mask>
<mask> // statsCtx - global context
<mask> type statsCtx struct {
<mask> limit uint32 // maximum time we need to keep data for (in hours)
<mask> filename string // database file name
<mask> unitID unitIDCallback // user function which returns the current unit ID
<mask> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_unit.go |
func createObject(conf Config) (*statsCtx, error) { | <mask>
<mask> TimeAvg uint32 // usec
<mask> }
<mask>
<mask> func createObject(filename string, limitDays uint32, unitID unitIDCallback) (*statsCtx, error) {
<mask> s := statsCtx{}
<mask> s.limit = limitDays * 24
<mask> s.filename = filename
<mask> s.unitID = newUnitID
<mask> if unitID != nil {
</s> *... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_unit.go |
s.limit = conf.LimitDays * 24
s.conf = conf
if conf.UnitID == nil {
s.conf.UnitID = newUnitID | <mask> }
<mask>
<mask> func createObject(filename string, limitDays uint32, unitID unitIDCallback) (*statsCtx, error) {
<mask> s := statsCtx{}
<mask> s.limit = limitDays * 24
<mask> s.filename = filename
<mask> s.unitID = newUnitID
<mask> if unitID != nil {
<mask> s.unitID = unitID
<mask> }
<mask>
... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_unit.go |
id := s.conf.UnitID() | <mask> if !s.dbOpen() {
<mask> return nil, fmt.Errorf("open database")
<mask> }
<mask>
<mask> id := s.unitID()
<mask> tx := s.beginTxn(true)
<mask> var udb *unitDB
<mask> if tx != nil {
<mask> log.Tracef("Deleting old units...")
<mask> firstID := id - s.limit - 1
</s> * stats: pass configuration... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_unit.go |
s.db, err = bolt.Open(s.conf.Filename, 0644, nil) | <mask>
<mask> func (s *statsCtx) dbOpen() bool {
<mask> var err error
<mask> log.Tracef("db.Open...")
<mask> s.db, err = bolt.Open(s.filename, 0644, nil)
<mask> if err != nil {
<mask> log.Error("Stats: open DB: %s: %s", s.filename, err)
<mask> return false
<mask> }
<mask> log.Tracef("db.Open")
</s... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_unit.go |
log.Error("Stats: open DB: %s: %s", s.conf.Filename, err) | <mask> var err error
<mask> log.Tracef("db.Open...")
<mask> s.db, err = bolt.Open(s.filename, 0644, nil)
<mask> if err != nil {
<mask> log.Error("Stats: open DB: %s: %s", s.filename, err)
<mask> return false
<mask> }
<mask> log.Tracef("db.Open")
<mask> return true
<mask> }
</s> * stats: pass confi... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_unit.go |
id := s.conf.UnitID() | <mask> if ptr == nil {
<mask> break
<mask> }
<mask>
<mask> id := s.unitID()
<mask> if ptr.id == id {
<mask> time.Sleep(time.Second)
<mask> continue
<mask> }
<mask>
</s> * stats: pass configuration object via stats.New() </s> remove id := s.unitID()
</s> add id := s.conf.UnitID() </s> ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_unit.go |
s.initUnit(&u, s.conf.UnitID()) | <mask> // all active transactions are now closed
<mask> }
<mask>
<mask> u := unit{}
<mask> s.initUnit(&u, s.unitID())
<mask> _ = s.swapUnit(&u)
<mask>
<mask> err := os.Remove(s.filename)
<mask> if err != nil {
<mask> log.Error("os.Remove: %s", err)
</s> * stats: pass configuration object via stat... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_unit.go |
err := os.Remove(s.conf.Filename) | <mask> u := unit{}
<mask> s.initUnit(&u, s.unitID())
<mask> _ = s.swapUnit(&u)
<mask>
<mask> err := os.Remove(s.filename)
<mask> if err != nil {
<mask> log.Error("os.Remove: %s", err)
<mask> }
<mask>
<mask> _ = s.dbOpen()
</s> * stats: pass configuration object via stats.New() </s> remove s.initU... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_unit.go |
lastID := s.conf.UnitID() | <mask> return nil
<mask> }
<mask>
<mask> units := []*unitDB{} //per-hour units
<mask> lastID := s.unitID()
<mask> firstID := lastID - s.limit + 1
<mask> for i := firstID; i != lastID; i++ {
<mask> u := s.loadUnitFromDB(tx, i)
<mask> if u == nil {
<mask> u = &unitDB{}
</s> * stats: pass configu... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b8a98c1a77ef92e1cdc962150fe4bf5e38e98f93 | stats/stats_unit.go |
s.conf.DBFilePath = filepath.Join(config.WorkDir, dbFilename) | <mask> // Create - create object
<mask> func Create(config ServerConfig) *Server {
<mask> s := Server{}
<mask> s.conf = config
<mask> if s.conf.HTTPRegister != nil {
<mask> s.registerHandlers()
<mask> }
<mask>
<mask> // we can't delay database loading until DHCP server is started,
</s> * dhcp: now sta... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b9c0b5535694fea37fad8fc85e3b1e897860f6ea | dhcpd/dhcpd.go |
// we can't delay database loading until DHCP server is started,
// because we need static leases functionality available beforehand
s.dbLoad() | <mask> s.conf.DBFilePath = filepath.Join(config.WorkDir, dbFilename)
<mask> if s.conf.HTTPRegister != nil {
<mask> s.registerHandlers()
<mask> }
<mask> return &s
<mask> }
<mask>
<mask> // Init checks the configuration and initializes the server
<mask> func (s *Server) Init(config ServerConfig) error {
... | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b9c0b5535694fea37fad8fc85e3b1e897860f6ea | dhcpd/dhcpd.go |
<mask> err := s.setConfig(config)
<mask> if err != nil {
<mask> return err
<mask> }
<mask> s.dbLoad()
<mask> return nil
<mask> }
<mask>
<mask> // WriteDiskConfig - write configuration
<mask> func (s *Server) WriteDiskConfig(c *ServerConfig) {
</s> * dhcp: now static leases functionality works before ... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b9c0b5535694fea37fad8fc85e3b1e897860f6ea | dhcpd/dhcpd.go | |
s.conf.DBFilePath = oldconf.DBFilePath | <mask> s.conf = config
<mask> s.conf.WorkDir = oldconf.WorkDir
<mask> s.conf.HTTPRegister = oldconf.HTTPRegister
<mask> s.conf.ConfigModified = oldconf.ConfigModified
<mask> s.conf.DBFilePath = filepath.Join(config.WorkDir, dbFilename)
<mask> return nil
<mask> }
<mask>
<mask> // Start will listen on por... | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/b9c0b5535694fea37fad8fc85e3b1e897860f6ea | dhcpd/dhcpd.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.