docstring_tokens stringlengths 18 16.9k | code_tokens stringlengths 75 1.81M | html_url stringlengths 74 116 | file_name stringlengths 3 311 |
|---|---|---|---|
keep keep keep keep replace keep keep replace keep keep keep keep | <mask> var req, resp, msg *dhcpv6.Message
<mask> mac := net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}
<mask> t.Run("solicit", func(t *testing.T) {
<mask> req, err = dhcpv6.NewSolicit(mac)
<mask> require.Nil(t, err)
<mask>
<mask> msg, err = req.GetInnerMessage()
<mask> require.Nil(t, err)
<mask>
<mask> resp, err = dhcpv6.NewAdvertiseFromSolicit(msg)
<mask> require.Nil(t, err)
<mask>
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/dhcpd/v6_test.go |
keep keep replace keep keep keep replace | <mask>
<mask> resp, err = dhcpv6.NewAdvertiseFromSolicit(msg)
<mask> require.Nil(t, err)
<mask>
<mask> assert.True(t, s.process(msg, req, resp))
<mask> })
<mask> require.Nil(t, err)
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/dhcpd/v6_test.go |
keep replace keep keep replace | <mask> req, err = dhcpv6.NewRequestFromAdvertise(resp)
<mask> require.Nil(t, err)
<mask>
<mask> msg, err = req.GetInnerMessage()
<mask> require.Nil(t, err)
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/dhcpd/v6_test.go |
keep keep replace keep keep keep replace | <mask>
<mask> resp, err = dhcpv6.NewReplyFromMessage(msg)
<mask> require.Nil(t, err)
<mask>
<mask> assert.True(t, s.process(msg, req, resp))
<mask> })
<mask> require.Nil(t, err)
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/dhcpd/v6_test.go |
keep keep replace replace keep keep keep replace replace replace keep keep | <mask> func (d *testDHCP) Enabled() (ok bool) { return true }
<mask>
<mask> func (d *testDHCP) Leases(flags int) []dhcpd.Lease {
<mask> l := dhcpd.Lease{
<mask> IP: net.IP{192, 168, 12, 34},
<mask> HWAddr: net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA},
<mask> Hostname: "myhost",
<mask> }
<mask>
<mask> return []dhcpd.Lease{l}
<mask> }
<mask> func (d *testDHCP) SetOnLeaseChanged(onLeaseChanged dhcpd.OnLeaseChangedT) {}
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code </s> remove l := Lease{
</s> add l := &Lease{ </s> remove l := Lease{
</s> add l := &Lease{ </s> remove stLeases := []Lease{{
</s> add stLeases := []*Lease{{ </s> remove leases := []Lease{{
</s> add leases := []*Lease{{ </s> remove l := Lease{
</s> add l := &Lease{ | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/dnsforward/dnsforward_test.go |
keep add keep keep keep keep keep | <mask>
<mask> t.Run("complicated", func(t *testing.T) {
<mask> testIP := net.IP{1, 2, 3, 4}
<mask>
<mask> // First, init a DHCP server with a single static lease.
<mask> config := dhcpd.ServerConfig{
<mask> Enabled: true,
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code </s> remove clients.dhcpServer = dhcpd.Create(config)
</s> add clients.dhcpServer, err = dhcpd.Create(config)
require.NoError(t, err)
</s> remove require.Nil(t, err)
</s> add require.NoError(t, err) </s> remove // ResetLeases - reset leases
ResetLeases(leases []*Lease)
// GetLeases - get leases
GetLeases(flags int) []Lease
</s> add // ResetLeases resets leases.
ResetLeases(leases []*Lease) (err error)
// GetLeases returns deep clones of the current leases.
GetLeases(flags GetLeasesFlags) (leases []*Lease) </s> remove func (s *v6Server) rmDynamicLease(lease Lease) error {
</s> add func (s *v6Server) rmDynamicLease(lease *Lease) (err error) { </s> remove AddStaticLease(lease Lease) error
</s> add AddStaticLease(l *Lease) (err error) </s> remove RemoveStaticLease(l Lease) error
</s> add RemoveStaticLease(l *Lease) (err error) | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/home/clients_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> RangeEnd: net.IP{1, 2, 3, 10},
<mask> },
<mask> }
<mask>
<mask> clients.dhcpServer = dhcpd.Create(config)
<mask> t.Cleanup(func() { _ = os.Remove("leases.db") })
<mask>
<mask> err := clients.dhcpServer.AddStaticLease(dhcpd.Lease{
<mask> HWAddr: net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA},
<mask> IP: testIP,
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code </s> remove err := clients.dhcpServer.AddStaticLease(dhcpd.Lease{
</s> add err = clients.dhcpServer.AddStaticLease(&dhcpd.Lease{ </s> remove leases := []Lease{{
</s> add leases := []*Lease{{ </s> remove stLeases := []Lease{{
</s> add stLeases := []*Lease{{ </s> remove require.Nil(t, s.AddStaticLease(l))
</s> add err = s.AddStaticLease(l)
require.NoError(t, err) </s> remove stLeases := []Lease{{
</s> add stLeases := []*Lease{{ </s> remove err = s.RemoveStaticLease(Lease{
</s> add err = s.RemoveStaticLease(&Lease{ | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/home/clients_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> clients.dhcpServer = dhcpd.Create(config)
<mask> t.Cleanup(func() { _ = os.Remove("leases.db") })
<mask>
<mask> err := clients.dhcpServer.AddStaticLease(dhcpd.Lease{
<mask> HWAddr: net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA},
<mask> IP: testIP,
<mask> Hostname: "testhost",
<mask> Expiry: time.Now().Add(time.Hour),
<mask> })
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code </s> remove clients.dhcpServer = dhcpd.Create(config)
</s> add clients.dhcpServer, err = dhcpd.Create(config)
require.NoError(t, err)
</s> remove leases := []Lease{{
</s> add leases := []*Lease{{ </s> remove err = s.RemoveStaticLease(Lease{
</s> add err = s.RemoveStaticLease(&Lease{ </s> remove l := Lease{
</s> add l := &Lease{ </s> remove stLeases := []Lease{{
</s> add stLeases := []*Lease{{ </s> remove require.Nil(t, s.AddStaticLease(l))
</s> add err = s.AddStaticLease(l)
require.NoError(t, err) | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/home/clients_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> config.DHCP.WorkDir = Context.workDir
<mask> config.DHCP.HTTPRegister = httpRegister
<mask> config.DHCP.ConfigModified = onConfigModified
<mask>
<mask> Context.dhcpServer = dhcpd.Create(config.DHCP)
<mask> if Context.dhcpServer == nil {
<mask> // TODO(a.garipov): There are a lot of places in the code right
<mask> // now which assume that the DHCP server can be nil despite this
<mask> // condition. Inspect them and perhaps rewrite them to use
<mask> // Enabled() instead.
<mask> return fmt.Errorf("initing dhcp: %w", err)
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code </s> remove if conf.V6 != nil {
v6Conf := v6JSONToServerConf(conf.V6)
v6Conf.Enabled = conf.Enabled == nbTrue
if len(v6Conf.RangeStart) == 0 {
v6Conf.Enabled = false
}
// Don't overwrite the RA/SLAAC settings from the config file.
//
// TODO(a.garipov): Perhaps include them into the request to
// allow changing them from the HTTP API?
v6Conf.RASLAACOnly = s.conf.Conf6.RASLAACOnly
v6Conf.RAAllowSLAAC = s.conf.Conf6.RAAllowSLAAC
v6Enabled = v6Conf.Enabled
v6Conf.InterfaceName = conf.InterfaceName
v6Conf.notify = s.onNotify
s6, err = v6Create(v6Conf)
if err != nil {
httpError(r, w, http.StatusBadRequest,
"invalid dhcpv6 configuration: %s", err)
</s> add srv6, v6Enabled, err := s.handleDHCPSetConfigV6(conf)
if err != nil {
httpError(r, w, http.StatusBadRequest, "bad dhcpv6 configuration: %s", err) </s> remove err := s.srv.Close()
</s> add err = s.srv.Close() </s> remove // TODO(a.garipov): Remove the silly bit twiddling and make GetLeases
// accept booleans. Seriously, this doesn't even save stack space.
</s> add </s> remove res = []Lease{}
</s> add leases = []*Lease{} </s> remove log.Error("dhcpv4: srv.Close: %s", err)
</s> add return fmt.Errorf("closing dhcpv4 srv: %w", err) </s> remove // we can't delay database loading until DHCP server is started,
// because we need static leases functionality available beforehand
s.dbLoad()
return s
</s> add // Don't delay database loading until the DHCP server is started,
// because we need static leases functionality available beforehand.
err = s.dbLoad()
if err != nil {
return nil, fmt.Errorf("loading db: %w", err)
}
return s, nil | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/home/home.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> // cleanup stops and resets all the modules.
<mask> func cleanup(ctx context.Context) {
<mask> log.Info("Stopping AdGuard Home")
<mask>
<mask> if Context.web != nil {
<mask> Context.web.Close(ctx)
<mask> Context.web = nil
<mask> }
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code </s> remove log.Error("dhcpv4: srv.Close: %s", err)
</s> add return fmt.Errorf("closing dhcpv4 srv: %w", err) </s> remove // ResetLeases - reset leases
func (s *v4Server) ResetLeases(leases []*Lease) {
var err error
</s> add // ResetLeases resets leases.
func (s *v4Server) ResetLeases(leases []*Lease) (err error) {
defer func() { err = errors.Annotate(err, "dhcpv4: %w") }() </s> remove // ResetLeases - reset leases
func (s *v6Server) ResetLeases(ll []*Lease) {
</s> add // ResetLeases resets leases.
func (s *v6Server) ResetLeases(leases []*Lease) (err error) {
defer func() { err = errors.Annotate(err, "dhcpv4: %w") }()
</s> remove err := s.srv.Close()
</s> add err = s.srv.Close() </s> remove // flags for Leases() function
const (
LeasesDynamic = 1
LeasesStatic = 2
LeasesAll = LeasesDynamic | LeasesStatic
)
</s> add err = s.srv6.Stop()
if err != nil {
return err
}
return nil
} </s> remove func (s *Server) Stop() {
s.srv4.Stop()
s.srv6.Stop()
}
</s> add func (s *Server) Stop() (err error) {
err = s.srv4.Stop()
if err != nil {
return err
} | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/home/home.go |
keep keep replace keep keep keep replace keep keep keep keep | <mask> err := stopDNSServer()
<mask> if err != nil {
<mask> log.Error("Couldn't stop DNS server: %s", err)
<mask> }
<mask>
<mask> if Context.dhcpServer != nil {
<mask> Context.dhcpServer.Stop()
<mask> }
<mask>
<mask> Context.etcHosts.Close()
<mask>
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code </s> remove func (s *v6Server) Stop() {
err := s.ra.Close()
</s> add func (s *v6Server) Stop() (err error) {
err = s.ra.Close() </s> remove s.Stop()
</s> add err := s.Stop()
if err != nil {
httpError(r, w, http.StatusInternalServerError, "stopping dhcp: %s", err)
return
} </s> remove log.Error("dhcpv6: s.ra.Close: %s", err)
</s> add return fmt.Errorf("closing ra ctx: %w", err) </s> remove s.Stop()
</s> add err = s.Stop()
if err != nil {
httpError(r, w, http.StatusInternalServerError, "stopping dhcp: %s", err)
return
} </s> remove s.dbLoad()
</s> add err = s.dbLoad()
if err != nil {
httpError(r, w, http.StatusInternalServerError, "loading leases db: %s", err)
return
} | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | internal/home/home.go |
keep keep keep add keep keep keep keep | <mask> 'application/json':
<mask> 'schema':
<mask> '$ref': '#/components/schemas/Error'
<mask> 'description': 'Not implemented (for example, on Windows).'
<mask> '/filtering/status':
<mask> 'get':
<mask> 'tags':
<mask> - 'filtering'
</s> Pull request: dhcpd: add purge, imp code
Updates #1691.
Squashed commit of the following:
commit 2ce6cc005d09ac7d63e4e575705d86e92046697f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:42:57 2021 +0300
dhcp: imp code
commit 8f2bd7048d864e10aaed9e7338c0bbe852699a31
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Wed Jun 16 16:27:06 2021 +0300
dhcpd: add purge, imp code </s> remove log.Error("dhcp: can't store lease table on disk: %v filename: %s",
err, s.conf.DBFilePath)
return
</s> add return fmt.Errorf("writing db: %w", err) </s> remove log.Error("json.Marshal: %v", err)
return
</s> add return fmt.Errorf("encoding db: %w", err) </s> remove Stop()
</s> add Stop() (err error) </s> remove Start() error
</s> add Start() (err error) </s> remove // ResetLeases - reset leases
ResetLeases(leases []*Lease)
// GetLeases - get leases
GetLeases(flags int) []Lease
</s> add // ResetLeases resets leases.
ResetLeases(leases []*Lease) (err error)
// GetLeases returns deep clones of the current leases.
GetLeases(flags GetLeasesFlags) (leases []*Lease) </s> remove AddStaticLease(lease Lease) error
</s> add AddStaticLease(l *Lease) (err error) | https://github.com/AdguardTeam/AdGuardHome/commit/84e71e912e9f8808b396f171cc97b0a0d6f43814 | openapi/openapi.yaml |
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 = ioutil.WriteFile(configfile, yamlText, 0644)
<mask> if err != nil {
<mask> log.Printf("Couldn't write YAML config: %s", err)
<mask> return err
<mask> }
<mask> return nil
</s> Be more atomic during writing of files -- this prevents other processes from seeing empty or impartial files </s> add err = os.Rename(configfile+".tmp", configfile)
if err != nil {
log.Printf("Couldn't rename YAML config: %s", err)
return err
} </s> remove err = ioutil.WriteFile(corefile, []byte(configtext), 0644)
</s> add err = ioutil.WriteFile(corefile+".tmp", []byte(configtext), 0644) </s> add err = os.Rename(corefile+".tmp", corefile)
if err != nil {
log.Printf("Couldn't rename DNS config: %s", err)
} </s> add err = os.Rename(filterpath+".tmp", filterpath)
if err != nil {
log.Printf("Couldn't rename filter file: %s", err)
return err
} </s> remove err := ioutil.WriteFile(filterpath, data, 0644)
</s> add err := ioutil.WriteFile(filterpath+".tmp", data, 0644) | https://github.com/AdguardTeam/AdGuardHome/commit/859f1590dd25c633358bcc4182a0df66d7c35b09 | config.go |
keep keep keep add keep keep keep keep keep keep | <mask> if err != nil {
<mask> log.Printf("Couldn't write YAML config: %s", err)
<mask> return err
<mask> }
<mask> return nil
<mask> }
<mask>
<mask> // --------------
<mask> // coredns config
<mask> // --------------
</s> Be more atomic during writing of files -- this prevents other processes from seeing empty or impartial files </s> add err = os.Rename(filterpath+".tmp", filterpath)
if err != nil {
log.Printf("Couldn't rename filter file: %s", err)
return err
} </s> remove err = ioutil.WriteFile(configfile, yamlText, 0644)
</s> add err = ioutil.WriteFile(configfile+".tmp", yamlText, 0644) </s> remove err = ioutil.WriteFile(corefile, []byte(configtext), 0644)
</s> add err = ioutil.WriteFile(corefile+".tmp", []byte(configtext), 0644) </s> add err = os.Rename(corefile+".tmp", corefile)
if err != nil {
log.Printf("Couldn't rename DNS config: %s", err)
} </s> remove err := ioutil.WriteFile(filterpath, data, 0644)
</s> add err := ioutil.WriteFile(filterpath+".tmp", data, 0644) | https://github.com/AdguardTeam/AdGuardHome/commit/859f1590dd25c633358bcc4182a0df66d7c35b09 | config.go |
keep keep keep keep replace keep keep keep keep keep | <mask> if err != nil {
<mask> log.Printf("Couldn't generate DNS config: %s", err)
<mask> return err
<mask> }
<mask> err = ioutil.WriteFile(corefile, []byte(configtext), 0644)
<mask> if err != nil {
<mask> log.Printf("Couldn't write DNS config: %s", err)
<mask> }
<mask> return err
<mask> }
</s> Be more atomic during writing of files -- this prevents other processes from seeing empty or impartial files </s> add err = os.Rename(corefile+".tmp", corefile)
if err != nil {
log.Printf("Couldn't rename DNS config: %s", err)
} </s> remove err = ioutil.WriteFile(configfile, yamlText, 0644)
</s> add err = ioutil.WriteFile(configfile+".tmp", yamlText, 0644) </s> add err = os.Rename(configfile+".tmp", configfile)
if err != nil {
log.Printf("Couldn't rename YAML config: %s", err)
return err
} </s> add err = os.Rename(filterpath+".tmp", filterpath)
if err != nil {
log.Printf("Couldn't rename filter file: %s", err)
return err
} </s> remove err := ioutil.WriteFile(filterpath, data, 0644)
</s> add err := ioutil.WriteFile(filterpath+".tmp", data, 0644) | https://github.com/AdguardTeam/AdGuardHome/commit/859f1590dd25c633358bcc4182a0df66d7c35b09 | config.go |
keep keep keep add keep keep keep keep | <mask> err = ioutil.WriteFile(corefile+".tmp", []byte(configtext), 0644)
<mask> if err != nil {
<mask> log.Printf("Couldn't write DNS config: %s", err)
<mask> }
<mask> return err
<mask> }
<mask>
<mask> func writeAllConfigs() error {
</s> Be more atomic during writing of files -- this prevents other processes from seeing empty or impartial files </s> remove err = ioutil.WriteFile(corefile, []byte(configtext), 0644)
</s> add err = ioutil.WriteFile(corefile+".tmp", []byte(configtext), 0644) </s> remove err = ioutil.WriteFile(configfile, yamlText, 0644)
</s> add err = ioutil.WriteFile(configfile+".tmp", yamlText, 0644) </s> add err = os.Rename(configfile+".tmp", configfile)
if err != nil {
log.Printf("Couldn't rename YAML config: %s", err)
return err
} </s> remove err := ioutil.WriteFile(filterpath, data, 0644)
</s> add err := ioutil.WriteFile(filterpath+".tmp", data, 0644) </s> add err = os.Rename(filterpath+".tmp", filterpath)
if err != nil {
log.Printf("Couldn't rename filter file: %s", err)
return err
} | https://github.com/AdguardTeam/AdGuardHome/commit/859f1590dd25c633358bcc4182a0df66d7c35b09 | config.go |
keep keep keep keep replace keep keep keep keep keep | <mask> for _, rule := range config.UserRules {
<mask> data = append(data, []byte(rule)...)
<mask> data = append(data, '\n')
<mask> }
<mask> err := ioutil.WriteFile(filterpath, data, 0644)
<mask> if err != nil {
<mask> log.Printf("Couldn't write filter file: %s", err)
<mask> return err
<mask> }
<mask> return nil
</s> Be more atomic during writing of files -- this prevents other processes from seeing empty or impartial files </s> add err = os.Rename(filterpath+".tmp", filterpath)
if err != nil {
log.Printf("Couldn't rename filter file: %s", err)
return err
} </s> remove err = ioutil.WriteFile(configfile, yamlText, 0644)
</s> add err = ioutil.WriteFile(configfile+".tmp", yamlText, 0644) </s> remove err = ioutil.WriteFile(corefile, []byte(configtext), 0644)
</s> add err = ioutil.WriteFile(corefile+".tmp", []byte(configtext), 0644) </s> add err = os.Rename(corefile+".tmp", corefile)
if err != nil {
log.Printf("Couldn't rename DNS config: %s", err)
} </s> add err = os.Rename(configfile+".tmp", configfile)
if err != nil {
log.Printf("Couldn't rename YAML config: %s", err)
return err
} | https://github.com/AdguardTeam/AdGuardHome/commit/859f1590dd25c633358bcc4182a0df66d7c35b09 | control.go |
keep add keep keep keep keep keep keep | <mask> return err
<mask> }
<mask> return nil
<mask> }
<mask>
<mask> // ------------
<mask> // safebrowsing
<mask> // ------------
</s> Be more atomic during writing of files -- this prevents other processes from seeing empty or impartial files </s> add err = os.Rename(configfile+".tmp", configfile)
if err != nil {
log.Printf("Couldn't rename YAML config: %s", err)
return err
} </s> remove err = ioutil.WriteFile(configfile, yamlText, 0644)
</s> add err = ioutil.WriteFile(configfile+".tmp", yamlText, 0644) </s> remove err = ioutil.WriteFile(corefile, []byte(configtext), 0644)
</s> add err = ioutil.WriteFile(corefile+".tmp", []byte(configtext), 0644) </s> remove err := ioutil.WriteFile(filterpath, data, 0644)
</s> add err := ioutil.WriteFile(filterpath+".tmp", data, 0644) </s> add err = os.Rename(corefile+".tmp", corefile)
if err != nil {
log.Printf("Couldn't rename DNS config: %s", err)
} | https://github.com/AdguardTeam/AdGuardHome/commit/859f1590dd25c633358bcc4182a0df66d7c35b09 | control.go |
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep replace | <mask> netInterface: (*netInterface)(iface),
<mask> })
<mask> }
<mask>
<mask> // GetValidNetInterfaces returns interfaces that are eligible for DNS and/or DHCP
<mask> // invalid interface is a ppp interface or the one that doesn't allow broadcasts
<mask> func GetValidNetInterfaces() ([]net.Interface, error) {
<mask> ifaces, err := net.Interfaces()
<mask> if err != nil {
<mask> return nil, fmt.Errorf("couldn't get list of interfaces: %w", err)
<mask> }
<mask>
<mask> netIfaces := []net.Interface{}
<mask>
<mask> netIfaces = append(netIfaces, ifaces...)
<mask>
<mask> return netIfaces, nil
<mask> }
<mask>
<mask> // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only
<mask> // we do not return link-local addresses here
<mask> func GetValidNetInterfacesForWeb() ([]*NetInterface, error) {
<mask> ifaces, err := GetValidNetInterfaces()
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove ifaces, err := aghnet.GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) </s> remove // Refresh refreshes the local resolvers' addresses cache. It should be
</s> add // refresh refreshes the local resolvers' addresses cache. It should be </s> add // TODO(e.burkov): Consistently use req instead of d.Req since it is
// declared. | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/net.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> return portInfo.static, nil
<mask> }
<mask>
<mask> // getCurrentHardwarePortInfo gets information the specified network interface.
<mask> func getCurrentHardwarePortInfo(ifaceName string) (hardwarePortInfo, error) {
<mask> // First of all we should find hardware port name
<mask> m := getNetworkSetupHardwareReports()
<mask> hardwarePort, ok := m[ifaceName]
<mask> if !ok {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove s.tablePTRLock.Unlock()
</s> add return "", false
}
host, ok = s.tablePTR[ip.String()]
return host, ok
}
// Respond to PTR requests if the target IP is leased by our DHCP server and the
// requestor is inside the local network.
func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil { </s> remove ifaces, err := GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() </s> remove s.tableHostToIPLock.Lock()
if s.tableHostToIP == nil {
s.tableHostToIPLock.Unlock()
return resultCodeSuccess
}
ip, ok := s.tableHostToIP[host]
s.tableHostToIPLock.Unlock()
</s> add // TODO(e.burkov): Restrict the access for external clients.
ip, ok := s.hostToIP(host) </s> remove host, ok := s.tablePTR[ip.String()]
s.tablePTRLock.Unlock()
</s> add ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
host, ok := s.ipToHost(ip) </s> remove // GetValidNetInterfaces returns interfaces that are eligible for DNS and/or DHCP
// invalid interface is a ppp interface or the one that doesn't allow broadcasts
func GetValidNetInterfaces() ([]net.Interface, error) {
ifaces, err := net.Interfaces()
if err != nil {
return nil, fmt.Errorf("couldn't get list of interfaces: %w", err)
}
netIfaces := []net.Interface{}
netIfaces = append(netIfaces, ifaces...)
return netIfaces, nil
}
</s> add </s> remove // This would be quite weird if we get here
</s> add // This would be quite weird if we get here. | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/net_darwin.go |
keep add keep keep keep keep keep keep | <mask>
<mask> import (
<mask> "testing"
<mask>
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "github.com/stretchr/testify/assert" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "bytes"
"encoding/binary"
"errors" </s> add "github.com/AdguardTeam/dnsproxy/upstream" </s> add "github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log" </s> add "github.com/stretchr/testify/require" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/net_test.go |
keep add keep keep keep keep | <mask> "testing"
<mask>
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> func TestGetValidNetInterfacesForWeb(t *testing.T) {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log" </s> add "github.com/stretchr/testify/require" </s> add "net" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/dnsproxy/upstream" </s> remove assert.NoError(t, sr.Refresh())
</s> add assert.NoError(t, sr.refresh()) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/net_test.go |
keep keep keep keep replace keep replace keep keep keep keep | <mask> type SystemResolvers interface {
<mask> // Get returns the slice of local resolvers' addresses.
<mask> // It should be safe for concurrent use.
<mask> Get() (rs []string)
<mask> // Refresh refreshes the local resolvers' addresses cache. It should be
<mask> // safe for concurrent use.
<mask> Refresh() (err error)
<mask> }
<mask>
<mask> const (
<mask> // fakeDialErr is an error which dialFunc is expected to return.
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove return nil, errors.New("bad")
</s> add return nil, fmt.Errorf("errupstream: %w", u.Err) </s> remove type TestErrUpstream struct{}
</s> add type TestErrUpstream struct {
// The error returned by Exchange may be unwraped to the Err.
Err error
} </s> remove ipset ipsetCtx
</s> add ipset ipsetCtx
subnetDetector *aghnet.SubnetDetector
localResolvers aghnet.Exchanger </s> add // That's weird.
//
// TODO(e.burkov): Research the cases when it could happen. </s> remove // GetValidNetInterfaces returns interfaces that are eligible for DNS and/or DHCP
// invalid interface is a ppp interface or the one that doesn't allow broadcasts
func GetValidNetInterfaces() ([]net.Interface, error) {
ifaces, err := net.Interfaces()
if err != nil {
return nil, fmt.Errorf("couldn't get list of interfaces: %w", err)
}
netIfaces := []net.Interface{}
netIfaces = append(netIfaces, ifaces...)
return netIfaces, nil
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/systemresolvers.go |
keep keep keep keep replace keep keep keep keep keep | <mask> defer agherr.LogPanic("systemResolvers")
<mask>
<mask> // TODO(e.burkov): Implement a functionality to stop ticker.
<mask> for range tickCh {
<mask> err := sr.Refresh()
<mask> if err != nil {
<mask> log.Error("systemResolvers: error in refreshing goroutine: %s", err)
<mask>
<mask> continue
<mask> }
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove for {
ip := <-r.ipChannel
</s> add defer agherr.LogPanic("rdns")
for ip := range r.ipCh {
host, err := r.resolve(ip)
if err != nil {
log.Error("rdns: resolving %q: %s", ip, err) </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) </s> add // TODO(e.burkov): Consistently use req instead of d.Req since it is
// declared. </s> remove err = sr.Refresh()
</s> add err = sr.refresh() </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { </s> remove ifaces, err := aghnet.GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/systemresolvers.go |
keep keep keep keep replace keep keep keep keep keep | <mask> ) (sr SystemResolvers, err error) {
<mask> sr = newSystemResolvers(refreshIvl, hostGenFunc)
<mask>
<mask> // Fill cache.
<mask> err = sr.Refresh()
<mask> if err != nil {
<mask> return nil, err
<mask> }
<mask>
<mask> if refreshIvl > 0 {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { </s> remove ifaces, err := GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() </s> remove err := sr.Refresh()
</s> add err := sr.refresh() </s> add setupResolvers()
</s> remove })
</s> add }
var resp *dns.Msg
if r.subnetDetector.IsLocallyServedNetwork(ip) {
resp, err = r.localResolvers.Exchange(msg)
} else {
resp, err = r.dnsServer.Exchange(msg)
} </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/systemresolvers.go |
keep keep keep keep replace keep keep keep keep keep | <mask> addrs map[string]unit
<mask> addrsLock sync.RWMutex
<mask> }
<mask>
<mask> func (sr *systemResolvers) Refresh() (err error) {
<mask> defer agherr.Annotate("systemResolvers: %w", &err)
<mask>
<mask> _, err = sr.resolver.LookupHost(context.Background(), sr.hostGenFunc())
<mask> dnserr := &net.DNSError{}
<mask> if errors.As(err, &dnserr) && dnserr.Err == fakeDialErr.Error() {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { </s> remove sr.addrs[address] = unit{}
</s> add sr.addrs[host] = unit{} </s> remove err = sr.Refresh()
</s> add err = sr.refresh() </s> remove host := r.resolve(ip)
if len(host) == 0 {
</s> add </s> remove ifaces, err := GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() </s> remove for {
ip := <-r.ipChannel
</s> add defer agherr.LogPanic("rdns")
for ip := range r.ipCh {
host, err := r.resolve(ip)
if err != nil {
log.Error("rdns: resolving %q: %s", ip, err) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/systemresolvers_others.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> sr.addrsLock.Lock()
<mask> defer sr.addrsLock.Unlock()
<mask>
<mask> sr.addrs[address] = unit{}
<mask>
<mask> return nil, fakeDialErr
<mask> }
<mask>
<mask> func (sr *systemResolvers) Get() (rs []string) {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { </s> remove Refresh() (err error)
</s> add refresh() (err error) </s> remove // Refresh refreshes the local resolvers' addresses cache. It should be
</s> add // refresh refreshes the local resolvers' addresses cache. It should be </s> remove err = sr.Refresh()
</s> add err = sr.refresh() </s> add defer s.tablePTRLock.Unlock()
| https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/systemresolvers_others.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func TestSystemResolvers_Refresh(t *testing.T) {
<mask> t.Run("expected_error", func(t *testing.T) {
<mask> sr := createTestSystemResolvers(t, 0, nil)
<mask>
<mask> assert.NoError(t, sr.Refresh())
<mask> })
<mask>
<mask> t.Run("unexpected_error", func(t *testing.T) {
<mask> _, err := NewSystemResolvers(0, func() string {
<mask> return "127.0.0.1::123"
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove
func TestDNSReverseAddr(t *testing.T) {
testCases := []struct {
name string
have string
want net.IP
}{{
name: "good_ipv4",
have: "1.0.0.127.in-addr.arpa",
want: net.IP{127, 0, 0, 1},
}, {
name: "good_ipv6",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "good_ipv6_case",
have: "4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "bad_ipv4_dot",
have: "1.0.0.127.in-addr.arpa.",
}, {
name: "wrong_ipv4",
have: ".0.0.127.in-addr.arpa",
}, {
name: "wrong_ipv6",
have: ".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}, {
name: "bad_ipv6_dot",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa",
}, {
name: "bad_ipv6_space",
have: "4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
ip := DNSUnreverseAddr(tc.have)
assert.True(t, tc.want.Equal(ip))
})
}
}
</s> add </s> remove func TestResolveRDNS(t *testing.T) {
ups := &aghtest.TestUpstream{
</s> add func TestRDNS_Begin(t *testing.T) {
aghtest.ReplaceLogLevel(t, log.DEBUG)
w := &bytes.Buffer{}
aghtest.ReplaceLogWriter(t, w)
ip1234, ip1235 := net.IP{1, 2, 3, 4}, net.IP{1, 2, 3, 5}
testCases := []struct {
cliIDIndex map[string]*Client
customChan chan net.IP
name string
wantLog string
req net.IP
wantCacheHit int
wantCacheMiss int
}{{
cliIDIndex: map[string]*Client{},
customChan: nil,
name: "cached",
wantLog: "",
req: ip1234,
wantCacheHit: 1,
wantCacheMiss: 0,
}, {
cliIDIndex: map[string]*Client{},
customChan: nil,
name: "not_cached",
wantLog: "rdns: queue is full",
req: ip1235,
wantCacheHit: 0,
wantCacheMiss: 1,
}, {
cliIDIndex: map[string]*Client{"1.2.3.5": {}},
customChan: nil,
name: "already_in_clients",
wantLog: "",
req: ip1235,
wantCacheHit: 0,
wantCacheMiss: 1,
}, {
cliIDIndex: map[string]*Client{},
customChan: make(chan net.IP, 1),
name: "add_to_queue",
wantLog: `rdns: "1.2.3.5" added to queue`,
req: ip1235,
wantCacheHit: 0,
wantCacheMiss: 1,
}}
for _, tc := range testCases {
w.Reset()
ipCache := cache.New(cache.Config{
EnableLRU: true,
MaxCount: defaultRDNSCacheSize,
})
ttl := make([]byte, binary.Size(uint64(0)))
binary.BigEndian.PutUint64(ttl, uint64(time.Now().Add(100*time.Hour).Unix()))
rdns := &RDNS{
ipCache: ipCache,
clients: &clientsContainer{
list: map[string]*Client{},
idIndex: tc.cliIDIndex,
ipHost: map[string]*ClientHost{},
allTags: map[string]bool{},
},
}
ipCache.Clear()
ipCache.Set(net.IP{1, 2, 3, 4}, ttl)
if tc.customChan != nil {
rdns.ipCh = tc.customChan
defer close(tc.customChan)
}
t.Run(tc.name, func(t *testing.T) {
rdns.Begin(tc.req)
assert.Equal(t, tc.wantCacheHit, ipCache.Stats().Hit)
assert.Equal(t, tc.wantCacheMiss, ipCache.Stats().Miss)
assert.Contains(t, w.String(), tc.wantLog)
})
}
}
func TestRDNS_Resolve(t *testing.T) {
extUpstream := &aghtest.TestUpstream{ </s> remove clients := &clientsContainer{}
rdns := InitRDNS(dns, clients)
r := rdns.resolve(net.IP{1, 1, 1, 1})
assert.Equal(t, "one.one.one.one", r, r)
</s> add cc := &clientsContainer{}
snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
localIP := net.IP{192, 168, 1, 1}
testCases := []struct {
name string
want string
wantErr error
locUpstream upstream.Upstream
req net.IP
}{{
name: "external_good",
want: "one.one.one.one",
wantErr: nil,
locUpstream: nil,
req: net.IP{1, 1, 1, 1},
}, {
name: "local_good",
want: "local.domain",
wantErr: nil,
locUpstream: locUpstream,
req: localIP,
}, {
name: "upstream_error",
want: "",
wantErr: upstreamErr,
locUpstream: errUpstream,
req: localIP,
}, {
name: "empty_answer_error",
want: "",
wantErr: rDNSEmptyAnswerErr,
locUpstream: locUpstream,
req: net.IP{192, 168, 1, 2},
}, {
name: "not_ptr_error",
want: "",
wantErr: rDNSNotPTRErr,
locUpstream: nonPtrUpstream,
req: localIP,
}}
for _, tc := range testCases {
rdns := NewRDNS(dns, cc, snd, &aghtest.Exchanger{
Ups: tc.locUpstream,
})
t.Run(tc.name, func(t *testing.T) {
r, rerr := rdns.resolve(tc.req)
require.ErrorIs(t, rerr, tc.wantErr)
assert.Equal(t, tc.want, r)
})
}
}
func TestRDNS_WorkerLoop(t *testing.T) {
aghtest.ReplaceLogLevel(t, log.DEBUG)
w := &bytes.Buffer{}
aghtest.ReplaceLogWriter(t, w)
locUpstream := &aghtest.TestUpstream{
Reverse: map[string][]string{
"1.1.168.192.in-addr.arpa.": {"local.domain"},
},
}
snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
testCases := []struct {
wantLog string
name string
cliIP net.IP
}{{
wantLog: "",
name: "all_good",
cliIP: net.IP{192, 168, 1, 1},
}, {
wantLog: `rdns: resolving "192.168.1.2": lookup for "2.1.168.192.in-addr.arpa.": ` +
string(rDNSEmptyAnswerErr),
name: "resolve_error",
cliIP: net.IP{192, 168, 1, 2},
}}
for _, tc := range testCases {
w.Reset()
lr := &aghtest.Exchanger{
Ups: locUpstream,
}
cc := &clientsContainer{
list: map[string]*Client{},
idIndex: map[string]*Client{},
ipHost: map[string]*ClientHost{},
allTags: map[string]bool{},
}
ch := make(chan net.IP)
rdns := &RDNS{
dnsServer: nil,
clients: cc,
subnetDetector: snd,
localResolvers: lr,
ipCh: ch,
}
t.Run(tc.name, func(t *testing.T) {
var wg sync.WaitGroup
wg.Add(1)
go func() {
rdns.workerLoop()
wg.Done()
}()
ch <- tc.cliIP
close(ch)
wg.Wait()
if tc.wantLog != "" {
assert.Contains(t, w.String(), tc.wantLog)
return
}
assert.True(t, cc.Exists(tc.cliIP.String(), ClientSourceRDNS))
})
} </s> add "github.com/stretchr/testify/require" </s> add "github.com/stretchr/testify/assert" </s> add "github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/systemresolvers_others_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> return addrs, nil
<mask> }
<mask>
<mask> func (sr *systemResolvers) Refresh() (err error) {
<mask> defer agherr.Annotate("systemResolvers: %w", &err)
<mask>
<mask> got, err := sr.getAddrs()
<mask> if err != nil {
<mask> return fmt.Errorf("can't get addresses: %w", err)
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { </s> remove ifaces, err := GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() </s> remove // GetValidNetInterfaces returns interfaces that are eligible for DNS and/or DHCP
// invalid interface is a ppp interface or the one that doesn't allow broadcasts
func GetValidNetInterfaces() ([]net.Interface, error) {
ifaces, err := net.Interfaces()
if err != nil {
return nil, fmt.Errorf("couldn't get list of interfaces: %w", err)
}
netIfaces := []net.Interface{}
netIfaces = append(netIfaces, ifaces...)
return netIfaces, nil
}
</s> add </s> remove err = sr.Refresh()
</s> add err = sr.refresh() </s> remove ifaces, err := aghnet.GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() </s> remove sr.addrs[address] = unit{}
</s> add sr.addrs[host] = unit{} | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghnet/systemresolvers_windows.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> import (
<mask> "crypto/sha256"
<mask> "encoding/hex"
<mask> "errors"
<mask> "fmt"
<mask> "net"
<mask> "strings"
<mask> "sync"
<mask>
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "fmt" </s> add "bytes"
"encoding/binary"
"errors" </s> add "errors" </s> add "sync" </s> add "time" </s> add "net" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghtest/upstream.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> for _, n := range names {
<mask> resp.Answer = append(resp.Answer, &dns.PTR{
<mask> Hdr: dns.RR_Header{
<mask> Name: name,
<mask> Rrtype: rrType,
<mask> },
<mask> Ptr: n,
<mask> })
<mask> }
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove ptr := &dns.PTR{}
ptr.Hdr = dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
}
ptr.Ptr = host + "."
</s> add ptr := &dns.PTR{
Hdr: dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
},
Ptr: dns.Fqdn(host),
} </s> add req := d.Req </s> remove A: make([]byte, len(ip)),
</s> add A: ip, </s> remove
copy(a.A, ip)
</s> add </s> remove Name: name,
</s> add Name: arpa, </s> remove
func TestDNSReverseAddr(t *testing.T) {
testCases := []struct {
name string
have string
want net.IP
}{{
name: "good_ipv4",
have: "1.0.0.127.in-addr.arpa",
want: net.IP{127, 0, 0, 1},
}, {
name: "good_ipv6",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "good_ipv6_case",
have: "4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "bad_ipv4_dot",
have: "1.0.0.127.in-addr.arpa.",
}, {
name: "wrong_ipv4",
have: ".0.0.127.in-addr.arpa",
}, {
name: "wrong_ipv6",
have: ".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}, {
name: "bad_ipv6_dot",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa",
}, {
name: "bad_ipv6_space",
have: "4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
ip := DNSUnreverseAddr(tc.have)
assert.True(t, tc.want.Equal(ip))
})
}
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghtest/upstream.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }
<mask>
<mask> // TestErrUpstream implements upstream.Upstream interface for replacing real
<mask> // upstream in tests.
<mask> type TestErrUpstream struct{}
<mask>
<mask> // Exchange always returns nil Msg and non-nil error.
<mask> func (u *TestErrUpstream) Exchange(*dns.Msg) (*dns.Msg, error) {
<mask> // We don't use an agherr.Error to avoid the import cycle since aghtests
<mask> // used to provide the utilities for testing which agherr (and any other
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove return nil, errors.New("bad")
</s> add return nil, fmt.Errorf("errupstream: %w", u.Err) </s> remove Refresh() (err error)
</s> add refresh() (err error) </s> remove // Refresh refreshes the local resolvers' addresses cache. It should be
</s> add // refresh refreshes the local resolvers' addresses cache. It should be </s> add // Don't handle any errors since AddHost doesn't return non-nil
// errors for now. </s> add // That's weird.
//
// TODO(e.burkov): Research the cases when it could happen. </s> remove // GetValidNetInterfaces returns interfaces that are eligible for DNS and/or DHCP
// invalid interface is a ppp interface or the one that doesn't allow broadcasts
func GetValidNetInterfaces() ([]net.Interface, error) {
ifaces, err := net.Interfaces()
if err != nil {
return nil, fmt.Errorf("couldn't get list of interfaces: %w", err)
}
netIfaces := []net.Interface{}
netIfaces = append(netIfaces, ifaces...)
return netIfaces, nil
}
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghtest/upstream.go |
keep keep keep keep replace keep keep keep keep keep | <mask> func (u *TestErrUpstream) Exchange(*dns.Msg) (*dns.Msg, error) {
<mask> // We don't use an agherr.Error to avoid the import cycle since aghtests
<mask> // used to provide the utilities for testing which agherr (and any other
<mask> // testable package) should be able to use.
<mask> return nil, errors.New("bad")
<mask> }
<mask>
<mask> // Address always returns an empty string.
<mask> func (u *TestErrUpstream) Address() string {
<mask> return ""
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove type TestErrUpstream struct{}
</s> add type TestErrUpstream struct {
// The error returned by Exchange may be unwraped to the Err.
Err error
} </s> remove Refresh() (err error)
</s> add refresh() (err error) </s> remove // Refresh refreshes the local resolvers' addresses cache. It should be
</s> add // refresh refreshes the local resolvers' addresses cache. It should be </s> add // That's weird.
//
// TODO(e.burkov): Research the cases when it could happen. </s> add // TODO(e.burkov): Consistently use req instead of d.Req since it is
// declared. </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/aghtest/upstream.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> func (s *Server) handleDHCPInterfaces(w http.ResponseWriter, r *http.Request) {
<mask> response := map[string]netInterfaceJSON{}
<mask>
<mask> ifaces, err := aghnet.GetValidNetInterfaces()
<mask> if err != nil {
<mask> httpError(r, w, http.StatusInternalServerError, "Couldn't get interfaces: %s", err)
<mask> return
<mask> }
<mask>
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove ifaces, err := GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() </s> remove // GetValidNetInterfaces returns interfaces that are eligible for DNS and/or DHCP
// invalid interface is a ppp interface or the one that doesn't allow broadcasts
func GetValidNetInterfaces() ([]net.Interface, error) {
ifaces, err := net.Interfaces()
if err != nil {
return nil, fmt.Errorf("couldn't get list of interfaces: %w", err)
}
netIfaces := []net.Interface{}
netIfaces = append(netIfaces, ifaces...)
return netIfaces, nil
}
</s> add </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { </s> add // TODO(e.burkov): Consistently use req instead of d.Req since it is
// declared. </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) </s> remove err := sr.Refresh()
</s> add err := sr.refresh() | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dhcpd/http.go |
keep keep add keep keep keep keep keep keep | <mask> package dnsforward
<mask>
<mask> import (
<mask> "net"
<mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "fmt" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> remove "errors"
</s> add </s> add "bytes"
"encoding/binary"
"errors" </s> add "net" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep keep add keep keep keep keep keep | <mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/miekg/dns"
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove "github.com/AdguardTeam/AdGuardHome/internal/util"
</s> add </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/util"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/dnsproxy/upstream" </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep add keep keep keep keep | <mask> // response is modified by filters.
<mask> origResp *dns.Msg
<mask> // err is the error returned from a processing function.
<mask> err error
<mask> // clientID is the clientID from DOH, DOQ, or DOT, if provided.
<mask> clientID string
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) </s> remove // Use rDNS to get hostname by IP address
func (r *RDNS) resolve(ip net.IP) string {
log.Tracef("Resolving host for %s", ip)
</s> add const (
// rDNSEmptyAnswerErr is returned by RDNS resolve method when the answer
// section of respond is empty.
rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" </s> remove Refresh() (err error)
</s> add refresh() (err error) </s> remove type TestErrUpstream struct{}
</s> add type TestErrUpstream struct {
// The error returned by Exchange may be unwraped to the Err.
Err error
} </s> add defer clients.lock.Unlock()
</s> remove log.Tracef("rDNS: queue is full")
</s> add log.Tracef("rdns: queue is full") | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // appropriate handler.
<mask> mods := []modProcessFunc{
<mask> processInitial,
<mask> s.processInternalHosts,
<mask> processInternalIPAddrs,
<mask> processClientID,
<mask> processFilteringBeforeRequest,
<mask> processUpstream,
<mask> processDNSSECAfterResponse,
<mask> processFilteringAfterResponse,
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add s.processLocalPTR, </s> add // TODO(e.burkov): Consistently use req instead of d.Req since it is
// declared. </s> remove // Respond to PTR requests if the target IP address is leased by our DHCP server
func processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
req := ctx.proxyCtx.Req
if req.Question[0].Qtype != dns.TypePTR {
</s> add // processRestrictLocal responds with empty answers to PTR requests for IP
// addresses in locally-served network from external clients.
func (s *Server) processRestrictLocal(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
req := d.Req
q := req.Question[0]
if q.Qtype != dns.TypePTR {
// No need for restriction. </s> remove expire := r.ipAddrs.Get(ip)
if len(expire) != 0 {
exp := binary.BigEndian.Uint64(expire)
if exp > now {
</s> add if expire := r.ipCache.Get(ip); len(expire) != 0 {
if binary.BigEndian.Uint64(expire) > now { </s> remove // Begin - add IP address to rDNS queue
</s> add // Begin adds the ip to the resolving queue if it is not cached or already
// resolved. </s> remove for {
ip := <-r.ipChannel
</s> add defer agherr.LogPanic("rdns")
for ip := range r.ipCh {
host, err := r.resolve(ip)
if err != nil {
log.Error("rdns: resolving %q: %s", ip, err) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep keep add keep keep keep keep | <mask> s.processInternalIPAddrs,
<mask> processClientID,
<mask> processFilteringBeforeRequest,
<mask> processUpstream,
<mask> processDNSSECAfterResponse,
<mask> processFilteringAfterResponse,
<mask> s.ipset.process,
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove processInternalIPAddrs,
</s> add s.processRestrictLocal,
s.processInternalIPAddrs, </s> remove
func TestDNSReverseAddr(t *testing.T) {
testCases := []struct {
name string
have string
want net.IP
}{{
name: "good_ipv4",
have: "1.0.0.127.in-addr.arpa",
want: net.IP{127, 0, 0, 1},
}, {
name: "good_ipv6",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "good_ipv6_case",
have: "4.3.2.1.d.c.B.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
want: net.ParseIP("::abcd:1234"),
}, {
name: "bad_ipv4_dot",
have: "1.0.0.127.in-addr.arpa.",
}, {
name: "wrong_ipv4",
have: ".0.0.127.in-addr.arpa",
}, {
name: "wrong_ipv6",
have: ".3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}, {
name: "bad_ipv6_dot",
have: "4.3.2.1.d.c.b.a.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0..ip6.arpa",
}, {
name: "bad_ipv6_space",
have: "4.3.2.1.d.c.b. .0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
ip := DNSUnreverseAddr(tc.have)
assert.True(t, tc.want.Equal(ip))
})
}
}
</s> add </s> add "github.com/AdguardTeam/dnsproxy/upstream" </s> add // That's weird.
//
// TODO(e.burkov): Research the cases when it could happen. </s> add defer s.tablePTRLock.Unlock()
</s> remove s.tablePTRLock.Unlock()
</s> add return "", false
}
host, ok = s.tablePTR[ip.String()]
return host, ok
}
// Respond to PTR requests if the target IP is leased by our DHCP server and the
// requestor is inside the local network.
func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil { | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep | <mask> if host == reqHost {
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> s.tableHostToIPLock.Lock()
<mask> if s.tableHostToIP == nil {
<mask> s.tableHostToIPLock.Unlock()
<mask> return resultCodeSuccess
<mask> }
<mask> ip, ok := s.tableHostToIP[host]
<mask> s.tableHostToIPLock.Unlock()
<mask> if !ok {
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> log.Debug("dns: internal record: %s -> %s", q.Name, ip)
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove host, ok := s.tablePTR[ip.String()]
s.tablePTRLock.Unlock()
</s> add ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
host, ok := s.ipToHost(ip) </s> remove log.Debug("dns: reverse-lookup: %s -> %s", arpa, host)
</s> add log.Debug("dns: reverse-lookup: %s -> %s", ip, host) </s> remove arpa := req.Question[0].Name
arpa = strings.TrimSuffix(arpa, ".")
arpa = strings.ToLower(arpa)
ip := util.DNSUnreverseAddr(arpa)
</s> add ip := aghnet.UnreverseAddr(q.Name) </s> remove ctx.proxyCtx.Res = resp
</s> add d.Res = resp
return resultCodeSuccess
}
// processLocalPTR responds to PTR requests if the target IP is detected to be
// inside the local network and the query was not answered from DHCP.
func (s *Server) processLocalPTR(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil {
return resultCodeSuccess
}
ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
return resultCodeSuccess
}
req := d.Req
resp, err := s.localResolvers.Exchange(req)
if err != nil {
if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
ctx.err = err
return resultCodeError
}
d.Res = resp
</s> remove s.tablePTRLock.Unlock()
</s> add return "", false
}
host, ok = s.tablePTR[ip.String()]
return host, ok
}
// Respond to PTR requests if the target IP is leased by our DHCP server and the
// requestor is inside the local network.
func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil { </s> remove log.Debug("No answer for rDNS lookup of %s", ip)
return ""
</s> add return "", fmt.Errorf("lookup for %q: %w", arpa, rDNSEmptyAnswerErr) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep replace keep replace replace keep keep | <mask> Hdr: s.hdr(req, dns.TypeA),
<mask> A: make([]byte, len(ip)),
<mask> }
<mask>
<mask> copy(a.A, ip)
<mask> resp.Answer = append(resp.Answer, a)
<mask> }
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove Name: name,
</s> add Name: n, </s> remove ptr := &dns.PTR{}
ptr.Hdr = dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
}
ptr.Ptr = host + "."
</s> add ptr := &dns.PTR{
Hdr: dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
},
Ptr: dns.Fqdn(host),
} </s> remove expire = make([]byte, 8)
const ttl = 1 * 60 * 60
binary.BigEndian.PutUint64(expire, now+ttl)
_ = r.ipAddrs.Set(ip, expire)
</s> add // The cache entry either expired or doesn't exist.
ttl := make([]byte, 8)
binary.BigEndian.PutUint64(ttl, now+defaultRDNSCacheTTL)
r.ipCache.Set(ip, ttl) </s> remove case r.ipChannel <- ip:
//
</s> add case r.ipCh <- ip:
log.Tracef("rdns: %q added to queue", ip) </s> remove ctx.proxyCtx.Res = resp
</s> add d.Res = resp
return resultCodeSuccess
}
// processLocalPTR responds to PTR requests if the target IP is detected to be
// inside the local network and the query was not answered from DHCP.
func (s *Server) processLocalPTR(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil {
return resultCodeSuccess
}
ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
return resultCodeSuccess
}
req := d.Req
resp, err := s.localResolvers.Exchange(req)
if err != nil {
if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
ctx.err = err
return resultCodeError
}
d.Res = resp
| https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep keep replace replace replace replace replace keep keep keep replace replace replace replace keep keep | <mask> }
<mask>
<mask> // Respond to PTR requests if the target IP address is leased by our DHCP server
<mask> func processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
<mask> s := ctx.srv
<mask> req := ctx.proxyCtx.Req
<mask> if req.Question[0].Qtype != dns.TypePTR {
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> arpa := req.Question[0].Name
<mask> arpa = strings.TrimSuffix(arpa, ".")
<mask> arpa = strings.ToLower(arpa)
<mask> ip := util.DNSUnreverseAddr(arpa)
<mask> if ip == nil {
<mask> return resultCodeSuccess
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove s.tablePTRLock.Unlock()
</s> add return "", false
}
host, ok = s.tablePTR[ip.String()]
return host, ok
}
// Respond to PTR requests if the target IP is leased by our DHCP server and the
// requestor is inside the local network.
func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil { </s> remove ctx.proxyCtx.Res = resp
</s> add d.Res = resp
return resultCodeSuccess
}
// processLocalPTR responds to PTR requests if the target IP is detected to be
// inside the local network and the query was not answered from DHCP.
func (s *Server) processLocalPTR(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil {
return resultCodeSuccess
}
ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
return resultCodeSuccess
}
req := d.Req
resp, err := s.localResolvers.Exchange(req)
if err != nil {
if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
ctx.err = err
return resultCodeError
}
d.Res = resp
</s> remove host, ok := s.tablePTR[ip.String()]
s.tablePTRLock.Unlock()
</s> add ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
host, ok := s.ipToHost(ip) </s> remove for {
ip := <-r.ipChannel
</s> add defer agherr.LogPanic("rdns")
for ip := range r.ipCh {
host, err := r.resolve(ip)
if err != nil {
log.Error("rdns: resolving %q: %s", ip, err) </s> add // That's weird.
//
// TODO(e.burkov): Research the cases when it could happen. | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep keep keep add keep keep keep keep | <mask> }
<mask>
<mask> ip := aghnet.UnreverseAddr(q.Name)
<mask> if ip == nil {
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> // Restrict an access to local addresses for external clients. We also
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove s.tableHostToIPLock.Lock()
if s.tableHostToIP == nil {
s.tableHostToIPLock.Unlock()
return resultCodeSuccess
}
ip, ok := s.tableHostToIP[host]
s.tableHostToIPLock.Unlock()
</s> add // TODO(e.burkov): Restrict the access for external clients.
ip, ok := s.hostToIP(host) </s> remove arpa := req.Question[0].Name
arpa = strings.TrimSuffix(arpa, ".")
arpa = strings.ToLower(arpa)
ip := util.DNSUnreverseAddr(arpa)
</s> add ip := aghnet.UnreverseAddr(q.Name) </s> remove host, ok := s.tablePTR[ip.String()]
s.tablePTRLock.Unlock()
</s> add ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
host, ok := s.ipToHost(ip) </s> remove ctx.proxyCtx.Res = resp
</s> add d.Res = resp
return resultCodeSuccess
}
// processLocalPTR responds to PTR requests if the target IP is detected to be
// inside the local network and the query was not answered from DHCP.
func (s *Server) processLocalPTR(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil {
return resultCodeSuccess
}
ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
return resultCodeSuccess
}
req := d.Req
resp, err := s.localResolvers.Exchange(req)
if err != nil {
if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
ctx.err = err
return resultCodeError
}
d.Res = resp
</s> remove // Respond to PTR requests if the target IP address is leased by our DHCP server
func processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
req := ctx.proxyCtx.Req
if req.Question[0].Qtype != dns.TypePTR {
</s> add // processRestrictLocal responds with empty answers to PTR requests for IP
// addresses in locally-served network from external clients.
func (s *Server) processRestrictLocal(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
req := d.Req
q := req.Question[0]
if q.Qtype != dns.TypePTR {
// No need for restriction. </s> remove // Wait for a signal and then synchronously resolve hostname by IP address
// Add the hostname:IP pair to "Clients" array
</s> add // workerLoop handles incoming IP addresses from ipChan and adds it into
// clients. | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep add keep keep keep keep keep keep | <mask> func (s *Server) ipToHost(ip net.IP) (host string, ok bool) {
<mask> s.tablePTRLock.Lock()
<mask> if s.tablePTR == nil {
<mask> return "", false
<mask> }
<mask>
<mask> host, ok = s.tablePTR[ip.String()]
<mask>
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove s.tablePTRLock.Unlock()
</s> add return "", false
}
host, ok = s.tablePTR[ip.String()]
return host, ok
}
// Respond to PTR requests if the target IP is leased by our DHCP server and the
// requestor is inside the local network.
func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil { </s> remove host, ok := s.tablePTR[ip.String()]
s.tablePTRLock.Unlock()
</s> add ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
host, ok := s.ipToHost(ip) </s> remove clients.lock.Unlock()
</s> add </s> add defer clients.lock.Unlock()
</s> remove s.tableHostToIPLock.Lock()
if s.tableHostToIP == nil {
s.tableHostToIPLock.Unlock()
return resultCodeSuccess
}
ip, ok := s.tableHostToIP[host]
s.tableHostToIPLock.Unlock()
</s> add // TODO(e.burkov): Restrict the access for external clients.
ip, ok := s.hostToIP(host) </s> remove log.Debug("not a PTR response for %s", ip)
return ""
</s> add return "", fmt.Errorf("type checking: %w", rDNSNotPTRErr) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep replace replace | <mask> }
<mask>
<mask> s.tablePTRLock.Lock()
<mask> if s.tablePTR == nil {
<mask> s.tablePTRLock.Unlock()
<mask> return resultCodeSuccess
<mask> }
<mask> host, ok := s.tablePTR[ip.String()]
<mask> s.tablePTRLock.Unlock()
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add defer s.tablePTRLock.Unlock()
</s> remove arpa := req.Question[0].Name
arpa = strings.TrimSuffix(arpa, ".")
arpa = strings.ToLower(arpa)
ip := util.DNSUnreverseAddr(arpa)
</s> add ip := aghnet.UnreverseAddr(q.Name) </s> remove s.tableHostToIPLock.Lock()
if s.tableHostToIP == nil {
s.tableHostToIPLock.Unlock()
return resultCodeSuccess
}
ip, ok := s.tableHostToIP[host]
s.tableHostToIPLock.Unlock()
</s> add // TODO(e.burkov): Restrict the access for external clients.
ip, ok := s.hostToIP(host) </s> remove ctx.proxyCtx.Res = resp
</s> add d.Res = resp
return resultCodeSuccess
}
// processLocalPTR responds to PTR requests if the target IP is detected to be
// inside the local network and the query was not answered from DHCP.
func (s *Server) processLocalPTR(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil {
return resultCodeSuccess
}
ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
return resultCodeSuccess
}
req := d.Req
resp, err := s.localResolvers.Exchange(req)
if err != nil {
if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
ctx.err = err
return resultCodeError
}
d.Res = resp
</s> remove host := r.resolve(ip)
if len(host) == 0 {
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> if !ok {
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> log.Debug("dns: reverse-lookup: %s -> %s", arpa, host)
<mask>
<mask> resp := s.makeResponse(req)
<mask> ptr := &dns.PTR{}
<mask> ptr.Hdr = dns.RR_Header{
<mask> Name: req.Question[0].Name,
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove ptr := &dns.PTR{}
ptr.Hdr = dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
}
ptr.Ptr = host + "."
</s> add ptr := &dns.PTR{
Hdr: dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
},
Ptr: dns.Fqdn(host),
} </s> add req := d.Req </s> remove host, ok := s.tablePTR[ip.String()]
s.tablePTRLock.Unlock()
</s> add ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
host, ok := s.ipToHost(ip) </s> remove s.tableHostToIPLock.Lock()
if s.tableHostToIP == nil {
s.tableHostToIPLock.Unlock()
return resultCodeSuccess
}
ip, ok := s.tableHostToIP[host]
s.tableHostToIPLock.Unlock()
</s> add // TODO(e.burkov): Restrict the access for external clients.
ip, ok := s.hostToIP(host) </s> remove Name: name,
</s> add Name: n, </s> remove ctx.proxyCtx.Res = resp
</s> add d.Res = resp
return resultCodeSuccess
}
// processLocalPTR responds to PTR requests if the target IP is detected to be
// inside the local network and the query was not answered from DHCP.
func (s *Server) processLocalPTR(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil {
return resultCodeSuccess
}
ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
return resultCodeSuccess
}
req := d.Req
resp, err := s.localResolvers.Exchange(req)
if err != nil {
if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
ctx.err = err
return resultCodeError
}
d.Res = resp
| https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep add keep keep keep keep keep | <mask> log.Debug("dns: reverse-lookup: %s -> %s", ip, host)
<mask>
<mask> resp := s.makeResponse(req)
<mask> ptr := &dns.PTR{
<mask> Hdr: dns.RR_Header{
<mask> Name: req.Question[0].Name,
<mask> Rrtype: dns.TypePTR,
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove ptr := &dns.PTR{}
ptr.Hdr = dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
}
ptr.Ptr = host + "."
</s> add ptr := &dns.PTR{
Hdr: dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
},
Ptr: dns.Fqdn(host),
} </s> remove log.Debug("dns: reverse-lookup: %s -> %s", arpa, host)
</s> add log.Debug("dns: reverse-lookup: %s -> %s", ip, host) </s> remove Name: name,
</s> add Name: n, </s> remove host, ok := s.tablePTR[ip.String()]
s.tablePTRLock.Unlock()
</s> add ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
host, ok := s.ipToHost(ip) </s> remove s.tableHostToIPLock.Lock()
if s.tableHostToIP == nil {
s.tableHostToIPLock.Unlock()
return resultCodeSuccess
}
ip, ok := s.tableHostToIP[host]
s.tableHostToIPLock.Unlock()
</s> add // TODO(e.burkov): Restrict the access for external clients.
ip, ok := s.hostToIP(host) </s> remove })
</s> add }
var resp *dns.Msg
if r.subnetDetector.IsLocallyServedNetwork(ip) {
resp, err = r.localResolvers.Exchange(msg)
} else {
resp, err = r.dnsServer.Exchange(msg)
} | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep keep replace replace replace replace replace replace replace replace keep replace keep keep keep keep | <mask>
<mask> resp := s.makeResponse(req)
<mask> ptr := &dns.PTR{}
<mask> ptr.Hdr = dns.RR_Header{
<mask> Name: req.Question[0].Name,
<mask> Rrtype: dns.TypePTR,
<mask> Ttl: s.conf.BlockedResponseTTL,
<mask> Class: dns.ClassINET,
<mask> }
<mask> ptr.Ptr = host + "."
<mask> resp.Answer = append(resp.Answer, ptr)
<mask> ctx.proxyCtx.Res = resp
<mask> return resultCodeSuccess
<mask> }
<mask>
<mask> // Apply filtering logic
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove log.Debug("dns: reverse-lookup: %s -> %s", arpa, host)
</s> add log.Debug("dns: reverse-lookup: %s -> %s", ip, host) </s> add req := d.Req </s> remove Name: name,
</s> add Name: n, </s> remove
copy(a.A, ip)
</s> add </s> remove })
</s> add }
var resp *dns.Msg
if r.subnetDetector.IsLocallyServedNetwork(ip) {
resp, err = r.localResolvers.Exchange(msg)
} else {
resp, err = r.dnsServer.Exchange(msg)
} | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns.go |
keep add keep keep keep keep keep | <mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/dnsproxy/upstream"
<mask> "github.com/miekg/dns"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "github.com/AdguardTeam/dnsproxy/upstream" </s> add "github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log" </s> add "net" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/stretchr/testify/assert" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/util"
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns_test.go |
keep keep add keep keep keep keep keep | <mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/miekg/dns"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/util"
</s> add </s> add "github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "net" </s> add "github.com/stretchr/testify/assert" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dns_test.go |
keep keep keep add keep keep keep keep keep keep | <mask> "runtime"
<mask> "sync"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/querylog"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/stats"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/golibs/log"
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/util"
</s> add </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "time" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // autohostSuffix is the suffix used to detect internal hosts. It must
<mask> // be a valid top-level domain plus dots on each side.
<mask> autohostSuffix string
<mask>
<mask> ipset ipsetCtx
<mask>
<mask> tableHostToIP map[string]net.IP // "hostname -> IP" table for internal addresses (DHCP)
<mask> tableHostToIPLock sync.Mutex
<mask>
<mask> tablePTR map[string]string // "IP -> hostname" table for reverse lookup
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove Refresh() (err error)
</s> add refresh() (err error) </s> remove // Refresh refreshes the local resolvers' addresses cache. It should be
</s> add // refresh refreshes the local resolvers' addresses cache. It should be </s> remove s.tableHostToIPLock.Lock()
if s.tableHostToIP == nil {
s.tableHostToIPLock.Unlock()
return resultCodeSuccess
}
ip, ok := s.tableHostToIP[host]
s.tableHostToIPLock.Unlock()
</s> add // TODO(e.burkov): Restrict the access for external clients.
ip, ok := s.hostToIP(host) </s> remove DNSFilter *dnsfilter.DNSFilter
Stats stats.Stats
QueryLog querylog.QueryLog
DHCPServer dhcpd.ServerInterface
AutohostTLD string
</s> add DNSFilter *dnsfilter.DNSFilter
Stats stats.Stats
QueryLog querylog.QueryLog
DHCPServer dhcpd.ServerInterface
SubnetDetector *aghnet.SubnetDetector
LocalResolvers aghnet.Exchanger
AutohostTLD string </s> remove dnsServer *dnsforward.Server
clients *clientsContainer
ipChannel chan net.IP // pass data from DNS request handling thread to rDNS thread
// Contains IP addresses of clients to be resolved by rDNS
// If IP address is resolved, it stays here while it's inside Clients.
// If it's removed from Clients, this IP address will be resolved once again.
// If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP.
ipAddrs cache.Cache
</s> add dnsServer *dnsforward.Server
clients *clientsContainer
subnetDetector *aghnet.SubnetDetector
localResolvers aghnet.Exchanger
// ipCh used to pass client's IP to rDNS workerLoop.
ipCh chan net.IP
// ipCache caches the IP addresses to be resolved by rDNS. The resolved
// address stays here while it's inside clients. After leaving clients
// the address will be resolved once again. If the address couldn't be
// resolved, cache prevents further attempts to resolve it for some
// time.
ipCache cache.Cache </s> remove return nil, errors.New("bad")
</s> add return nil, fmt.Errorf("errupstream: %w", u.Err) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward.go |
keep keep keep keep replace replace replace replace replace keep keep keep keep keep | <mask> const defaultAutohostSuffix = ".lan."
<mask>
<mask> // DNSCreateParams are parameters to create a new server.
<mask> type DNSCreateParams struct {
<mask> DNSFilter *dnsfilter.DNSFilter
<mask> Stats stats.Stats
<mask> QueryLog querylog.QueryLog
<mask> DHCPServer dhcpd.ServerInterface
<mask> AutohostTLD string
<mask> }
<mask>
<mask> // tldToSuffix converts a top-level domain into an autohost suffix.
<mask> func tldToSuffix(tld string) (suffix string) {
<mask> l := len(tld) + 2
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove clients.lock.Unlock()
</s> add </s> remove type TestErrUpstream struct{}
</s> add type TestErrUpstream struct {
// The error returned by Exchange may be unwraped to the Err.
Err error
} </s> remove // getCurrentHardwarePortInfo gets information the specified network interface.
</s> add // getCurrentHardwarePortInfo gets information for the specified network interface. </s> remove ipset ipsetCtx
</s> add ipset ipsetCtx
subnetDetector *aghnet.SubnetDetector
localResolvers aghnet.Exchanger </s> add defer clients.lock.Unlock()
</s> remove // Wait for a signal and then synchronously resolve hostname by IP address
// Add the hostname:IP pair to "Clients" array
</s> add // workerLoop handles incoming IP addresses from ipChan and adds it into
// clients. | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward.go |
keep keep keep add keep keep keep keep keep | <mask> s = &Server{
<mask> dnsFilter: p.DNSFilter,
<mask> stats: p.Stats,
<mask> queryLog: p.QueryLog,
<mask> autohostSuffix: autohostSuffix,
<mask> }
<mask>
<mask> if p.DHCPServer != nil {
<mask> s.dhcpServer = p.DHCPServer
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove DNSFilter: Context.dnsFilter,
Stats: Context.stats,
QueryLog: Context.queryLog,
AutohostTLD: config.DNS.AutohostTLD,
</s> add DNSFilter: Context.dnsFilter,
Stats: Context.stats,
QueryLog: Context.queryLog,
SubnetDetector: Context.subnetDetector,
LocalResolvers: Context.localResolvers,
AutohostTLD: config.DNS.AutohostTLD, </s> add setupResolvers()
</s> remove Context.ipDetector, err = aghnet.NewIPDetector()
</s> add Context.subnetDetector, err = aghnet.NewSubnetDetector() </s> remove ctx.proxyCtx.Res = resp
</s> add d.Res = resp
return resultCodeSuccess
}
// processLocalPTR responds to PTR requests if the target IP is detected to be
// inside the local network and the query was not answered from DHCP.
func (s *Server) processLocalPTR(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil {
return resultCodeSuccess
}
ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
return resultCodeSuccess
}
req := d.Req
resp, err := s.localResolvers.Exchange(req)
if err != nil {
if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
ctx.err = err
return resultCodeError
}
d.Res = resp
</s> remove arpa := req.Question[0].Name
arpa = strings.TrimSuffix(arpa, ".")
arpa = strings.ToLower(arpa)
ip := util.DNSUnreverseAddr(arpa)
</s> add ip := aghnet.UnreverseAddr(q.Name) </s> remove err = sr.Refresh()
</s> add err = sr.refresh() | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward.go |
keep keep add keep keep keep keep | <mask> "testing"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/util"
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove "github.com/AdguardTeam/AdGuardHome/internal/util"
</s> add </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "time" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }}
<mask>
<mask> f := dnsfilter.New(filterConf, filters)
<mask>
<mask> s, err := NewServer(DNSCreateParams{DNSFilter: f})
<mask> require.NoError(t, err)
<mask>
<mask> s.conf = forwardConf
<mask>
<mask> err = s.Prepare(nil)
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector() </s> remove err = s.Prepare(&ServerConfig{
</s> add var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
})
require.NoError(t, err)
assert.NoError(t, s.Prepare(&ServerConfig{ </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: dnsfilter.New(&c, nil)})
</s> add var snd *aghnet.SubnetDetector
snd, err = aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&c, nil),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> add require.NotNil(t, snd) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> ID: 0,
<mask> Data: []byte(rules),
<mask> }}
<mask>
<mask> s, err := NewServer(DNSCreateParams{
<mask> DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
<mask> })
<mask> require.NoError(t, err)
<mask>
<mask> conf := &ServerConfig{
<mask> UDPListenAddrs: []*net.UDPAddr{{}},
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove err = s.Prepare(&ServerConfig{
</s> add var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
})
require.NoError(t, err)
assert.NoError(t, s.Prepare(&ServerConfig{ </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector() </s> add require.NotNil(t, snd) </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: dnsfilter.New(&c, nil)})
</s> add var snd *aghnet.SubnetDetector
snd, err = aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&c, nil),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> }},
<mask> }
<mask> f := dnsfilter.New(c, nil)
<mask>
<mask> s, err := NewServer(DNSCreateParams{DNSFilter: f})
<mask> require.NoError(t, err)
<mask>
<mask> err = s.Prepare(&ServerConfig{
<mask> UDPListenAddrs: []*net.UDPAddr{{}},
<mask> TCPListenAddrs: []*net.TCPAddr{{}},
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove err = s.Prepare(&ServerConfig{
</s> add var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
})
require.NoError(t, err)
assert.NoError(t, s.Prepare(&ServerConfig{ </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: dnsfilter.New(&c, nil)})
</s> add var snd *aghnet.SubnetDetector
snd, err = aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&c, nil),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> add require.NotNil(t, snd) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward_test.go |
keep keep add keep keep keep keep keep keep | <mask>
<mask> snd, err := aghnet.NewSubnetDetector()
<mask> require.NoError(t, err)
<mask>
<mask> var s *Server
<mask> s, err = NewServer(DNSCreateParams{
<mask> DNSFilter: f,
<mask> SubnetDetector: snd,
<mask> LocalResolvers: &aghtest.Exchanger{},
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> remove err = s.Prepare(&ServerConfig{
</s> add var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
})
require.NoError(t, err)
assert.NoError(t, s.Prepare(&ServerConfig{ </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: dnsfilter.New(&c, nil)})
</s> add var snd *aghnet.SubnetDetector
snd, err = aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&c, nil),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector() | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> s, err := NewServer(DNSCreateParams{DNSFilter: f})
<mask> require.NoError(t, err)
<mask>
<mask> err = s.Prepare(&ServerConfig{
<mask> UDPListenAddrs: []*net.UDPAddr{{}},
<mask> TCPListenAddrs: []*net.TCPAddr{{}},
<mask> FilteringConfig: FilteringConfig{
<mask> ProtectionEnabled: true,
<mask> UpstreamDNS: []string{"8.8.8.8:53"},
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector() </s> remove })
assert.NoError(t, err)
</s> add })) </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: dnsfilter.New(&c, nil)})
</s> add var snd *aghnet.SubnetDetector
snd, err = aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&c, nil),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> FilteringConfig: FilteringConfig{
<mask> ProtectionEnabled: true,
<mask> UpstreamDNS: []string{"8.8.8.8:53"},
<mask> },
<mask> })
<mask> assert.NoError(t, err)
<mask>
<mask> s.conf.UpstreamConfig.Upstreams = []upstream.Upstream{
<mask> &aghtest.TestUpstream{
<mask> CName: map[string]string{
<mask> "example.org": "somename",
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove err = s.Prepare(&ServerConfig{
</s> add var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
})
require.NoError(t, err)
assert.NoError(t, s.Prepare(&ServerConfig{ </s> add locUpstream := &aghtest.TestUpstream{
Reverse: map[string][]string{
"1.1.168.192.in-addr.arpa.": {"local.domain"},
"2.1.168.192.in-addr.arpa.": {},
},
}
upstreamErr := errors.New("upstream error")
errUpstream := &aghtest.TestErrUpstream{
Err: upstreamErr,
}
nonPtrUpstream := &aghtest.TestBlockUpstream{
Hostname: "some-host",
Block: true,
}
</s> remove Name: name,
</s> add Name: arpa, </s> remove assert.NoError(t, sr.Refresh())
</s> add assert.NoError(t, sr.refresh()) </s> add Compress: true, </s> remove resp, err := r.dnsServer.Exchange(&dns.Msg{
</s> add arpa := dns.Fqdn(aghnet.ReverseAddr(ip))
msg := &dns.Msg{ | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace replace replace keep keep keep keep keep | <mask> }
<mask> func (d *testDHCP) SetOnLeaseChanged(onLeaseChanged dhcpd.OnLeaseChangedT) {}
<mask>
<mask> func TestPTRResponseFromDHCPLeases(t *testing.T) {
<mask> s, err := NewServer(DNSCreateParams{
<mask> DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
<mask> DHCPServer: &testDHCP{},
<mask> })
<mask> require.NoError(t, err)
<mask>
<mask> s.conf.UDPListenAddrs = []*net.UDPAddr{{}}
<mask> s.conf.TCPListenAddrs = []*net.TCPAddr{{}}
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: dnsfilter.New(&c, nil)})
</s> add var snd *aghnet.SubnetDetector
snd, err = aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&c, nil),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove err = s.Prepare(&ServerConfig{
</s> add var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
})
require.NoError(t, err)
assert.NoError(t, s.Prepare(&ServerConfig{ </s> add require.NotNil(t, snd) </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector() | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward_test.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // Init auto hosts.
<mask> c.AutoHosts.Init(hf.Name())
<mask> t.Cleanup(c.AutoHosts.Close)
<mask>
<mask> s, err := NewServer(DNSCreateParams{DNSFilter: dnsfilter.New(&c, nil)})
<mask> require.NoError(t, err)
<mask>
<mask> s.conf.UDPListenAddrs = []*net.UDPAddr{{}}
<mask> s.conf.TCPListenAddrs = []*net.TCPAddr{{}}
<mask> s.conf.UpstreamDNS = []string{"127.0.0.1:53"}
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, nil),
DHCPServer: &testDHCP{},
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
}) </s> remove err = s.Prepare(&ServerConfig{
</s> add var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: f,
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{},
})
require.NoError(t, err)
assert.NoError(t, s.Prepare(&ServerConfig{ </s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector() </s> remove s, err := NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
</s> add snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
require.NotNil(t, snd)
var s *Server
s, err = NewServer(DNSCreateParams{
DNSFilter: dnsfilter.New(&dnsfilter.Config{}, filters),
SubnetDetector: snd,
LocalResolvers: &aghtest.Exchanger{}, </s> add require.NotNil(t, snd) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/dnsforward_test.go |
keep keep add keep keep keep keep keep keep | <mask> // was filtered.
<mask> func (s *Server) filterDNSRequest(ctx *dnsContext) (*dnsfilter.Result, error) {
<mask> d := ctx.proxyCtx
<mask> req := d.Req
<mask> host := strings.TrimSuffix(req.Question[0].Name, ".")
<mask> res, err := s.dnsFilter.CheckHost(host, d.Req.Question[0].Qtype, ctx.setts)
<mask> if err != nil {
<mask> // Return immediately if there's an error
<mask> return nil, fmt.Errorf("dnsfilter failed to check host %q: %w", host, err)
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove // Respond to PTR requests if the target IP address is leased by our DHCP server
func processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
req := ctx.proxyCtx.Req
if req.Question[0].Qtype != dns.TypePTR {
</s> add // processRestrictLocal responds with empty answers to PTR requests for IP
// addresses in locally-served network from external clients.
func (s *Server) processRestrictLocal(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
req := d.Req
q := req.Question[0]
if q.Qtype != dns.TypePTR {
// No need for restriction. </s> remove ctx.proxyCtx.Res = resp
</s> add d.Res = resp
return resultCodeSuccess
}
// processLocalPTR responds to PTR requests if the target IP is detected to be
// inside the local network and the query was not answered from DHCP.
func (s *Server) processLocalPTR(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil {
return resultCodeSuccess
}
ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
return resultCodeSuccess
}
req := d.Req
resp, err := s.localResolvers.Exchange(req)
if err != nil {
if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
ctx.err = err
return resultCodeError
}
d.Res = resp
</s> remove s.tablePTRLock.Unlock()
</s> add return "", false
}
host, ok = s.tablePTR[ip.String()]
return host, ok
}
// Respond to PTR requests if the target IP is leased by our DHCP server and the
// requestor is inside the local network.
func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil { </s> remove for {
ip := <-r.ipChannel
</s> add defer agherr.LogPanic("rdns")
for ip := range r.ipCh {
host, err := r.resolve(ip)
if err != nil {
log.Error("rdns: resolving %q: %s", ip, err) </s> remove ifaces, err := aghnet.GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() </s> remove ifaces, err := GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/dnsforward/filter.go |
keep keep keep add keep keep keep keep | <mask> // AddHost adds a new IP-hostname pairing. The priorities of the sources is
<mask> // taken into account. ok is true if the pairing was added.
<mask> func (clients *clientsContainer) AddHost(ip, host string, src clientSource) (ok bool, err error) {
<mask> clients.lock.Lock()
<mask> ok = clients.addHostLocked(ip, host, src)
<mask>
<mask> return ok, nil
<mask> }
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove clients.lock.Unlock()
</s> add </s> remove s.tablePTRLock.Unlock()
</s> add return "", false
}
host, ok = s.tablePTR[ip.String()]
return host, ok
}
// Respond to PTR requests if the target IP is leased by our DHCP server and the
// requestor is inside the local network.
func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil { </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) </s> add defer s.tablePTRLock.Unlock()
</s> add // TODO(e.burkov): Consistently use req instead of d.Req since it is
// declared. </s> remove // getCurrentHardwarePortInfo gets information the specified network interface.
</s> add // getCurrentHardwarePortInfo gets information for the specified network interface. | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/clients.go |
keep keep keep keep replace keep keep keep keep keep | <mask> // taken into account. ok is true if the pairing was added.
<mask> func (clients *clientsContainer) AddHost(ip, host string, src clientSource) (ok bool, err error) {
<mask> clients.lock.Lock()
<mask> ok = clients.addHostLocked(ip, host, src)
<mask> clients.lock.Unlock()
<mask>
<mask> return ok, nil
<mask> }
<mask>
<mask> // addHostLocked adds a new IP-hostname pairing. For internal use only.
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add defer clients.lock.Unlock()
</s> remove s.tablePTRLock.Unlock()
</s> add return "", false
}
host, ok = s.tablePTR[ip.String()]
return host, ok
}
// Respond to PTR requests if the target IP is leased by our DHCP server and the
// requestor is inside the local network.
func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil { </s> add defer s.tablePTRLock.Unlock()
</s> remove s.tableHostToIPLock.Lock()
if s.tableHostToIP == nil {
s.tableHostToIPLock.Unlock()
return resultCodeSuccess
}
ip, ok := s.tableHostToIP[host]
s.tableHostToIPLock.Unlock()
</s> add // TODO(e.burkov): Restrict the access for external clients.
ip, ok := s.hostToIP(host) </s> add // TODO(e.burkov): Consistently use req instead of d.Req since it is
// declared. </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/clients.go |
keep keep keep keep replace replace replace replace keep keep keep keep keep | <mask> filterConf.HTTPRegister = httpRegister
<mask> Context.dnsFilter = dnsfilter.New(&filterConf, nil)
<mask>
<mask> p := dnsforward.DNSCreateParams{
<mask> DNSFilter: Context.dnsFilter,
<mask> Stats: Context.stats,
<mask> QueryLog: Context.queryLog,
<mask> AutohostTLD: config.DNS.AutohostTLD,
<mask> }
<mask> if Context.dhcpServer != nil {
<mask> p.DHCPServer = Context.dhcpServer
<mask> }
<mask>
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add subnetDetector: p.SubnetDetector,
localResolvers: p.LocalResolvers, </s> remove arpa := req.Question[0].Name
arpa = strings.TrimSuffix(arpa, ".")
arpa = strings.ToLower(arpa)
ip := util.DNSUnreverseAddr(arpa)
</s> add ip := aghnet.UnreverseAddr(q.Name) </s> remove ctx.proxyCtx.Res = resp
</s> add d.Res = resp
return resultCodeSuccess
}
// processLocalPTR responds to PTR requests if the target IP is detected to be
// inside the local network and the query was not answered from DHCP.
func (s *Server) processLocalPTR(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil {
return resultCodeSuccess
}
ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
return resultCodeSuccess
}
req := d.Req
resp, err := s.localResolvers.Exchange(req)
if err != nil {
if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
ctx.err = err
return resultCodeError
}
d.Res = resp
</s> remove s, err := NewServer(DNSCreateParams{DNSFilter: f})
</s> add snd, err := aghnet.NewSubnetDetector() </s> remove ipReal := DNSUnreverseAddr(addr)
</s> add ipReal := aghnet.UnreverseAddr(addr) </s> remove Context.ipDetector, err = aghnet.NewIPDetector()
</s> add Context.subnetDetector, err = aghnet.NewSubnetDetector() | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> closeDNSServer()
<mask> return fmt.Errorf("dnsServer.Prepare: %w", err)
<mask> }
<mask>
<mask> Context.rdns = InitRDNS(Context.dnsServer, &Context.clients)
<mask> Context.whois = initWhois(&Context.clients)
<mask>
<mask> Context.filters.Init()
<mask> return nil
<mask> }
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { </s> remove log.Debug("Error while making an rDNS lookup for %s: %s", ip, err)
return ""
</s> add return "", fmt.Errorf("performing lookup for %q: %w", arpa, err) </s> remove log.Debug("not a PTR response for %s", ip)
return ""
</s> add return "", fmt.Errorf("type checking: %w", rDNSNotPTRErr) </s> remove // GetValidNetInterfaces returns interfaces that are eligible for DNS and/or DHCP
// invalid interface is a ppp interface or the one that doesn't allow broadcasts
func GetValidNetInterfaces() ([]net.Interface, error) {
ifaces, err := net.Interfaces()
if err != nil {
return nil, fmt.Errorf("couldn't get list of interfaces: %w", err)
}
netIfaces := []net.Interface{}
netIfaces = append(netIfaces, ifaces...)
return netIfaces, nil
}
</s> add </s> remove log.Debug("No answer for rDNS lookup of %s", ip)
return ""
</s> add return "", fmt.Errorf("lookup for %q: %w", arpa, rDNSEmptyAnswerErr) </s> remove })
</s> add }
var resp *dns.Msg
if r.subnetDetector.IsLocallyServedNetwork(ip) {
resp, err = r.localResolvers.Exchange(msg)
} else {
resp, err = r.dnsServer.Exchange(msg)
} | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> func onDNSRequest(d *proxy.DNSContext) {
<mask> ip := dnsforward.IPFromAddr(d.Addr)
<mask> if ip == nil {
<mask> // This would be quite weird if we get here
<mask> return
<mask> }
<mask>
<mask> if !ip.IsLoopback() {
<mask> Context.rdns.Begin(ip)
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove if !Context.ipDetector.DetectSpecialNetwork(ip) {
</s> add if !Context.subnetDetector.IsSpecialNetwork(ip) { </s> remove if !ip.IsLoopback() {
</s> add if !Context.subnetDetector.IsLocallyServedNetwork(ip) { </s> remove arpa := req.Question[0].Name
arpa = strings.TrimSuffix(arpa, ".")
arpa = strings.ToLower(arpa)
ip := util.DNSUnreverseAddr(arpa)
</s> add ip := aghnet.UnreverseAddr(q.Name) </s> remove host, ok := s.tablePTR[ip.String()]
s.tablePTRLock.Unlock()
</s> add ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
host, ok := s.ipToHost(ip) </s> remove ifaces, err := GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() </s> remove if !Context.ipDetector.DetectSpecialNetwork(ip) {
</s> add if !Context.subnetDetector.IsSpecialNetwork(ip) { | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask>
<mask> if !ip.IsLoopback() {
<mask> Context.rdns.Begin(ip)
<mask> }
<mask> if !Context.ipDetector.DetectSpecialNetwork(ip) {
<mask> Context.whois.Begin(ip)
<mask> }
<mask> }
<mask>
<mask> func ipsToTCPAddrs(ips []net.IP, port int) (tcpAddrs []*net.TCPAddr) {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove if !Context.ipDetector.DetectSpecialNetwork(ip) {
</s> add if !Context.subnetDetector.IsSpecialNetwork(ip) { </s> remove if !ip.IsLoopback() {
</s> add if !Context.subnetDetector.IsLocallyServedNetwork(ip) { </s> remove // This would be quite weird if we get here
</s> add // This would be quite weird if we get here. </s> remove // getCurrentHardwarePortInfo gets information the specified network interface.
</s> add // getCurrentHardwarePortInfo gets information for the specified network interface. </s> remove host := r.resolve(ip)
if len(host) == 0 {
</s> add </s> remove })
</s> add }
var resp *dns.Msg
if r.subnetDetector.IsLocallyServedNetwork(ip) {
resp, err = r.localResolvers.Exchange(msg)
} else {
resp, err = r.dnsServer.Exchange(msg)
} | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/dns.go |
keep replace keep keep replace keep keep keep | <mask> for _, ip := range Context.stats.GetTopClientsIP(topClientsNumber) {
<mask> if !ip.IsLoopback() {
<mask> Context.rdns.Begin(ip)
<mask> }
<mask> if !Context.ipDetector.DetectSpecialNetwork(ip) {
<mask> Context.whois.Begin(ip)
<mask> }
<mask> }
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove if !Context.ipDetector.DetectSpecialNetwork(ip) {
</s> add if !Context.subnetDetector.IsSpecialNetwork(ip) { </s> remove // This would be quite weird if we get here
</s> add // This would be quite weird if we get here. </s> remove host := r.resolve(ip)
if len(host) == 0 {
</s> add </s> remove Name: name,
</s> add Name: n, </s> remove for {
ip := <-r.ipChannel
</s> add defer agherr.LogPanic("rdns")
for ip := range r.ipCh {
host, err := r.resolve(ip)
if err != nil {
log.Error("rdns: resolving %q: %s", ip, err) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/dns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> tls *TLSMod // TLS module
<mask> autoHosts util.AutoHosts // IP-hostname pairs taken from system configuration (e.g. /etc/hosts) files
<mask> updater *updater.Updater
<mask>
<mask> ipDetector *aghnet.IPDetector
<mask>
<mask> // mux is our custom http.ServeMux.
<mask> mux *http.ServeMux
<mask>
<mask> // Runtime properties
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add defer clients.lock.Unlock()
</s> remove clients.lock.Unlock()
</s> add </s> add // unreversedReqIP stores an IP address obtained from PTR request if it
// was successfully parsed.
unreversedReqIP net.IP </s> remove // RDNS - module context
</s> add // RDNS resolves clients' addresses to enrich their metadata. </s> remove dnsServer *dnsforward.Server
clients *clientsContainer
ipChannel chan net.IP // pass data from DNS request handling thread to rDNS thread
// Contains IP addresses of clients to be resolved by rDNS
// If IP address is resolved, it stays here while it's inside Clients.
// If it's removed from Clients, this IP address will be resolved once again.
// If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP.
ipAddrs cache.Cache
</s> add dnsServer *dnsforward.Server
clients *clientsContainer
subnetDetector *aghnet.SubnetDetector
localResolvers aghnet.Exchanger
// ipCh used to pass client's IP to rDNS workerLoop.
ipCh chan net.IP
// ipCache caches the IP addresses to be resolved by rDNS. The resolved
// address stays here while it's inside clients. After leaving clients
// the address will be resolved once again. If the address couldn't be
// resolved, cache prevents further attempts to resolve it for some
// time.
ipCache cache.Cache </s> remove // Respond to PTR requests if the target IP address is leased by our DHCP server
func processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
s := ctx.srv
req := ctx.proxyCtx.Req
if req.Question[0].Qtype != dns.TypePTR {
</s> add // processRestrictLocal responds with empty answers to PTR requests for IP
// addresses in locally-served network from external clients.
func (s *Server) processRestrictLocal(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
req := d.Req
q := req.Question[0]
if q.Qtype != dns.TypePTR {
// No need for restriction. | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/home.go |
keep keep keep keep replace keep keep keep keep keep | <mask> if Context.web == nil {
<mask> log.Fatalf("Can't initialize Web module")
<mask> }
<mask>
<mask> Context.ipDetector, err = aghnet.NewIPDetector()
<mask> if err != nil {
<mask> log.Fatal(err)
<mask> }
<mask>
<mask> if !Context.firstRun {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add setupResolvers()
</s> remove })
</s> add }
var resp *dns.Msg
if r.subnetDetector.IsLocallyServedNetwork(ip) {
resp, err = r.localResolvers.Exchange(msg)
} else {
resp, err = r.dnsServer.Exchange(msg)
} </s> remove err = sr.Refresh()
</s> add err = sr.refresh() </s> remove ipReal := DNSUnreverseAddr(addr)
</s> add ipReal := aghnet.UnreverseAddr(addr) </s> remove ctx.proxyCtx.Res = resp
</s> add d.Res = resp
return resultCodeSuccess
}
// processLocalPTR responds to PTR requests if the target IP is detected to be
// inside the local network and the query was not answered from DHCP.
func (s *Server) processLocalPTR(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil {
return resultCodeSuccess
}
ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
if !s.subnetDetector.IsLocallyServedNetwork(ip) {
return resultCodeSuccess
}
req := d.Req
resp, err := s.localResolvers.Exchange(req)
if err != nil {
if errors.Is(err, aghnet.NoUpstreamsErr) {
d.Res = s.genNXDomain(req)
return resultCodeFinish
}
ctx.err = err
return resultCodeError
}
d.Res = resp
</s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/home.go |
keep keep keep add keep keep keep keep | <mask> if err != nil {
<mask> log.Fatal(err)
<mask> }
<mask>
<mask> if !Context.firstRun {
<mask> err = initDNSServer()
<mask> if err != nil {
<mask> log.Fatalf("%s", err)
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove Context.ipDetector, err = aghnet.NewIPDetector()
</s> add Context.subnetDetector, err = aghnet.NewSubnetDetector() </s> remove err = sr.Refresh()
</s> add err = sr.refresh() </s> remove })
</s> add }
var resp *dns.Msg
if r.subnetDetector.IsLocallyServedNetwork(ip) {
resp, err = r.localResolvers.Exchange(msg)
} else {
resp, err = r.dnsServer.Exchange(msg)
} </s> remove func (sr *systemResolvers) Refresh() (err error) {
</s> add func (sr *systemResolvers) refresh() (err error) { </s> remove err := sr.Refresh()
</s> add err := sr.refresh() </s> remove ifaces, err := aghnet.GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/home.go |
keep keep add keep keep keep keep keep | <mask>
<mask> import (
<mask> "encoding/binary"
<mask> "net"
<mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/agherr"
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "bytes"
"encoding/binary"
"errors" </s> add "errors" </s> remove "errors"
</s> add </s> add "github.com/AdguardTeam/AdGuardHome/internal/agherr"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "net" </s> add "sync" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep add keep keep keep keep keep | <mask> "strings"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
<mask> "github.com/AdguardTeam/golibs/cache"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/miekg/dns"
<mask> )
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> remove "github.com/AdguardTeam/AdGuardHome/internal/util"
</s> add </s> add "github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "time" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep keep keep replace keep replace replace replace replace replace replace replace replace replace keep keep keep keep | <mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/miekg/dns"
<mask> )
<mask>
<mask> // RDNS - module context
<mask> type RDNS struct {
<mask> dnsServer *dnsforward.Server
<mask> clients *clientsContainer
<mask> ipChannel chan net.IP // pass data from DNS request handling thread to rDNS thread
<mask>
<mask> // Contains IP addresses of clients to be resolved by rDNS
<mask> // If IP address is resolved, it stays here while it's inside Clients.
<mask> // If it's removed from Clients, this IP address will be resolved once again.
<mask> // If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP.
<mask> ipAddrs cache.Cache
<mask> }
<mask>
<mask> // InitRDNS - create module context
<mask> func InitRDNS(dnsServer *dnsforward.Server, clients *clientsContainer) *RDNS {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove // InitRDNS - create module context
func InitRDNS(dnsServer *dnsforward.Server, clients *clientsContainer) *RDNS {
r := &RDNS{
dnsServer: dnsServer,
clients: clients,
ipAddrs: cache.New(cache.Config{
</s> add // Default rDNS values.
const (
defaultRDNSCacheSize = 10000
defaultRDNSCacheTTL = 1 * 60 * 60
defaultRDNSIPChSize = 256
)
// NewRDNS creates and returns initialized RDNS.
func NewRDNS(
dnsServer *dnsforward.Server,
clients *clientsContainer,
snd *aghnet.SubnetDetector,
lr aghnet.Exchanger,
) (rDNS *RDNS) {
rDNS = &RDNS{
dnsServer: dnsServer,
clients: clients,
subnetDetector: snd,
localResolvers: lr,
ipCache: cache.New(cache.Config{ </s> remove // Wait for a signal and then synchronously resolve hostname by IP address
// Add the hostname:IP pair to "Clients" array
</s> add // workerLoop handles incoming IP addresses from ipChan and adds it into
// clients. </s> remove // Begin - add IP address to rDNS queue
</s> add // Begin adds the ip to the resolving queue if it is not cached or already
// resolved. </s> add // unreversedReqIP stores an IP address obtained from PTR request if it
// was successfully parsed.
unreversedReqIP net.IP </s> remove // Use rDNS to get hostname by IP address
func (r *RDNS) resolve(ip net.IP) string {
log.Tracef("Resolving host for %s", ip)
</s> add const (
// rDNSEmptyAnswerErr is returned by RDNS resolve method when the answer
// section of respond is empty.
rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep keep keep replace replace replace replace replace replace keep replace keep keep keep keep | <mask> // If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP.
<mask> ipAddrs cache.Cache
<mask> }
<mask>
<mask> // InitRDNS - create module context
<mask> func InitRDNS(dnsServer *dnsforward.Server, clients *clientsContainer) *RDNS {
<mask> r := &RDNS{
<mask> dnsServer: dnsServer,
<mask> clients: clients,
<mask> ipAddrs: cache.New(cache.Config{
<mask> EnableLRU: true,
<mask> MaxCount: 10000,
<mask> }),
<mask> ipChannel: make(chan net.IP, 256),
<mask> }
<mask>
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove dnsServer *dnsforward.Server
clients *clientsContainer
ipChannel chan net.IP // pass data from DNS request handling thread to rDNS thread
// Contains IP addresses of clients to be resolved by rDNS
// If IP address is resolved, it stays here while it's inside Clients.
// If it's removed from Clients, this IP address will be resolved once again.
// If IP address couldn't be resolved, it stays here for some time to prevent further attempts to resolve the same IP.
ipAddrs cache.Cache
</s> add dnsServer *dnsforward.Server
clients *clientsContainer
subnetDetector *aghnet.SubnetDetector
localResolvers aghnet.Exchanger
// ipCh used to pass client's IP to rDNS workerLoop.
ipCh chan net.IP
// ipCache caches the IP addresses to be resolved by rDNS. The resolved
// address stays here while it's inside clients. After leaving clients
// the address will be resolved once again. If the address couldn't be
// resolved, cache prevents further attempts to resolve it for some
// time.
ipCache cache.Cache </s> remove ipChannel: make(chan net.IP, 256),
</s> add ipCh: make(chan net.IP, defaultRDNSIPChSize), </s> remove go r.workerLoop()
return r
</s> add go rDNS.workerLoop()
return rDNS </s> remove // Begin - add IP address to rDNS queue
</s> add // Begin adds the ip to the resolving queue if it is not cached or already
// resolved. </s> remove // Wait for a signal and then synchronously resolve hostname by IP address
// Add the hostname:IP pair to "Clients" array
</s> add // workerLoop handles incoming IP addresses from ipChan and adds it into
// clients. | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep keep keep replace keep keep replace replace keep | <mask> ipAddrs: cache.New(cache.Config{
<mask> EnableLRU: true,
<mask> MaxCount: 10000,
<mask> }),
<mask> ipChannel: make(chan net.IP, 256),
<mask> }
<mask>
<mask> go r.workerLoop()
<mask> return r
<mask> }
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove MaxCount: 10000,
</s> add MaxCount: defaultRDNSCacheSize, </s> remove // InitRDNS - create module context
func InitRDNS(dnsServer *dnsforward.Server, clients *clientsContainer) *RDNS {
r := &RDNS{
dnsServer: dnsServer,
clients: clients,
ipAddrs: cache.New(cache.Config{
</s> add // Default rDNS values.
const (
defaultRDNSCacheSize = 10000
defaultRDNSCacheTTL = 1 * 60 * 60
defaultRDNSIPChSize = 256
)
// NewRDNS creates and returns initialized RDNS.
func NewRDNS(
dnsServer *dnsforward.Server,
clients *clientsContainer,
snd *aghnet.SubnetDetector,
lr aghnet.Exchanger,
) (rDNS *RDNS) {
rDNS = &RDNS{
dnsServer: dnsServer,
clients: clients,
subnetDetector: snd,
localResolvers: lr,
ipCache: cache.New(cache.Config{ </s> remove // Begin - add IP address to rDNS queue
</s> add // Begin adds the ip to the resolving queue if it is not cached or already
// resolved. </s> remove func TestResolveRDNS(t *testing.T) {
ups := &aghtest.TestUpstream{
</s> add func TestRDNS_Begin(t *testing.T) {
aghtest.ReplaceLogLevel(t, log.DEBUG)
w := &bytes.Buffer{}
aghtest.ReplaceLogWriter(t, w)
ip1234, ip1235 := net.IP{1, 2, 3, 4}, net.IP{1, 2, 3, 5}
testCases := []struct {
cliIDIndex map[string]*Client
customChan chan net.IP
name string
wantLog string
req net.IP
wantCacheHit int
wantCacheMiss int
}{{
cliIDIndex: map[string]*Client{},
customChan: nil,
name: "cached",
wantLog: "",
req: ip1234,
wantCacheHit: 1,
wantCacheMiss: 0,
}, {
cliIDIndex: map[string]*Client{},
customChan: nil,
name: "not_cached",
wantLog: "rdns: queue is full",
req: ip1235,
wantCacheHit: 0,
wantCacheMiss: 1,
}, {
cliIDIndex: map[string]*Client{"1.2.3.5": {}},
customChan: nil,
name: "already_in_clients",
wantLog: "",
req: ip1235,
wantCacheHit: 0,
wantCacheMiss: 1,
}, {
cliIDIndex: map[string]*Client{},
customChan: make(chan net.IP, 1),
name: "add_to_queue",
wantLog: `rdns: "1.2.3.5" added to queue`,
req: ip1235,
wantCacheHit: 0,
wantCacheMiss: 1,
}}
for _, tc := range testCases {
w.Reset()
ipCache := cache.New(cache.Config{
EnableLRU: true,
MaxCount: defaultRDNSCacheSize,
})
ttl := make([]byte, binary.Size(uint64(0)))
binary.BigEndian.PutUint64(ttl, uint64(time.Now().Add(100*time.Hour).Unix()))
rdns := &RDNS{
ipCache: ipCache,
clients: &clientsContainer{
list: map[string]*Client{},
idIndex: tc.cliIDIndex,
ipHost: map[string]*ClientHost{},
allTags: map[string]bool{},
},
}
ipCache.Clear()
ipCache.Set(net.IP{1, 2, 3, 4}, ttl)
if tc.customChan != nil {
rdns.ipCh = tc.customChan
defer close(tc.customChan)
}
t.Run(tc.name, func(t *testing.T) {
rdns.Begin(tc.req)
assert.Equal(t, tc.wantCacheHit, ipCache.Stats().Hit)
assert.Equal(t, tc.wantCacheMiss, ipCache.Stats().Miss)
assert.Contains(t, w.String(), tc.wantLog)
})
}
}
func TestRDNS_Resolve(t *testing.T) {
extUpstream := &aghtest.TestUpstream{ </s> add locUpstream := &aghtest.TestUpstream{
Reverse: map[string][]string{
"1.1.168.192.in-addr.arpa.": {"local.domain"},
"2.1.168.192.in-addr.arpa.": {},
},
}
upstreamErr := errors.New("upstream error")
errUpstream := &aghtest.TestErrUpstream{
Err: upstreamErr,
}
nonPtrUpstream := &aghtest.TestBlockUpstream{
Hostname: "some-host",
Block: true,
}
| https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep keep replace keep keep replace replace replace replace | <mask> return r
<mask> }
<mask>
<mask> // Begin - add IP address to rDNS queue
<mask> func (r *RDNS) Begin(ip net.IP) {
<mask> now := uint64(time.Now().Unix())
<mask> expire := r.ipAddrs.Get(ip)
<mask> if len(expire) != 0 {
<mask> exp := binary.BigEndian.Uint64(expire)
<mask> if exp > now {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove go r.workerLoop()
return r
</s> add go rDNS.workerLoop()
return rDNS </s> remove // TTL expired
</s> add </s> remove log.Tracef("rDNS: queue is full")
</s> add log.Tracef("rdns: queue is full") </s> remove for {
ip := <-r.ipChannel
</s> add defer agherr.LogPanic("rdns")
for ip := range r.ipCh {
host, err := r.resolve(ip)
if err != nil {
log.Error("rdns: resolving %q: %s", ip, err) </s> remove // Use rDNS to get hostname by IP address
func (r *RDNS) resolve(ip net.IP) string {
log.Tracef("Resolving host for %s", ip)
</s> add const (
// rDNSEmptyAnswerErr is returned by RDNS resolve method when the answer
// section of respond is empty.
rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep keep replace keep replace replace replace replace keep | <mask> if exp > now {
<mask> return
<mask> }
<mask> // TTL expired
<mask> }
<mask> expire = make([]byte, 8)
<mask> const ttl = 1 * 60 * 60
<mask> binary.BigEndian.PutUint64(expire, now+ttl)
<mask> _ = r.ipAddrs.Set(ip, expire)
<mask>
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove expire := r.ipAddrs.Get(ip)
if len(expire) != 0 {
exp := binary.BigEndian.Uint64(expire)
if exp > now {
</s> add if expire := r.ipCache.Get(ip); len(expire) != 0 {
if binary.BigEndian.Uint64(expire) > now { </s> remove // InitRDNS - create module context
func InitRDNS(dnsServer *dnsforward.Server, clients *clientsContainer) *RDNS {
r := &RDNS{
dnsServer: dnsServer,
clients: clients,
ipAddrs: cache.New(cache.Config{
</s> add // Default rDNS values.
const (
defaultRDNSCacheSize = 10000
defaultRDNSCacheTTL = 1 * 60 * 60
defaultRDNSIPChSize = 256
)
// NewRDNS creates and returns initialized RDNS.
func NewRDNS(
dnsServer *dnsforward.Server,
clients *clientsContainer,
snd *aghnet.SubnetDetector,
lr aghnet.Exchanger,
) (rDNS *RDNS) {
rDNS = &RDNS{
dnsServer: dnsServer,
clients: clients,
subnetDetector: snd,
localResolvers: lr,
ipCache: cache.New(cache.Config{ </s> remove // Begin - add IP address to rDNS queue
</s> add // Begin adds the ip to the resolving queue if it is not cached or already
// resolved. </s> remove err = sr.Refresh()
</s> add err = sr.refresh() </s> remove host := r.resolve(ip)
if len(host) == 0 {
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep keep replace keep replace replace keep | <mask> return
<mask> }
<mask>
<mask> log.Tracef("rDNS: adding %s", ip)
<mask> select {
<mask> case r.ipChannel <- ip:
<mask> //
<mask> default:
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove log.Tracef("rDNS: queue is full")
</s> add log.Tracef("rdns: queue is full") </s> remove // Use rDNS to get hostname by IP address
func (r *RDNS) resolve(ip net.IP) string {
log.Tracef("Resolving host for %s", ip)
</s> add const (
// rDNSEmptyAnswerErr is returned by RDNS resolve method when the answer
// section of respond is empty.
rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" </s> remove log.Debug("No answer for rDNS lookup of %s", ip)
return ""
</s> add return "", fmt.Errorf("lookup for %q: %w", arpa, rDNSEmptyAnswerErr) </s> remove log.Debug("not a PTR response for %s", ip)
return ""
</s> add return "", fmt.Errorf("type checking: %w", rDNSNotPTRErr) </s> remove log.Tracef("PTR response for %s: %s", ip, ptr.String())
if strings.HasSuffix(ptr.Ptr, ".") {
ptr.Ptr = ptr.Ptr[:len(ptr.Ptr)-1]
}
</s> add log.Tracef("rdns: ptr response for %q: %s", ip, ptr.String()) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep replace keep keep keep replace replace replace keep keep | <mask> //
<mask> default:
<mask> log.Tracef("rDNS: queue is full")
<mask> }
<mask> }
<mask>
<mask> // Use rDNS to get hostname by IP address
<mask> func (r *RDNS) resolve(ip net.IP) string {
<mask> log.Tracef("Resolving host for %s", ip)
<mask>
<mask> name, err := dns.ReverseAddr(ip.String())
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) </s> remove case r.ipChannel <- ip:
//
</s> add case r.ipCh <- ip:
log.Tracef("rdns: %q added to queue", ip) </s> remove log.Tracef("rDNS: adding %s", ip)
</s> add </s> remove go r.workerLoop()
return r
</s> add go rDNS.workerLoop()
return rDNS </s> remove // Begin - add IP address to rDNS queue
</s> add // Begin adds the ip to the resolving queue if it is not cached or already
// resolved. | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep replace replace replace replace replace keep replace keep | <mask>
<mask> name, err := dns.ReverseAddr(ip.String())
<mask> if err != nil {
<mask> log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
<mask> return ""
<mask> }
<mask>
<mask> resp, err := r.dnsServer.Exchange(&dns.Msg{
<mask> MsgHdr: dns.MsgHdr{
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove // Use rDNS to get hostname by IP address
func (r *RDNS) resolve(ip net.IP) string {
log.Tracef("Resolving host for %s", ip)
</s> add const (
// rDNSEmptyAnswerErr is returned by RDNS resolve method when the answer
// section of respond is empty.
rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" </s> remove })
</s> add }
var resp *dns.Msg
if r.subnetDetector.IsLocallyServedNetwork(ip) {
resp, err = r.localResolvers.Exchange(msg)
} else {
resp, err = r.dnsServer.Exchange(msg)
} </s> remove log.Debug("Error while making an rDNS lookup for %s: %s", ip, err)
return ""
</s> add return "", fmt.Errorf("performing lookup for %q: %w", arpa, err) </s> remove log.Debug("No answer for rDNS lookup of %s", ip)
return ""
</s> add return "", fmt.Errorf("lookup for %q: %w", arpa, rDNSEmptyAnswerErr) </s> remove ifaces, err := aghnet.GetValidNetInterfaces()
</s> add ifaces, err := net.Interfaces() | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep add keep keep keep keep keep | <mask> Id: dns.Id(),
<mask> RecursionDesired: true,
<mask> },
<mask> Question: []dns.Question{{
<mask> Name: arpa,
<mask> Qtype: dns.TypePTR,
<mask> Qclass: dns.ClassINET,
<mask> }},
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove Name: name,
</s> add Name: arpa, </s> remove resp, err := r.dnsServer.Exchange(&dns.Msg{
</s> add arpa := dns.Fqdn(aghnet.ReverseAddr(ip))
msg := &dns.Msg{ </s> remove })
</s> add }
var resp *dns.Msg
if r.subnetDetector.IsLocallyServedNetwork(ip) {
resp, err = r.localResolvers.Exchange(msg)
} else {
resp, err = r.dnsServer.Exchange(msg)
} </s> remove ptr := &dns.PTR{}
ptr.Hdr = dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
}
ptr.Ptr = host + "."
</s> add ptr := &dns.PTR{
Hdr: dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
},
Ptr: dns.Fqdn(host),
} </s> remove log.Debug("Error while making an rDNS lookup for %s: %s", ip, err)
return ""
</s> add return "", fmt.Errorf("performing lookup for %q: %w", arpa, err) </s> add req := d.Req | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep replace keep keep keep replace | <mask> Question: []dns.Question{{
<mask> Name: name,
<mask> Qtype: dns.TypePTR,
<mask> Qclass: dns.ClassINET,
<mask> }},
<mask> })
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add Compress: true, </s> remove ptr := &dns.PTR{}
ptr.Hdr = dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
}
ptr.Ptr = host + "."
</s> add ptr := &dns.PTR{
Hdr: dns.RR_Header{
Name: req.Question[0].Name,
Rrtype: dns.TypePTR,
Ttl: s.conf.BlockedResponseTTL,
Class: dns.ClassINET,
},
Ptr: dns.Fqdn(host),
} </s> remove Name: name,
</s> add Name: n, </s> remove log.Debug("Error while making an rDNS lookup for %s: %s", ip, err)
return ""
</s> add return "", fmt.Errorf("performing lookup for %q: %w", arpa, err) </s> remove resp, err := r.dnsServer.Exchange(&dns.Msg{
</s> add arpa := dns.Fqdn(aghnet.ReverseAddr(ip))
msg := &dns.Msg{ | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep replace replace keep keep replace replace keep keep | <mask> if err != nil {
<mask> log.Debug("Error while making an rDNS lookup for %s: %s", ip, err)
<mask> return ""
<mask> }
<mask> if len(resp.Answer) == 0 {
<mask> log.Debug("No answer for rDNS lookup of %s", ip)
<mask> return ""
<mask> }
<mask> ptr, ok := resp.Answer[0].(*dns.PTR)
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove })
</s> add }
var resp *dns.Msg
if r.subnetDetector.IsLocallyServedNetwork(ip) {
resp, err = r.localResolvers.Exchange(msg)
} else {
resp, err = r.dnsServer.Exchange(msg)
} </s> remove log.Debug("not a PTR response for %s", ip)
return ""
</s> add return "", fmt.Errorf("type checking: %w", rDNSNotPTRErr) </s> remove // Use rDNS to get hostname by IP address
func (r *RDNS) resolve(ip net.IP) string {
log.Tracef("Resolving host for %s", ip)
</s> add const (
// rDNSEmptyAnswerErr is returned by RDNS resolve method when the answer
// section of respond is empty.
rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) </s> remove log.Tracef("PTR response for %s: %s", ip, ptr.String())
if strings.HasSuffix(ptr.Ptr, ".") {
ptr.Ptr = ptr.Ptr[:len(ptr.Ptr)-1]
}
</s> add log.Tracef("rdns: ptr response for %q: %s", ip, ptr.String()) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep keep replace replace keep keep replace replace replace replace keep keep keep | <mask> }
<mask> ptr, ok := resp.Answer[0].(*dns.PTR)
<mask> if !ok {
<mask> log.Debug("not a PTR response for %s", ip)
<mask> return ""
<mask> }
<mask>
<mask> log.Tracef("PTR response for %s: %s", ip, ptr.String())
<mask> if strings.HasSuffix(ptr.Ptr, ".") {
<mask> ptr.Ptr = ptr.Ptr[:len(ptr.Ptr)-1]
<mask> }
<mask>
<mask> return ptr.Ptr
<mask> }
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove log.Debug("No answer for rDNS lookup of %s", ip)
return ""
</s> add return "", fmt.Errorf("lookup for %q: %w", arpa, rDNSEmptyAnswerErr) </s> remove return ptr.Ptr
</s> add return strings.TrimSuffix(ptr.Ptr, "."), nil </s> remove s.tableHostToIPLock.Lock()
if s.tableHostToIP == nil {
s.tableHostToIPLock.Unlock()
return resultCodeSuccess
}
ip, ok := s.tableHostToIP[host]
s.tableHostToIPLock.Unlock()
</s> add // TODO(e.burkov): Restrict the access for external clients.
ip, ok := s.hostToIP(host) </s> remove log.Debug("Error while making an rDNS lookup for %s: %s", ip, err)
return ""
</s> add return "", fmt.Errorf("performing lookup for %q: %w", arpa, err) </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep keep keep replace keep keep keep keep keep | <mask> if strings.HasSuffix(ptr.Ptr, ".") {
<mask> ptr.Ptr = ptr.Ptr[:len(ptr.Ptr)-1]
<mask> }
<mask>
<mask> return ptr.Ptr
<mask> }
<mask>
<mask> // Wait for a signal and then synchronously resolve hostname by IP address
<mask> // Add the hostname:IP pair to "Clients" array
<mask> func (r *RDNS) workerLoop() {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove // Wait for a signal and then synchronously resolve hostname by IP address
// Add the hostname:IP pair to "Clients" array
</s> add // workerLoop handles incoming IP addresses from ipChan and adds it into
// clients. </s> remove for {
ip := <-r.ipChannel
</s> add defer agherr.LogPanic("rdns")
for ip := range r.ipCh {
host, err := r.resolve(ip)
if err != nil {
log.Error("rdns: resolving %q: %s", ip, err) </s> remove log.Tracef("PTR response for %s: %s", ip, ptr.String())
if strings.HasSuffix(ptr.Ptr, ".") {
ptr.Ptr = ptr.Ptr[:len(ptr.Ptr)-1]
}
</s> add log.Tracef("rdns: ptr response for %q: %s", ip, ptr.String()) </s> remove log.Debug("not a PTR response for %s", ip)
return ""
</s> add return "", fmt.Errorf("type checking: %w", rDNSNotPTRErr) </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) </s> remove log.Tracef("rDNS: queue is full")
</s> add log.Tracef("rdns: queue is full") | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask>
<mask> return ptr.Ptr
<mask> }
<mask>
<mask> // Wait for a signal and then synchronously resolve hostname by IP address
<mask> // Add the hostname:IP pair to "Clients" array
<mask> func (r *RDNS) workerLoop() {
<mask> for {
<mask> ip := <-r.ipChannel
<mask>
<mask> host := r.resolve(ip)
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove return ptr.Ptr
</s> add return strings.TrimSuffix(ptr.Ptr, "."), nil </s> remove for {
ip := <-r.ipChannel
</s> add defer agherr.LogPanic("rdns")
for ip := range r.ipCh {
host, err := r.resolve(ip)
if err != nil {
log.Error("rdns: resolving %q: %s", ip, err) </s> remove log.Tracef("PTR response for %s: %s", ip, ptr.String())
if strings.HasSuffix(ptr.Ptr, ".") {
ptr.Ptr = ptr.Ptr[:len(ptr.Ptr)-1]
}
</s> add log.Tracef("rdns: ptr response for %q: %s", ip, ptr.String()) </s> remove host := r.resolve(ip)
if len(host) == 0 {
</s> add </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) </s> remove // Use rDNS to get hostname by IP address
func (r *RDNS) resolve(ip net.IP) string {
log.Tracef("Resolving host for %s", ip)
</s> add const (
// rDNSEmptyAnswerErr is returned by RDNS resolve method when the answer
// section of respond is empty.
rDNSEmptyAnswerErr agherr.Error = "the answer section is empty" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep keep replace replace keep replace replace keep | <mask> // Add the hostname:IP pair to "Clients" array
<mask> func (r *RDNS) workerLoop() {
<mask> for {
<mask> ip := <-r.ipChannel
<mask>
<mask> host := r.resolve(ip)
<mask> if len(host) == 0 {
<mask> continue
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove // Wait for a signal and then synchronously resolve hostname by IP address
// Add the hostname:IP pair to "Clients" array
</s> add // workerLoop handles incoming IP addresses from ipChan and adds it into
// clients. </s> remove return ptr.Ptr
</s> add return strings.TrimSuffix(ptr.Ptr, "."), nil </s> remove // Begin - add IP address to rDNS queue
</s> add // Begin adds the ip to the resolving queue if it is not cached or already
// resolved. </s> remove expire := r.ipAddrs.Get(ip)
if len(expire) != 0 {
exp := binary.BigEndian.Uint64(expire)
if exp > now {
</s> add if expire := r.ipCache.Get(ip); len(expire) != 0 {
if binary.BigEndian.Uint64(expire) > now { </s> remove name, err := dns.ReverseAddr(ip.String())
if err != nil {
log.Debug("Error while calling dns.ReverseAddr(%s): %s", ip, err)
return ""
}
</s> add // rDNSNotPTRErr is returned by RDNS resolve method when the response is
// not of PTR type.
rDNSNotPTRErr agherr.Error = "the response is not a ptr"
)
// resolve tries to resolve the ip in a suitable way.
func (r *RDNS) resolve(ip net.IP) (host string, err error) {
log.Tracef("rdns: resolving host for %q", ip) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep add keep keep keep | <mask> }
<mask>
<mask> _, _ = r.clients.AddHost(ip.String(), host, ClientSourceRDNS)
<mask> }
<mask> }
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> remove host := r.resolve(ip)
if len(host) == 0 {
</s> add </s> remove expire = make([]byte, 8)
const ttl = 1 * 60 * 60
binary.BigEndian.PutUint64(expire, now+ttl)
_ = r.ipAddrs.Set(ip, expire)
</s> add // The cache entry either expired or doesn't exist.
ttl := make([]byte, 8)
binary.BigEndian.PutUint64(ttl, now+defaultRDNSCacheTTL)
r.ipCache.Set(ip, ttl) </s> remove // TTL expired
</s> add </s> remove if !Context.ipDetector.DetectSpecialNetwork(ip) {
</s> add if !Context.subnetDetector.IsSpecialNetwork(ip) { </s> remove s.tablePTRLock.Unlock()
</s> add return "", false
}
host, ok = s.tablePTR[ip.String()]
return host, ok
}
// Respond to PTR requests if the target IP is leased by our DHCP server and the
// requestor is inside the local network.
func (s *Server) processInternalIPAddrs(ctx *dnsContext) (rc resultCode) {
d := ctx.proxyCtx
if d.Res != nil { </s> remove host, ok := s.tablePTR[ip.String()]
s.tablePTRLock.Unlock()
</s> add ip := ctx.unreversedReqIP
if ip == nil {
return resultCodeSuccess
}
host, ok := s.ipToHost(ip) | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns.go |
keep add keep keep keep keep keep | <mask>
<mask> import (
<mask> "net"
<mask> "sync"
<mask> "testing"
<mask> "time"
<mask>
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "net" </s> add "sync" </s> remove "errors"
</s> add </s> add "fmt" </s> add "time" </s> add "errors" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns_test.go |
keep add keep keep keep keep | <mask> "errors"
<mask> "net"
<mask> "testing"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "time" </s> add "bytes"
"encoding/binary"
"errors" </s> add "errors" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> remove "errors"
</s> add | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns_test.go |
keep keep keep add keep keep keep keep keep | <mask> "errors"
<mask> "net"
<mask> "sync"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "sync" </s> add "bytes"
"encoding/binary"
"errors" </s> remove "errors"
</s> add </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns_test.go |
keep keep keep add keep keep keep keep | <mask> "sync"
<mask> "testing"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
<mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/dnsproxy/upstream"
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "time" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "github.com/AdguardTeam/dnsproxy/upstream" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" </s> add "sync" </s> add "bytes"
"encoding/binary"
"errors" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns_test.go |
keep add keep keep keep keep keep | <mask> "github.com/AdguardTeam/dnsproxy/proxy"
<mask> "github.com/AdguardTeam/dnsproxy/upstream"
<mask> "github.com/stretchr/testify/assert"
<mask> "github.com/stretchr/testify/require"
<mask> )
<mask>
<mask> func TestRDNS_Begin(t *testing.T) {
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "github.com/stretchr/testify/require" </s> add "github.com/AdguardTeam/dnsproxy/upstream" </s> add "github.com/stretchr/testify/assert" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter" </s> add "net" </s> add "github.com/AdguardTeam/AdGuardHome/internal/aghnet" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns_test.go |
keep add keep keep keep keep keep | <mask> "github.com/AdguardTeam/golibs/log"
<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: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add "github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log" </s> remove func TestResolveRDNS(t *testing.T) {
ups := &aghtest.TestUpstream{
</s> add func TestRDNS_Begin(t *testing.T) {
aghtest.ReplaceLogLevel(t, log.DEBUG)
w := &bytes.Buffer{}
aghtest.ReplaceLogWriter(t, w)
ip1234, ip1235 := net.IP{1, 2, 3, 4}, net.IP{1, 2, 3, 5}
testCases := []struct {
cliIDIndex map[string]*Client
customChan chan net.IP
name string
wantLog string
req net.IP
wantCacheHit int
wantCacheMiss int
}{{
cliIDIndex: map[string]*Client{},
customChan: nil,
name: "cached",
wantLog: "",
req: ip1234,
wantCacheHit: 1,
wantCacheMiss: 0,
}, {
cliIDIndex: map[string]*Client{},
customChan: nil,
name: "not_cached",
wantLog: "rdns: queue is full",
req: ip1235,
wantCacheHit: 0,
wantCacheMiss: 1,
}, {
cliIDIndex: map[string]*Client{"1.2.3.5": {}},
customChan: nil,
name: "already_in_clients",
wantLog: "",
req: ip1235,
wantCacheHit: 0,
wantCacheMiss: 1,
}, {
cliIDIndex: map[string]*Client{},
customChan: make(chan net.IP, 1),
name: "add_to_queue",
wantLog: `rdns: "1.2.3.5" added to queue`,
req: ip1235,
wantCacheHit: 0,
wantCacheMiss: 1,
}}
for _, tc := range testCases {
w.Reset()
ipCache := cache.New(cache.Config{
EnableLRU: true,
MaxCount: defaultRDNSCacheSize,
})
ttl := make([]byte, binary.Size(uint64(0)))
binary.BigEndian.PutUint64(ttl, uint64(time.Now().Add(100*time.Hour).Unix()))
rdns := &RDNS{
ipCache: ipCache,
clients: &clientsContainer{
list: map[string]*Client{},
idIndex: tc.cliIDIndex,
ipHost: map[string]*ClientHost{},
allTags: map[string]bool{},
},
}
ipCache.Clear()
ipCache.Set(net.IP{1, 2, 3, 4}, ttl)
if tc.customChan != nil {
rdns.ipCh = tc.customChan
defer close(tc.customChan)
}
t.Run(tc.name, func(t *testing.T) {
rdns.Begin(tc.req)
assert.Equal(t, tc.wantCacheHit, ipCache.Stats().Hit)
assert.Equal(t, tc.wantCacheMiss, ipCache.Stats().Miss)
assert.Contains(t, w.String(), tc.wantLog)
})
}
}
func TestRDNS_Resolve(t *testing.T) {
extUpstream := &aghtest.TestUpstream{ </s> add "github.com/stretchr/testify/assert" </s> remove clients := &clientsContainer{}
rdns := InitRDNS(dns, clients)
r := rdns.resolve(net.IP{1, 1, 1, 1})
assert.Equal(t, "one.one.one.one", r, r)
</s> add cc := &clientsContainer{}
snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
localIP := net.IP{192, 168, 1, 1}
testCases := []struct {
name string
want string
wantErr error
locUpstream upstream.Upstream
req net.IP
}{{
name: "external_good",
want: "one.one.one.one",
wantErr: nil,
locUpstream: nil,
req: net.IP{1, 1, 1, 1},
}, {
name: "local_good",
want: "local.domain",
wantErr: nil,
locUpstream: locUpstream,
req: localIP,
}, {
name: "upstream_error",
want: "",
wantErr: upstreamErr,
locUpstream: errUpstream,
req: localIP,
}, {
name: "empty_answer_error",
want: "",
wantErr: rDNSEmptyAnswerErr,
locUpstream: locUpstream,
req: net.IP{192, 168, 1, 2},
}, {
name: "not_ptr_error",
want: "",
wantErr: rDNSNotPTRErr,
locUpstream: nonPtrUpstream,
req: localIP,
}}
for _, tc := range testCases {
rdns := NewRDNS(dns, cc, snd, &aghtest.Exchanger{
Ups: tc.locUpstream,
})
t.Run(tc.name, func(t *testing.T) {
r, rerr := rdns.resolve(tc.req)
require.ErrorIs(t, rerr, tc.wantErr)
assert.Equal(t, tc.want, r)
})
}
}
func TestRDNS_WorkerLoop(t *testing.T) {
aghtest.ReplaceLogLevel(t, log.DEBUG)
w := &bytes.Buffer{}
aghtest.ReplaceLogWriter(t, w)
locUpstream := &aghtest.TestUpstream{
Reverse: map[string][]string{
"1.1.168.192.in-addr.arpa.": {"local.domain"},
},
}
snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
testCases := []struct {
wantLog string
name string
cliIP net.IP
}{{
wantLog: "",
name: "all_good",
cliIP: net.IP{192, 168, 1, 1},
}, {
wantLog: `rdns: resolving "192.168.1.2": lookup for "2.1.168.192.in-addr.arpa.": ` +
string(rDNSEmptyAnswerErr),
name: "resolve_error",
cliIP: net.IP{192, 168, 1, 2},
}}
for _, tc := range testCases {
w.Reset()
lr := &aghtest.Exchanger{
Ups: locUpstream,
}
cc := &clientsContainer{
list: map[string]*Client{},
idIndex: map[string]*Client{},
ipHost: map[string]*ClientHost{},
allTags: map[string]bool{},
}
ch := make(chan net.IP)
rdns := &RDNS{
dnsServer: nil,
clients: cc,
subnetDetector: snd,
localResolvers: lr,
ipCh: ch,
}
t.Run(tc.name, func(t *testing.T) {
var wg sync.WaitGroup
wg.Add(1)
go func() {
rdns.workerLoop()
wg.Done()
}()
ch <- tc.cliIP
close(ch)
wg.Wait()
if tc.wantLog != "" {
assert.Contains(t, w.String(), tc.wantLog)
return
}
assert.True(t, cc.Exists(tc.cliIP.String(), ClientSourceRDNS))
})
} </s> remove assert.NoError(t, sr.Refresh())
</s> add assert.NoError(t, sr.refresh()) </s> add "net" | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns_test.go |
keep keep keep keep replace replace keep keep keep keep keep | <mask> "github.com/AdguardTeam/dnsproxy/upstream"
<mask> "github.com/stretchr/testify/assert"
<mask> )
<mask>
<mask> func TestResolveRDNS(t *testing.T) {
<mask> ups := &aghtest.TestUpstream{
<mask> Reverse: map[string][]string{
<mask> "1.1.1.1.in-addr.arpa.": {"one.one.one.one"},
<mask> },
<mask> }
<mask> dns := dnsforward.NewCustomServer(&proxy.Proxy{
</s> Pull request: 2704 local addresses vol.2
Merge in DNS/adguard-home from 2704-local-addresses-vol.2 to master
Updates #2704.
Updates #2829.
Squashed commit of the following:
commit 507d038c2709de59246fc0b65c3c4ab8e38d1990
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:33:05 2021 +0300
aghtest: fix file name
commit 8e19f99337bee1d88ad6595adb96f9bb23fa3c41
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 14:06:43 2021 +0300
aghnet: rm redundant mutexes
commit 361fa418b33ed160ca20862be1c455ab9378c03f
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:45:30 2021 +0300
all: fix names, docs
commit 14034f4f0230d7aaa3645054946ae5c278089a99
Merge: 35e265cc a72ce1cf
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:38:15 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit 35e265cc8cd308ef1fda414b58c0217cb5f258e4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 31 13:33:35 2021 +0300
aghnet: imp naming
commit 7a7edac7208a40697d7bc50682b923a144e28e2b
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:59:54 2021 +0300
changelog: oops, nope yet
commit d26a5d2513daf662ac92053b5e235189a64cc022
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 30 20:55:53 2021 +0300
all: some renaming for the glory of semantics
commit 9937fa619452b0742616217b975e3ff048d58acb
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 29 15:34:42 2021 +0300
all: log changes
commit d8d9e6dfeea8474466ee25f27021efdd3ddb1592
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 18:32:23 2021 +0300
all: imp localresolver, imp cutting off own addresses
commit 344140df449b85925f19b460fd7dc7c08e29c35a
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Fri Mar 26 14:53:33 2021 +0300
all: imp code quality
commit 1c5c0babec73b125044e23dd3aa75d8eefc19b28
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:44:08 2021 +0300
all: fix go.mod
commit 0b9fb3c2369a752e893af8ddc45a86bb9fb27ce5
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 20:38:51 2021 +0300
all: add error handling
commit a7a2e51f57fc6f8f74b95a264ad345cd2a9e026e
Merge: c13be634 27f4f052
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 19:48:36 2021 +0300
Merge branch 'master' into 2704-local-addresses-vol.2
commit c13be634f47bcaed9320a732a51c0e4752d0dad0
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Thu Mar 25 18:52:28 2021 +0300
all: cover rdns with tests, imp aghnet functionality
commit 48bed9025944530c613ee53e7961d6d5fbabf8be
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 20:18:07 2021 +0300
home: make rdns great again
commit 1dbacfc8d5b6895807797998317fe3cc814617c1
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Wed Mar 24 16:07:52 2021 +0300
all: imp external client restriction
commit 1208a319a7f4ffe7b7fa8956f245d7a19437c0a4
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Mon Mar 22 15:26:45 2021 +0300
all: finish local ptr processor
commit c8827fc3db289e1a5d7a11d057743bab39957b02
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Mar 2 13:41:22 2021 +0300
all: imp ipdetector, add local ptr processor </s> add locUpstream := &aghtest.TestUpstream{
Reverse: map[string][]string{
"1.1.168.192.in-addr.arpa.": {"local.domain"},
"2.1.168.192.in-addr.arpa.": {},
},
}
upstreamErr := errors.New("upstream error")
errUpstream := &aghtest.TestErrUpstream{
Err: upstreamErr,
}
nonPtrUpstream := &aghtest.TestBlockUpstream{
Hostname: "some-host",
Block: true,
}
</s> remove Upstreams: []upstream.Upstream{ups},
</s> add Upstreams: []upstream.Upstream{extUpstream}, </s> add "github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log" </s> add "github.com/stretchr/testify/require" </s> add "github.com/stretchr/testify/assert" </s> remove clients := &clientsContainer{}
rdns := InitRDNS(dns, clients)
r := rdns.resolve(net.IP{1, 1, 1, 1})
assert.Equal(t, "one.one.one.one", r, r)
</s> add cc := &clientsContainer{}
snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
localIP := net.IP{192, 168, 1, 1}
testCases := []struct {
name string
want string
wantErr error
locUpstream upstream.Upstream
req net.IP
}{{
name: "external_good",
want: "one.one.one.one",
wantErr: nil,
locUpstream: nil,
req: net.IP{1, 1, 1, 1},
}, {
name: "local_good",
want: "local.domain",
wantErr: nil,
locUpstream: locUpstream,
req: localIP,
}, {
name: "upstream_error",
want: "",
wantErr: upstreamErr,
locUpstream: errUpstream,
req: localIP,
}, {
name: "empty_answer_error",
want: "",
wantErr: rDNSEmptyAnswerErr,
locUpstream: locUpstream,
req: net.IP{192, 168, 1, 2},
}, {
name: "not_ptr_error",
want: "",
wantErr: rDNSNotPTRErr,
locUpstream: nonPtrUpstream,
req: localIP,
}}
for _, tc := range testCases {
rdns := NewRDNS(dns, cc, snd, &aghtest.Exchanger{
Ups: tc.locUpstream,
})
t.Run(tc.name, func(t *testing.T) {
r, rerr := rdns.resolve(tc.req)
require.ErrorIs(t, rerr, tc.wantErr)
assert.Equal(t, tc.want, r)
})
}
}
func TestRDNS_WorkerLoop(t *testing.T) {
aghtest.ReplaceLogLevel(t, log.DEBUG)
w := &bytes.Buffer{}
aghtest.ReplaceLogWriter(t, w)
locUpstream := &aghtest.TestUpstream{
Reverse: map[string][]string{
"1.1.168.192.in-addr.arpa.": {"local.domain"},
},
}
snd, err := aghnet.NewSubnetDetector()
require.NoError(t, err)
testCases := []struct {
wantLog string
name string
cliIP net.IP
}{{
wantLog: "",
name: "all_good",
cliIP: net.IP{192, 168, 1, 1},
}, {
wantLog: `rdns: resolving "192.168.1.2": lookup for "2.1.168.192.in-addr.arpa.": ` +
string(rDNSEmptyAnswerErr),
name: "resolve_error",
cliIP: net.IP{192, 168, 1, 2},
}}
for _, tc := range testCases {
w.Reset()
lr := &aghtest.Exchanger{
Ups: locUpstream,
}
cc := &clientsContainer{
list: map[string]*Client{},
idIndex: map[string]*Client{},
ipHost: map[string]*ClientHost{},
allTags: map[string]bool{},
}
ch := make(chan net.IP)
rdns := &RDNS{
dnsServer: nil,
clients: cc,
subnetDetector: snd,
localResolvers: lr,
ipCh: ch,
}
t.Run(tc.name, func(t *testing.T) {
var wg sync.WaitGroup
wg.Add(1)
go func() {
rdns.workerLoop()
wg.Done()
}()
ch <- tc.cliIP
close(ch)
wg.Wait()
if tc.wantLog != "" {
assert.Contains(t, w.String(), tc.wantLog)
return
}
assert.True(t, cc.Exists(tc.cliIP.String(), ClientSourceRDNS))
})
} | https://github.com/AdguardTeam/AdGuardHome/commit/86444eacc2d38666b949b37163e9e53b499119eb | internal/home/rdns_test.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.