code_before
stringlengths
16
1.81M
edits
stringlengths
4
328k
next_edit
stringlengths
0
76.5k
code_after
stringlengths
3
49.9M
label_window
sequencelengths
4
1.81k
instruction
stringlengths
20
51.9k
html_url
stringlengths
74
116
file_name
stringlengths
3
311
udpConn: bcast, bcastIP: s.conf.broadcastIP, rawConn: ucast, srcMAC: iface.HardwareAddr, srcIP: s.conf.dnsIPAddrs[0], }, nil } // wrapErrs is a helper to wrap the errors from two independent underlying // connections.
</s> remove bcastIP: s.conf.broadcastIP, </s> add bcastIP: s.conf.broadcastIP.AsSlice(), </s> remove // Don't wrap an errors since it's inforative enough as is and there is </s> add // Don't wrap an errors since it's informative enough as is and there is </s> remove // Don't wrap an errors since it's inforative enough as is and there is </s> add // Don't wrap an errors since it's informative enough as is and there is </s> remove subnetMask := net.IPMask(netutil.CloneIP(c.SubnetMask.To4())) c.subnet = &net.IPNet{ IP: gatewayIP, Mask: subnetMask, </s> add rangeStart, err := ensureV4(c.RangeStart, "address") if err != nil { // Don't wrap an errors since it's informative enough as is and there is // an annotation deferred already. return err } rangeEnd, err := ensureV4(c.RangeEnd, "address") if err != nil { // Don't wrap an errors since it's informative enough as is and there is // an annotation deferred already. return err </s> remove c.broadcastIP = aghnet.BroadcastFromIPNet(c.subnet) </s> add
srcIP: s.conf.dnsIPAddrs[0].AsSlice(),
udpConn: bcast, bcastIP: s.conf.broadcastIP, rawConn: ucast, srcMAC: iface.HardwareAddr, srcIP: s.conf.dnsIPAddrs[0].AsSlice(), }, nil } // wrapErrs is a helper to wrap the errors from two independent underlying // connections.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/conn_unix.go
v4conf := conf.Conf4 v4conf.InterfaceName = s.conf.InterfaceName v4conf.notify = s.onNotify v4conf.Enabled = s.conf.Enabled && len(v4conf.RangeStart) != 0 s.srv4, err = v4Create(&v4conf) if err != nil { if v4conf.Enabled { return nil, fmt.Errorf("creating dhcpv4 srv: %w", err)
</s> remove restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port </s> add restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> remove return nil, fmt.Errorf("couldn't get interfaces: %w", err) } else if len(ifaces) == 0 { return nil, errors.Error("couldn't find any legible interface") </s> add return nil, fmt.Errorf("failed to get addresses for interface %s: %w", iface.Name, err) </s> remove err = aghnet.CheckPort("tcp", req.Web.IP, req.Web.Port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port))) </s> remove // Discard interfaces with no addresses. if len(netIface.Addresses) != 0 { netIfaces = append(netIfaces, netIface) </s> add ones, _ := n.Mask.Size() p := netip.PrefixFrom(ip, ones) niface.Addresses = append(niface.Addresses, ip) niface.Subnets = append(niface.Subnets, p) } return niface, nil } // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and // WEB only we do not return link-local addresses here. // // TODO(e.burkov): Can't properly test the function since it's nontrivial to // substitute net.Interface.Addrs and the net.InterfaceAddrs can't be used. func GetValidNetInterfacesForWeb() (nifaces []*NetInterface, err error) { ifaces, err := net.Interfaces() if err != nil { return nil, fmt.Errorf("getting interfaces: %w", err) } else if len(ifaces) == 0 { return nil, errors.Error("no legible interfaces") } for i := range ifaces { var niface *NetInterface niface, err = NetInterfaceFrom(&ifaces[i]) if err != nil { return nil, err } else if len(niface.Addresses) != 0 { // Discard interfaces with no addresses. nifaces = append(nifaces, niface) </s> remove if opts.bindHost != nil { </s> add if opts.bindHost.IsValid() {
v4conf.Enabled = s.conf.Enabled && v4conf.RangeStart.IsValid()
v4conf := conf.Conf4 v4conf.InterfaceName = s.conf.InterfaceName v4conf.notify = s.onNotify v4conf.Enabled = s.conf.Enabled && v4conf.RangeStart.IsValid() s.srv4, err = v4Create(&v4conf) if err != nil { if v4conf.Enabled { return nil, fmt.Errorf("creating dhcpv4 srv: %w", err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd.go
package dhcpd import ( "net" "os" "testing" "time"
</s> remove "net" </s> add "net/netip" </s> remove "net" </s> add </s> remove "net" </s> add "net/netip" </s> remove "net" </s> add
"net/netip"
package dhcpd import ( "net" "net/netip" "os" "testing" "time"
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
} s.srv4, err = v4Create(&V4ServerConf{ Enabled: true, RangeStart: net.IP{192, 168, 10, 100}, RangeEnd: net.IP{192, 168, 10, 200}, GatewayIP: net.IP{192, 168, 10, 1}, SubnetMask: net.IP{255, 255, 255, 0}, notify: testNotify, }) require.NoError(t, err) s.srv6, err = v6Create(V6ServerConf{})
</s> remove RangeStart: net.IP{192, 168, 10, 20}, RangeEnd: net.IP{192, 168, 10, 200}, </s> add RangeStart: netip.MustParseAddr("192.168.10.20"), RangeEnd: netip.MustParseAddr("192.168.10.200"), </s> remove GatewayIP: net.IP{1, 2, 3, 1}, SubnetMask: net.IP{255, 255, 255, 0}, RangeStart: net.IP{1, 2, 3, 2}, RangeEnd: net.IP{1, 2, 3, 10}, </s> add GatewayIP: netip.MustParseAddr("1.2.3.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("1.2.3.2"), RangeEnd: netip.MustParseAddr("1.2.3.10"), </s> remove name: "outside_range_start", </s> add name: "outside_range_start", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.240"), </s> remove name: "outside_range_end", </s> add name: "outside_range_end", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.224"), </s> remove DefaultRangeStart = net.IP{192, 168, 10, 100} DefaultRangeEnd = net.IP{192, 168, 10, 200} DefaultGatewayIP = net.IP{192, 168, 10, 1} DefaultSelfIP = net.IP{192, 168, 10, 2} DefaultSubnetMask = net.IP{255, 255, 255, 0} </s> add DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0")
RangeStart: netip.MustParseAddr("192.168.10.100"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: netip.MustParseAddr("192.168.10.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"),
} s.srv4, err = v4Create(&V4ServerConf{ Enabled: true, RangeStart: netip.MustParseAddr("192.168.10.100"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: netip.MustParseAddr("192.168.10.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("192.168.10.100"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: netip.MustParseAddr("192.168.10.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("192.168.10.100"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: netip.MustParseAddr("192.168.10.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("192.168.10.100"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: netip.MustParseAddr("192.168.10.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), notify: testNotify, }) require.NoError(t, err) s.srv6, err = v6Create(V6ServerConf{})
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
testCases := []struct { name string wantErrMsg string }{{ name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"), wantErrMsg: "dhcpv4: gateway ip 192.168.10.120 in the ip range: " +
</s> remove name: "gateway_in_range", </s> add name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"), </s> remove gatewayIP net.IP subnetMask net.IP </s> add </s> remove gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, </s> add </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, </s> add </s> remove name string </s> add
gatewayIP netip.Addr subnetMask netip.Addr
testCases := []struct { name string gatewayIP netip.Addr subnetMask netip.Addr wantErrMsg string }{{ name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"), wantErrMsg: "dhcpv4: gateway ip 192.168.10.120 in the ip range: " +
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
func TestV4Server_badRange(t *testing.T) { testCases := []struct { name string wantErrMsg string gatewayIP net.IP subnetMask net.IP }{{ name: "gateway_in_range", wantErrMsg: "dhcpv4: gateway ip 192.168.10.120 in the ip range: " + "192.168.10.20-192.168.10.200", gatewayIP: net.IP{192, 168, 10, 120},
</s> remove name: "gateway_in_range", </s> add name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"), </s> remove gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, </s> add </s> remove name: "outside_range_start", </s> add name: "outside_range_start", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.240"), </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, </s> add
func TestV4Server_badRange(t *testing.T) { testCases := []struct { name string wantErrMsg string }{{ name: "gateway_in_range", wantErrMsg: "dhcpv4: gateway ip 192.168.10.120 in the ip range: " + "192.168.10.20-192.168.10.200", gatewayIP: net.IP{192, 168, 10, 120},
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
wantErrMsg string gatewayIP net.IP subnetMask net.IP }{{ name: "gateway_in_range", wantErrMsg: "dhcpv4: gateway ip 192.168.10.120 in the ip range: " + "192.168.10.20-192.168.10.200", gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, }, {
</s> remove gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, </s> add </s> remove gatewayIP net.IP subnetMask net.IP </s> add </s> remove name: "outside_range_start", </s> add name: "outside_range_start", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.240"), </s> remove name: "outside_range_end", </s> add name: "outside_range_end", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.224"),
name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"),
wantErrMsg string gatewayIP net.IP subnetMask net.IP }{{ name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"), wantErrMsg: "dhcpv4: gateway ip 192.168.10.120 in the ip range: " + "192.168.10.20-192.168.10.200", gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
}{{ name: "gateway_in_range", wantErrMsg: "dhcpv4: gateway ip 192.168.10.120 in the ip range: " + "192.168.10.20-192.168.10.200", gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, }, { name: "outside_range_start", wantErrMsg: "dhcpv4: range start 192.168.10.20 is outside network " + "192.168.10.1/28", gatewayIP: net.IP{192, 168, 10, 1},
</s> remove name: "outside_range_start", </s> add name: "outside_range_start", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.240"), </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, </s> add </s> remove name: "gateway_in_range", </s> add name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"), </s> remove name: "outside_range_end", </s> add name: "outside_range_end", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.224"), </s> remove gatewayIP net.IP subnetMask net.IP </s> add
}{{ name: "gateway_in_range", wantErrMsg: "dhcpv4: gateway ip 192.168.10.120 in the ip range: " + "192.168.10.20-192.168.10.200", }, { name: "outside_range_start", wantErrMsg: "dhcpv4: range start 192.168.10.20 is outside network " + "192.168.10.1/28", gatewayIP: net.IP{192, 168, 10, 1},
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
"192.168.10.20-192.168.10.200", gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, }, { name: "outside_range_start", wantErrMsg: "dhcpv4: range start 192.168.10.20 is outside network " + "192.168.10.1/28", gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, }, {
</s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, </s> add </s> remove gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, </s> add </s> remove name: "outside_range_end", </s> add name: "outside_range_end", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.224"), </s> remove name: "gateway_in_range", </s> add name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"), </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 224}, </s> add
name: "outside_range_start", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.240"),
"192.168.10.20-192.168.10.200", gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, }, { name: "outside_range_start", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.240"), wantErrMsg: "dhcpv4: range start 192.168.10.20 is outside network " + "192.168.10.1/28", gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
}, { name: "outside_range_start", wantErrMsg: "dhcpv4: range start 192.168.10.20 is outside network " + "192.168.10.1/28", gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, }, { name: "outside_range_end", wantErrMsg: "dhcpv4: range end 192.168.10.200 is outside network " + "192.168.10.1/27", gatewayIP: net.IP{192, 168, 10, 1},
</s> remove name: "outside_range_end", </s> add name: "outside_range_end", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.224"), </s> remove name: "outside_range_start", </s> add name: "outside_range_start", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.240"), </s> remove gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, </s> add </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 224}, </s> add </s> remove name: "gateway_in_range", </s> add name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"),
}, { name: "outside_range_start", wantErrMsg: "dhcpv4: range start 192.168.10.20 is outside network " + "192.168.10.1/28", }, { name: "outside_range_end", wantErrMsg: "dhcpv4: range end 192.168.10.200 is outside network " + "192.168.10.1/27", gatewayIP: net.IP{192, 168, 10, 1},
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
"192.168.10.1/28", gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, }, { name: "outside_range_end", wantErrMsg: "dhcpv4: range end 192.168.10.200 is outside network " + "192.168.10.1/27", gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 224}, }}
</s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, </s> add </s> remove name: "outside_range_start", </s> add name: "outside_range_start", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.240"), </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 224}, </s> add </s> remove gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, </s> add </s> remove name: "gateway_in_range", </s> add name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"),
name: "outside_range_end", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.224"),
"192.168.10.1/28", gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, }, { name: "outside_range_end", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.224"), wantErrMsg: "dhcpv4: range end 192.168.10.200 is outside network " + "192.168.10.1/27", gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 224}, }}
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
}, { name: "outside_range_end", wantErrMsg: "dhcpv4: range end 192.168.10.200 is outside network " + "192.168.10.1/27", gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 224}, }} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { conf := V4ServerConf{
</s> remove name: "outside_range_end", </s> add name: "outside_range_end", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.224"), </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, </s> add </s> remove name: "outside_range_start", </s> add name: "outside_range_start", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.240"), </s> remove gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, </s> add </s> remove name: "gateway_in_range", </s> add name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"),
}, { name: "outside_range_end", wantErrMsg: "dhcpv4: range end 192.168.10.200 is outside network " + "192.168.10.1/27", }} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { conf := V4ServerConf{
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { conf := V4ServerConf{ Enabled: true, RangeStart: net.IP{192, 168, 10, 20}, RangeEnd: net.IP{192, 168, 10, 200}, GatewayIP: tc.gatewayIP, SubnetMask: tc.subnetMask, notify: testNotify, }
</s> remove RangeStart: net.IP{192, 168, 10, 100}, RangeEnd: net.IP{192, 168, 10, 200}, GatewayIP: net.IP{192, 168, 10, 1}, SubnetMask: net.IP{255, 255, 255, 0}, </s> add RangeStart: netip.MustParseAddr("192.168.10.100"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: netip.MustParseAddr("192.168.10.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 224}, </s> add </s> remove GatewayIP: net.IP{1, 2, 3, 1}, SubnetMask: net.IP{255, 255, 255, 0}, RangeStart: net.IP{1, 2, 3, 2}, RangeEnd: net.IP{1, 2, 3, 10}, </s> add GatewayIP: netip.MustParseAddr("1.2.3.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("1.2.3.2"), RangeEnd: netip.MustParseAddr("1.2.3.10"), </s> remove subnet: &net.IPNet{ IP: net.IP{0, 0, 0, 0}, Mask: net.IPMask{0, 0, 0, 0}, }, want: net.IPv4bcast, </s> add }, { pref: netip.Prefix{}, want: netip.Addr{}, name: "invalid", </s> remove bc := BroadcastFromIPNet(tc.subnet) assert.True(t, bc.Equal(tc.want), bc) </s> add assert.Equal(t, tc.want, BroadcastFromPref(tc.pref))
RangeStart: netip.MustParseAddr("192.168.10.20"), RangeEnd: netip.MustParseAddr("192.168.10.200"),
for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { conf := V4ServerConf{ Enabled: true, RangeStart: netip.MustParseAddr("192.168.10.20"), RangeEnd: netip.MustParseAddr("192.168.10.200"), RangeStart: netip.MustParseAddr("192.168.10.20"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: tc.gatewayIP, SubnetMask: tc.subnetMask, notify: testNotify, }
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/dhcpd_unix_test.go
"net" "net/http" "os" "github.com/AdguardTeam/AdGuardHome/internal/aghalg" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/golibs/errors"
</s> remove "net" </s> add "net/netip" </s> remove "net" </s> add
"net/netip"
"net" "net/http" "net/netip" "os" "github.com/AdguardTeam/AdGuardHome/internal/aghalg" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/golibs/errors"
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/http_unix.go
"github.com/AdguardTeam/golibs/log" ) type v4ServerConfJSON struct { GatewayIP net.IP `json:"gateway_ip"` SubnetMask net.IP `json:"subnet_mask"` RangeStart net.IP `json:"range_start"` RangeEnd net.IP `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"` } func (j *v4ServerConfJSON) toServerConf() *V4ServerConf { if j == nil { return &V4ServerConf{}
</s> remove RangeStart net.IP `json:"range_start"` LeaseDuration uint32 `json:"lease_duration"` </s> add RangeStart netip.Addr `json:"range_start"` LeaseDuration uint32 `json:"lease_duration"` </s> remove GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"` </s> add GatewayIP netip.Addr `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask netip.Addr `yaml:"subnet_mask" json:"subnet_mask"` </s> remove broadcastIP net.IP </s> add broadcastIP netip.Addr </s> remove RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"` </s> add RangeStart netip.Addr `yaml:"range_start" json:"range_start"` RangeEnd netip.Addr `yaml:"range_end" json:"range_end"` </s> remove Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP net.IP `json:"gateway_ip"` Addrs4 []net.IP `json:"ipv4_addresses"` Addrs6 []net.IP `json:"ipv6_addresses"` </s> add Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP netip.Addr `json:"gateway_ip"` Addrs4 []netip.Addr `json:"ipv4_addresses"` Addrs6 []netip.Addr `json:"ipv6_addresses"`
GatewayIP netip.Addr `json:"gateway_ip"` SubnetMask netip.Addr `json:"subnet_mask"` RangeStart netip.Addr `json:"range_start"` RangeEnd netip.Addr `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"`
"github.com/AdguardTeam/golibs/log" ) type v4ServerConfJSON struct { GatewayIP netip.Addr `json:"gateway_ip"` SubnetMask netip.Addr `json:"subnet_mask"` RangeStart netip.Addr `json:"range_start"` RangeEnd netip.Addr `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"` GatewayIP netip.Addr `json:"gateway_ip"` SubnetMask netip.Addr `json:"subnet_mask"` RangeStart netip.Addr `json:"range_start"` RangeEnd netip.Addr `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"` GatewayIP netip.Addr `json:"gateway_ip"` SubnetMask netip.Addr `json:"subnet_mask"` RangeStart netip.Addr `json:"range_start"` RangeEnd netip.Addr `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"` GatewayIP netip.Addr `json:"gateway_ip"` SubnetMask netip.Addr `json:"subnet_mask"` RangeStart netip.Addr `json:"range_start"` RangeEnd netip.Addr `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"` GatewayIP netip.Addr `json:"gateway_ip"` SubnetMask netip.Addr `json:"subnet_mask"` RangeStart netip.Addr `json:"range_start"` RangeEnd netip.Addr `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"` } func (j *v4ServerConfJSON) toServerConf() *V4ServerConf { if j == nil { return &V4ServerConf{}
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/http_unix.go
} } type v6ServerConfJSON struct { RangeStart net.IP `json:"range_start"` LeaseDuration uint32 `json:"lease_duration"` } func v6JSONToServerConf(j *v6ServerConfJSON) V6ServerConf { if j == nil { return V6ServerConf{}
</s> remove GatewayIP net.IP `json:"gateway_ip"` SubnetMask net.IP `json:"subnet_mask"` RangeStart net.IP `json:"range_start"` RangeEnd net.IP `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"` </s> add GatewayIP netip.Addr `json:"gateway_ip"` SubnetMask netip.Addr `json:"subnet_mask"` RangeStart netip.Addr `json:"range_start"` RangeEnd netip.Addr `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"` </s> remove IP net.IP `json:"ip"` Port int `json:"port"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"` </s> remove IP net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> remove RangeStart net.IP `yaml:"range_start" json:"range_start"` RangeEnd net.IP `yaml:"range_end" json:"range_end"` </s> add RangeStart netip.Addr `yaml:"range_start" json:"range_start"` RangeEnd netip.Addr `yaml:"range_end" json:"range_end"` </s> remove func ipsToUDPAddrs(ips []net.IP, port int) (udpAddrs []*net.UDPAddr) { </s> add func ipsToUDPAddrs(ips []netip.Addr, port int) (udpAddrs []*net.UDPAddr) {
RangeStart netip.Addr `json:"range_start"` LeaseDuration uint32 `json:"lease_duration"`
} } type v6ServerConfJSON struct { RangeStart netip.Addr `json:"range_start"` LeaseDuration uint32 `json:"lease_duration"` RangeStart netip.Addr `json:"range_start"` LeaseDuration uint32 `json:"lease_duration"` } func v6JSONToServerConf(j *v6ServerConfJSON) V6ServerConf { if j == nil { return V6ServerConf{}
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/http_unix.go
return V6ServerConf{} } return V6ServerConf{ RangeStart: j.RangeStart, LeaseDuration: j.LeaseDuration, } } // dhcpStatusResponse is the response for /control/dhcp/status endpoint.
</s> remove return nil, fmt.Errorf("interface %s has no ipv4 addresses", iface.Name) </s> add return netip.Prefix{}, fmt.Errorf("interface %s has no ipv4 addresses", iface.Name) </s> remove var subnet *net.IPNet </s> add var subnet netip.Prefix </s> remove RangeStart: net.IP{192, 168, 10, 20}, RangeEnd: net.IP{192, 168, 10, 200}, </s> add RangeStart: netip.MustParseAddr("192.168.10.20"), RangeEnd: netip.MustParseAddr("192.168.10.200"), </s> remove RangeStart net.IP `json:"range_start"` LeaseDuration uint32 `json:"lease_duration"` </s> add RangeStart netip.Addr `json:"range_start"` LeaseDuration uint32 `json:"lease_duration"` </s> remove return nil </s> add return p
RangeStart: j.RangeStart.AsSlice(),
return V6ServerConf{} } return V6ServerConf{ RangeStart: j.RangeStart.AsSlice(), LeaseDuration: j.LeaseDuration, } } // dhcpStatusResponse is the response for /control/dhcp/status endpoint.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/http_unix.go
} v4Conf := conf.V4.toServerConf() v4Conf.Enabled = conf.Enabled == aghalg.NBTrue if len(v4Conf.RangeStart) == 0 { v4Conf.Enabled = false } v4Conf.InterfaceName = conf.InterfaceName
</s> remove restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port </s> add restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> remove hosts = []net.IP{{127, 0, 0, 1}} </s> add hosts = []netip.Addr{aghnet.IPv4Localhost()} </s> remove if o.bindHost == nil { </s> add if !o.bindHost.IsValid() { </s> remove mask := n.Mask if mask == nil { mask = dc.DefaultMask() </s> add maskLen, addrLen := p.Bits(), bc.BitLen() if maskLen == addrLen { return bc </s> remove if ip4 := reqIP.To4(); ip4 == nil { </s> add ip4 := reqIP.To4() if ip4 == nil {
if !v4Conf.RangeStart.IsValid() {
} v4Conf := conf.V4.toServerConf() v4Conf.Enabled = conf.Enabled == aghalg.NBTrue if !v4Conf.RangeStart.IsValid() { v4Conf.Enabled = false } v4Conf.InterfaceName = conf.InterfaceName
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/http_unix.go
} } type netInterfaceJSON struct { Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP net.IP `json:"gateway_ip"` Addrs4 []net.IP `json:"ipv4_addresses"` Addrs6 []net.IP `json:"ipv6_addresses"` } func (s *server) handleDHCPInterfaces(w http.ResponseWriter, r *http.Request) { response := map[string]netInterfaceJSON{}
</s> remove Subnets []*net.IPNet `json:"-"` </s> add Subnets []netip.Prefix `json:"-"` </s> remove Addresses []net.IP `json:"ip_addresses,omitempty"` </s> add Addresses []netip.Addr `json:"ip_addresses,omitempty"` </s> remove IP net.IP `json:"ip"` Port int `json:"port"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"` </s> remove GatewayIP net.IP `json:"gateway_ip"` SubnetMask net.IP `json:"subnet_mask"` RangeStart net.IP `json:"range_start"` RangeEnd net.IP `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"` </s> add GatewayIP netip.Addr `json:"gateway_ip"` SubnetMask netip.Addr `json:"subnet_mask"` RangeStart netip.Addr `json:"range_start"` RangeEnd netip.Addr `json:"range_end"` LeaseDuration uint32 `json:"lease_duration"` </s> remove GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"` </s> add GatewayIP netip.Addr `yaml:"gateway_ip" json:"gateway_ip"` SubnetMask netip.Addr `yaml:"subnet_mask" json:"subnet_mask"`
Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP netip.Addr `json:"gateway_ip"` Addrs4 []netip.Addr `json:"ipv4_addresses"` Addrs6 []netip.Addr `json:"ipv6_addresses"`
} } type netInterfaceJSON struct { Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP netip.Addr `json:"gateway_ip"` Addrs4 []netip.Addr `json:"ipv4_addresses"` Addrs6 []netip.Addr `json:"ipv6_addresses"` Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP netip.Addr `json:"gateway_ip"` Addrs4 []netip.Addr `json:"ipv4_addresses"` Addrs6 []netip.Addr `json:"ipv6_addresses"` Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP netip.Addr `json:"gateway_ip"` Addrs4 []netip.Addr `json:"ipv4_addresses"` Addrs6 []netip.Addr `json:"ipv6_addresses"` Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP netip.Addr `json:"gateway_ip"` Addrs4 []netip.Addr `json:"ipv4_addresses"` Addrs6 []netip.Addr `json:"ipv6_addresses"` Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP netip.Addr `json:"gateway_ip"` Addrs4 []netip.Addr `json:"ipv4_addresses"` Addrs6 []netip.Addr `json:"ipv6_addresses"` Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP netip.Addr `json:"gateway_ip"` Addrs4 []netip.Addr `json:"ipv4_addresses"` Addrs6 []netip.Addr `json:"ipv6_addresses"` } func (s *server) handleDHCPInterfaces(w http.ResponseWriter, r *http.Request) { response := map[string]netInterfaceJSON{}
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/http_unix.go
return } // ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue }
</s> remove if ipnet.IP.To4() != nil { jsonIface.Addrs4 = append(jsonIface.Addrs4, ipnet.IP) </s> add if ip4 := ipnet.IP.To4(); ip4 != nil { addr := netip.AddrFrom4(*(*[4]byte)(ip4)) jsonIface.Addrs4 = append(jsonIface.Addrs4, addr) </s> remove // Collect network interface addresses. for _, addr := range addrs { ipNet, ok := addr.(*net.IPNet) if !ok { // Should be net.IPNet, this is weird. return nil, fmt.Errorf("got %s that is not net.IPNet, it is %T", addr, addr) } // Ignore link-local. if ipNet.IP.IsLinkLocalUnicast() { </s> add ip = ip.Unmap() if ip.IsLinkLocalUnicast() { // Ignore link-local IPv4. if ip.Is4() { </s> remove if ip4 := subnet.IP.To4(); ip4 != nil { subnet.IP = ip4 return subnet, nil </s> add if ip = ip.To4(); ip != nil { return netip.PrefixFrom(netip.AddrFrom4(*(*[4]byte)(ip)), maskLen), nil </s> remove s.conf.dnsIPAddrs = dnsIPAddrs </s> add for _, ip := range dnsIPAddrs { ip = ip.To4() if ip == nil { continue } s.conf.dnsIPAddrs = append(s.conf.dnsIPAddrs, netip.AddrFrom4(*(*[4]byte)(ip))) } </s> remove netIface.Addresses = append(netIface.Addresses, ipNet.IP) netIface.Subnets = append(netIface.Subnets, ipNet) </s> add ip = ip.WithZone(iface.Name)
// // TODO(e.burkov): Try to listen DHCP on LLA as well.
return } // ignore link-local // // TODO(e.burkov): Try to listen DHCP on LLA as well. if ipnet.IP.IsLinkLocalUnicast() { continue }
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/http_unix.go
// ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } if ipnet.IP.To4() != nil { jsonIface.Addrs4 = append(jsonIface.Addrs4, ipnet.IP) } else { jsonIface.Addrs6 = append(jsonIface.Addrs6, ipnet.IP) } } if len(jsonIface.Addrs4)+len(jsonIface.Addrs6) != 0 {
</s> remove jsonIface.Addrs6 = append(jsonIface.Addrs6, ipnet.IP) </s> add addr := netip.AddrFrom16(*(*[16]byte)(ipnet.IP)) jsonIface.Addrs6 = append(jsonIface.Addrs6, addr) </s> remove netIface.Addresses = append(netIface.Addresses, ipNet.IP) netIface.Subnets = append(netIface.Subnets, ipNet) </s> add ip = ip.WithZone(iface.Name) </s> remove // Discard interfaces with no addresses. if len(netIface.Addresses) != 0 { netIfaces = append(netIfaces, netIface) </s> add ones, _ := n.Mask.Size() p := netip.PrefixFrom(ip, ones) niface.Addresses = append(niface.Addresses, ip) niface.Subnets = append(niface.Subnets, p) } return niface, nil } // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and // WEB only we do not return link-local addresses here. // // TODO(e.burkov): Can't properly test the function since it's nontrivial to // substitute net.Interface.Addrs and the net.InterfaceAddrs can't be used. func GetValidNetInterfacesForWeb() (nifaces []*NetInterface, err error) { ifaces, err := net.Interfaces() if err != nil { return nil, fmt.Errorf("getting interfaces: %w", err) } else if len(ifaces) == 0 { return nil, errors.Error("no legible interfaces") } for i := range ifaces { var niface *NetInterface niface, err = NetInterfaceFrom(&ifaces[i]) if err != nil { return nil, err } else if len(niface.Addresses) != 0 { // Discard interfaces with no addresses. nifaces = append(nifaces, niface) </s> remove if opts.bindHost != nil { </s> add if opts.bindHost.IsValid() {
if ip4 := ipnet.IP.To4(); ip4 != nil { addr := netip.AddrFrom4(*(*[4]byte)(ip4)) jsonIface.Addrs4 = append(jsonIface.Addrs4, addr)
// ignore link-local if ipnet.IP.IsLinkLocalUnicast() { continue } if ip4 := ipnet.IP.To4(); ip4 != nil { addr := netip.AddrFrom4(*(*[4]byte)(ip4)) jsonIface.Addrs4 = append(jsonIface.Addrs4, addr) if ip4 := ipnet.IP.To4(); ip4 != nil { addr := netip.AddrFrom4(*(*[4]byte)(ip4)) jsonIface.Addrs4 = append(jsonIface.Addrs4, addr) } else { jsonIface.Addrs6 = append(jsonIface.Addrs6, ipnet.IP) } } if len(jsonIface.Addrs4)+len(jsonIface.Addrs6) != 0 {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/http_unix.go
} if ipnet.IP.To4() != nil { jsonIface.Addrs4 = append(jsonIface.Addrs4, ipnet.IP) } else { jsonIface.Addrs6 = append(jsonIface.Addrs6, ipnet.IP) } } if len(jsonIface.Addrs4)+len(jsonIface.Addrs6) != 0 { jsonIface.GatewayIP = aghnet.GatewayIP(iface.Name) response[iface.Name] = jsonIface
</s> remove if ipnet.IP.To4() != nil { jsonIface.Addrs4 = append(jsonIface.Addrs4, ipnet.IP) </s> add if ip4 := ipnet.IP.To4(); ip4 != nil { addr := netip.AddrFrom4(*(*[4]byte)(ip4)) jsonIface.Addrs4 = append(jsonIface.Addrs4, addr) </s> remove if opts.bindHost != nil { </s> add if opts.bindHost.IsValid() { </s> remove restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port </s> add restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> remove v4conf.Enabled = s.conf.Enabled && len(v4conf.RangeStart) != 0 </s> add v4conf.Enabled = s.conf.Enabled && v4conf.RangeStart.IsValid() </s> remove // Discard interfaces with no addresses. if len(netIface.Addresses) != 0 { netIfaces = append(netIfaces, netIface) </s> add ones, _ := n.Mask.Size() p := netip.PrefixFrom(ip, ones) niface.Addresses = append(niface.Addresses, ip) niface.Subnets = append(niface.Subnets, p) } return niface, nil } // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and // WEB only we do not return link-local addresses here. // // TODO(e.burkov): Can't properly test the function since it's nontrivial to // substitute net.Interface.Addrs and the net.InterfaceAddrs can't be used. func GetValidNetInterfacesForWeb() (nifaces []*NetInterface, err error) { ifaces, err := net.Interfaces() if err != nil { return nil, fmt.Errorf("getting interfaces: %w", err) } else if len(ifaces) == 0 { return nil, errors.Error("no legible interfaces") } for i := range ifaces { var niface *NetInterface niface, err = NetInterfaceFrom(&ifaces[i]) if err != nil { return nil, err } else if len(niface.Addresses) != 0 { // Discard interfaces with no addresses. nifaces = append(nifaces, niface)
addr := netip.AddrFrom16(*(*[16]byte)(ipnet.IP)) jsonIface.Addrs6 = append(jsonIface.Addrs6, addr)
} if ipnet.IP.To4() != nil { jsonIface.Addrs4 = append(jsonIface.Addrs4, ipnet.IP) } else { addr := netip.AddrFrom16(*(*[16]byte)(ipnet.IP)) jsonIface.Addrs6 = append(jsonIface.Addrs6, addr) } } if len(jsonIface.Addrs4)+len(jsonIface.Addrs6) != 0 { jsonIface.GatewayIP = aghnet.GatewayIP(iface.Name) response[iface.Name] = jsonIface
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/http_unix.go
// newIPRange creates a new IP address range. start must be less than end. The // resulting range must not be greater than maxRangeLen. func newIPRange(start, end net.IP) (r *ipRange, err error) { defer func() { err = errors.Annotate(err, "invalid ip range: %w") }() // Make sure that both are 16 bytes long to simplify handling in
</s> remove defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP)) }() </s> add defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP.AsSlice())) }() </s> remove subnet *net.IPNet </s> add subnet netip.Prefix </s> remove func GatewayIP(ifaceName string) (ip net.IP) { </s> add func GatewayIP(ifaceName string) (ip netip.Addr) { </s> remove func InterfaceByIP(ip net.IP) (ifaceName string) { </s> add func InterfaceByIP(ip netip.Addr) (ifaceName string) { </s> remove // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and // WEB only we do not return link-local addresses here. // // TODO(e.burkov): Can't properly test the function since it's nontrivial to // substitute net.Interface.Addrs and the net.InterfaceAddrs can't be used. func GetValidNetInterfacesForWeb() (netIfaces []*NetInterface, err error) { ifaces, err := net.Interfaces() </s> add func NetInterfaceFrom(iface *net.Interface) (niface *NetInterface, err error) { niface = &NetInterface{ Name: iface.Name, HardwareAddr: iface.HardwareAddr, Flags: iface.Flags, MTU: iface.MTU, } addrs, err := iface.Addrs()
// // TODO(e.burkov): Use netip.Addr.
// newIPRange creates a new IP address range. start must be less than end. The // resulting range must not be greater than maxRangeLen. // // TODO(e.burkov): Use netip.Addr. func newIPRange(start, end net.IP) (r *ipRange, err error) { defer func() { err = errors.Annotate(err, "invalid ip range: %w") }() // Make sure that both are 16 bytes long to simplify handling in
[ "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/iprange.go
// See https://datatracker.ietf.org/doc/html/rfc1122#section-4.2.3.6. dhcpv4.OptGeneric(dhcpv4.OptionTCPKeepaliveGarbage, []byte{0x01}), // Values From Configuration dhcpv4.OptSubnetMask(s.conf.SubnetMask.AsSlice()), ) // Set values for explicitly configured options.
</s> remove // Set the Router Option to working subnet's IP since it's initialized // with the address of the gateway. dhcpv4.OptRouter(s.conf.subnet.IP), dhcpv4.OptSubnetMask(s.conf.subnet.Mask), </s> add dhcpv4.OptSubnetMask(s.conf.SubnetMask.AsSlice()), </s> remove // GetSubnet returns pointer to net.IPNet for the specified interface or nil if </s> add // GetSubnet returns the subnet corresponding to the interface of zero prefix if </s> remove resp.UpdateOption(dhcpv4.OptServerIdentifier(s.conf.dnsIPAddrs[0])) </s> add resp.UpdateOption(dhcpv4.OptServerIdentifier(s.conf.dnsIPAddrs[0].AsSlice())) </s> remove func GetSubnet(ifaceName string) *net.IPNet { </s> add func GetSubnet(ifaceName string) (p netip.Prefix) { </s> remove broadcastIP net.IP </s> add broadcastIP netip.Addr
dhcpv4.OptRouter(s.conf.GatewayIP.AsSlice()),
// See https://datatracker.ietf.org/doc/html/rfc1122#section-4.2.3.6. dhcpv4.OptGeneric(dhcpv4.OptionTCPKeepaliveGarbage, []byte{0x01}), // Values From Configuration dhcpv4.OptRouter(s.conf.GatewayIP.AsSlice()), dhcpv4.OptSubnetMask(s.conf.SubnetMask.AsSlice()), ) // Set values for explicitly configured options.
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/options_unix.go
dhcpv4.OptGeneric(dhcpv4.OptionTCPKeepaliveGarbage, []byte{0x01}), // Values From Configuration // Set the Router Option to working subnet's IP since it's initialized // with the address of the gateway. dhcpv4.OptRouter(s.conf.subnet.IP), dhcpv4.OptSubnetMask(s.conf.subnet.Mask), ) // Set values for explicitly configured options. s.explicitOpts = dhcpv4.Options{} for i, o := range s.conf.Options {
</s> remove broadcastIP net.IP </s> add broadcastIP netip.Addr </s> remove subnet *net.IPNet </s> add subnet netip.Prefix </s> remove func GatewayIP(ifaceName string) (ip net.IP) { </s> add func GatewayIP(ifaceName string) (ip netip.Addr) { </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add
dhcpv4.OptSubnetMask(s.conf.SubnetMask.AsSlice()),
dhcpv4.OptGeneric(dhcpv4.OptionTCPKeepaliveGarbage, []byte{0x01}), // Values From Configuration dhcpv4.OptSubnetMask(s.conf.SubnetMask.AsSlice()), dhcpv4.OptSubnetMask(s.conf.SubnetMask.AsSlice()), dhcpv4.OptSubnetMask(s.conf.SubnetMask.AsSlice()), dhcpv4.OptSubnetMask(s.conf.SubnetMask.AsSlice()), dhcpv4.OptSubnetMask(s.conf.SubnetMask.AsSlice()), ) // Set values for explicitly configured options. s.explicitOpts = dhcpv4.Options{} for i, o := range s.conf.Options {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/options_unix.go
for _, tc := range testCases { s := &v4Server{ conf: &V4ServerConf{ // Just to avoid nil pointer dereference. subnet: &net.IPNet{}, Options: tc.opts, }, } t.Run(tc.name, func(t *testing.T) {
</s> remove subnet: &net.IPNet{ IP: net.IP{0, 0, 0, 0}, Mask: net.IPMask{0, 0, 0, 0}, }, want: net.IPv4bcast, </s> add }, { pref: netip.Prefix{}, want: netip.Addr{}, name: "invalid", </s> remove bc := BroadcastFromIPNet(tc.subnet) assert.True(t, bc.Equal(tc.want), bc) </s> add assert.Equal(t, tc.want, BroadcastFromPref(tc.pref)) </s> remove want: nil, </s> add want: netip.Addr{}, name: "bad_code", </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 224}, </s> add </s> remove RangeStart: net.IP{192, 168, 10, 20}, RangeEnd: net.IP{192, 168, 10, 200}, </s> add RangeStart: netip.MustParseAddr("192.168.10.20"), RangeEnd: netip.MustParseAddr("192.168.10.200"),
for _, tc := range testCases { s := &v4Server{ conf: &V4ServerConf{ Options: tc.opts, }, } t.Run(tc.name, func(t *testing.T) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/options_unix_test.go
"fmt" "net" "strings" "sync" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/golibs/errors"
</s> remove "net" </s> add "net/netip"
"net/netip"
"fmt" "net" "net/netip" "strings" "sync" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/golibs/errors"
[ "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix.go
if l.IsStatic() { // TODO(a.garipov, d.seregin): Subnet can be nil when dhcp server is // disabled. if sn := s.conf.subnet; !sn.Contains(l.IP) { return fmt.Errorf("subnet %s does not contain the ip %q", sn, l.IP) } } else if !inOffset { return fmt.Errorf("lease %s (%s) out of range, not adding", l.IP, l.HWAddr) }
</s> remove } else if gwIP := s.conf.GatewayIP; gwIP.Equal(ip) { </s> add } else if gwIP := s.conf.GatewayIP; gwIP == netip.AddrFrom4(*(*[4]byte)(ip)) { </s> remove // Collect network interface addresses. for _, addr := range addrs { ipNet, ok := addr.(*net.IPNet) if !ok { // Should be net.IPNet, this is weird. return nil, fmt.Errorf("got %s that is not net.IPNet, it is %T", addr, addr) } // Ignore link-local. if ipNet.IP.IsLinkLocalUnicast() { </s> add ip = ip.Unmap() if ip.IsLinkLocalUnicast() { // Ignore link-local IPv4. if ip.Is4() { </s> remove // ensureV4 returns a 4-byte version of ip. An error is returned if the passed // ip is not an IPv4. func ensureV4(ip net.IP) (ip4 net.IP, err error) { if ip == nil { return nil, fmt.Errorf("%v is not an IP address", ip) } ip4 = ip.To4() if ip4 == nil { return nil, fmt.Errorf("%v is not an IPv4 address", ip) </s> add // ensureV4 returns an unmapped version of ip. An error is returned if the // passed ip is not an IPv4. func ensureV4(ip netip.Addr, kind string) (ip4 netip.Addr, err error) { ip4 = ip.Unmap() if !ip4.IsValid() || !ip4.Is4() { return netip.Addr{}, fmt.Errorf("%v is not an IPv4 %s", ip, kind) </s> remove if ip4 := subnet.IP.To4(); ip4 != nil { subnet.IP = ip4 return subnet, nil </s> add if ip = ip.To4(); ip != nil { return netip.PrefixFrom(netip.AddrFrom4(*(*[4]byte)(ip)), maskLen), nil </s> remove if !sid.Equal(s.conf.dnsIPAddrs[0]) { </s> add if !sid.Equal(s.conf.dnsIPAddrs[0].AsSlice()) {
addr := netip.AddrFrom4(*(*[4]byte)(l.IP.To4())) if sn := s.conf.subnet; !sn.Contains(addr) {
if l.IsStatic() { // TODO(a.garipov, d.seregin): Subnet can be nil when dhcp server is // disabled. addr := netip.AddrFrom4(*(*[4]byte)(l.IP.To4())) if sn := s.conf.subnet; !sn.Contains(addr) { return fmt.Errorf("subnet %s does not contain the ip %q", sn, l.IP) } } else if !inOffset { return fmt.Errorf("lease %s (%s) out of range, not adding", l.IP, l.HWAddr) }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix.go
ip := l.IP.To4() if ip == nil { return fmt.Errorf("invalid ip %q, only ipv4 is supported", l.IP) } else if gwIP := s.conf.GatewayIP; gwIP.Equal(ip) { return fmt.Errorf("can't assign the gateway IP %s to the lease", gwIP) } l.Expiry = time.Unix(leaseExpireStatic, 0)
</s> remove if ip4 := subnet.IP.To4(); ip4 != nil { subnet.IP = ip4 return subnet, nil </s> add if ip = ip.To4(); ip != nil { return netip.PrefixFrom(netip.AddrFrom4(*(*[4]byte)(ip)), maskLen), nil </s> remove if sn := s.conf.subnet; !sn.Contains(l.IP) { </s> add addr := netip.AddrFrom4(*(*[4]byte)(l.IP.To4())) if sn := s.conf.subnet; !sn.Contains(addr) { </s> remove s.conf.dnsIPAddrs = dnsIPAddrs </s> add for _, ip := range dnsIPAddrs { ip = ip.To4() if ip == nil { continue } s.conf.dnsIPAddrs = append(s.conf.dnsIPAddrs, netip.AddrFrom4(*(*[4]byte)(ip))) } </s> remove IP: DefaultGatewayIP, </s> add IP: DefaultGatewayIP.AsSlice(), </s> remove // ensureV4 returns a 4-byte version of ip. An error is returned if the passed // ip is not an IPv4. func ensureV4(ip net.IP) (ip4 net.IP, err error) { if ip == nil { return nil, fmt.Errorf("%v is not an IP address", ip) } ip4 = ip.To4() if ip4 == nil { return nil, fmt.Errorf("%v is not an IPv4 address", ip) </s> add // ensureV4 returns an unmapped version of ip. An error is returned if the // passed ip is not an IPv4. func ensureV4(ip netip.Addr, kind string) (ip4 netip.Addr, err error) { ip4 = ip.Unmap() if !ip4.IsValid() || !ip4.Is4() { return netip.Addr{}, fmt.Errorf("%v is not an IPv4 %s", ip, kind)
} else if gwIP := s.conf.GatewayIP; gwIP == netip.AddrFrom4(*(*[4]byte)(ip)) {
ip := l.IP.To4() if ip == nil { return fmt.Errorf("invalid ip %q, only ipv4 is supported", l.IP) } else if gwIP := s.conf.GatewayIP; gwIP == netip.AddrFrom4(*(*[4]byte)(ip)) { return fmt.Errorf("can't assign the gateway IP %s to the lease", gwIP) } l.Expiry = time.Unix(leaseExpireStatic, 0)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix.go
) (l *Lease, needsReply bool) { // Client inserts the address of the selected server in server identifier, // ciaddr MUST be zero. mac := req.ClientHWAddr if !sid.Equal(s.conf.dnsIPAddrs[0]) { log.Debug("dhcpv4: bad server identifier in req msg for %s: %s", mac, sid) return nil, false } else if ciaddr := req.ClientIPAddr; ciaddr != nil && !ciaddr.IsUnspecified() { log.Debug("dhcpv4: non-zero ciaddr in selecting req msg for %s", mac)
</s> remove if ip4 := reqIP.To4(); ip4 == nil { </s> add ip4 := reqIP.To4() if ip4 == nil { </s> remove if !s.conf.subnet.Contains(reqIP) { </s> add if !s.conf.subnet.Contains(netip.AddrFrom4(*(*[4]byte)(ip4))) { </s> remove addrs = appendDNSAddrs(addrs, net.IP{127, 0, 0, 1}) </s> add addr := aghnet.IPv4Localhost() addrs = appendDNSAddrs(addrs, addr) </s> remove return Context.web.httpsServer.server != nil || aghnet.CheckPort("tcp", config.BindHost, port) == nil </s> add if Context.web.httpsServer.server != nil { return true } return aghnet.CheckPort("tcp", netip.AddrPortFrom(config.BindHost, uint16(port))) == nil </s> remove defaultIP := net.IP{192, 168, 1, 1} </s> add defaultIP := netip.MustParseAddr("192.168.1.1")
if !sid.Equal(s.conf.dnsIPAddrs[0].AsSlice()) {
) (l *Lease, needsReply bool) { // Client inserts the address of the selected server in server identifier, // ciaddr MUST be zero. mac := req.ClientHWAddr if !sid.Equal(s.conf.dnsIPAddrs[0].AsSlice()) { log.Debug("dhcpv4: bad server identifier in req msg for %s: %s", mac, sid) return nil, false } else if ciaddr := req.ClientIPAddr; ciaddr != nil && !ciaddr.IsUnspecified() { log.Debug("dhcpv4: non-zero ciaddr in selecting req msg for %s", mac)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix.go
// handleInitReboot handles the DHCPREQUEST generated during INIT-REBOOT state. func (s *v4Server) handleInitReboot(req *dhcpv4.DHCPv4, reqIP net.IP) (l *Lease, needsReply bool) { mac := req.ClientHWAddr if ip4 := reqIP.To4(); ip4 == nil { log.Debug("dhcpv4: bad requested address in req msg for %s: %s", mac, reqIP) return nil, false }
</s> remove if !sid.Equal(s.conf.dnsIPAddrs[0]) { </s> add if !sid.Equal(s.conf.dnsIPAddrs[0].AsSlice()) { </s> remove if !s.conf.subnet.Contains(reqIP) { </s> add if !s.conf.subnet.Contains(netip.AddrFrom4(*(*[4]byte)(ip4))) { </s> remove for _, iface := range ifaces { var addrs []net.Addr addrs, err = iface.Addrs() if err != nil { return nil, fmt.Errorf("failed to get addresses for interface %s: %w", iface.Name, err) </s> add // Collect network interface addresses. for _, addr := range addrs { n, ok := addr.(*net.IPNet) if !ok { // Should be *net.IPNet, this is weird. return nil, fmt.Errorf("expected %[2]s to be %[1]T, got %[2]T", n, addr) } else if ip4 := n.IP.To4(); ip4 != nil { n.IP = ip4 </s> remove // ensureV4 returns a 4-byte version of ip. An error is returned if the passed // ip is not an IPv4. func ensureV4(ip net.IP) (ip4 net.IP, err error) { if ip == nil { return nil, fmt.Errorf("%v is not an IP address", ip) } ip4 = ip.To4() if ip4 == nil { return nil, fmt.Errorf("%v is not an IPv4 address", ip) </s> add // ensureV4 returns an unmapped version of ip. An error is returned if the // passed ip is not an IPv4. func ensureV4(ip netip.Addr, kind string) (ip4 netip.Addr, err error) { ip4 = ip.Unmap() if !ip4.IsValid() || !ip4.Is4() { return netip.Addr{}, fmt.Errorf("%v is not an IPv4 %s", ip, kind) </s> remove if ip4 := subnet.IP.To4(); ip4 != nil { subnet.IP = ip4 return subnet, nil </s> add if ip = ip.To4(); ip != nil { return netip.PrefixFrom(netip.AddrFrom4(*(*[4]byte)(ip)), maskLen), nil
ip4 := reqIP.To4() if ip4 == nil {
// handleInitReboot handles the DHCPREQUEST generated during INIT-REBOOT state. func (s *v4Server) handleInitReboot(req *dhcpv4.DHCPv4, reqIP net.IP) (l *Lease, needsReply bool) { mac := req.ClientHWAddr ip4 := reqIP.To4() if ip4 == nil { log.Debug("dhcpv4: bad requested address in req msg for %s: %s", mac, reqIP) return nil, false }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix.go
return nil, false } if !s.conf.subnet.Contains(reqIP) { // If the DHCP server detects that the client is on the wrong net then // the server SHOULD send a DHCPNAK message to the client. log.Debug("dhcpv4: wrong subnet in init-reboot req msg for %s: %s", mac, reqIP) return nil, true
</s> remove if !sid.Equal(s.conf.dnsIPAddrs[0]) { </s> add if !sid.Equal(s.conf.dnsIPAddrs[0].AsSlice()) { </s> remove if ip4 := reqIP.To4(); ip4 == nil { </s> add ip4 := reqIP.To4() if ip4 == nil { </s> remove dnsIPAddrs []net.IP // IPv4 addresses to return to DHCP clients as DNS server addresses </s> add dnsIPAddrs []netip.Addr // IPv4 addresses to return to DHCP clients as DNS server addresses </s> remove subnet *net.IPNet </s> add subnet netip.Prefix </s> remove BindHost net.IP `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to BindPort int `yaml:"bind_port"` // BindPort is the port the HTTP server BetaBindPort int `yaml:"beta_bind_port"` // BetaBindPort is the port for new client Users []webUser `yaml:"users"` // Users that can access HTTP server </s> add // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` // BetaBindPort is the port for the new client's web interface server to // listen on. BetaBindPort int `yaml:"beta_bind_port"` // Users are the clients capable for accessing the web interface. Users []webUser `yaml:"users"`
if !s.conf.subnet.Contains(netip.AddrFrom4(*(*[4]byte)(ip4))) {
return nil, false } if !s.conf.subnet.Contains(netip.AddrFrom4(*(*[4]byte)(ip4))) { // If the DHCP server detects that the client is on the wrong net then // the server SHOULD send a DHCPNAK message to the client. log.Debug("dhcpv4: wrong subnet in init-reboot req msg for %s: %s", mac, reqIP) return nil, true
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix.go
// Include server's identifier option since any reply should contain it. // // See https://datatracker.ietf.org/doc/html/rfc2131#page-29. resp.UpdateOption(dhcpv4.OptServerIdentifier(s.conf.dnsIPAddrs[0])) // TODO(a.garipov): Refactor this into handlers. var l *Lease switch mt := req.MessageType(); mt { case dhcpv4.MessageTypeDiscover:
</s> remove addr := netutil.IPPort{IP: ip, Port: port}.String() </s> add addr := ipp.String() </s> remove return nil, err </s> add return netip.Prefix{}, err </s> remove func CheckPort(network string, ip net.IP, port int) (err error) { </s> add func CheckPort(network string, ipp netip.AddrPort) (err error) { </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add
resp.UpdateOption(dhcpv4.OptServerIdentifier(s.conf.dnsIPAddrs[0].AsSlice()))
// Include server's identifier option since any reply should contain it. // // See https://datatracker.ietf.org/doc/html/rfc2131#page-29. resp.UpdateOption(dhcpv4.OptServerIdentifier(s.conf.dnsIPAddrs[0].AsSlice())) // TODO(a.garipov): Refactor this into handlers. var l *Lease switch mt := req.MessageType(); mt { case dhcpv4.MessageTypeDiscover:
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix.go
if !s.explicitOpts.Has(dhcpv4.OptionDomainNameServer) { s.implicitOpts.Update(dhcpv4.OptDNS(dnsIPAddrs...)) } s.conf.dnsIPAddrs = dnsIPAddrs var c net.PacketConn if c, err = s.newDHCPConn(iface); err != nil { return err }
</s> remove var gatewayIP net.IP gatewayIP, err = ensureV4(c.GatewayIP) </s> add gatewayIP, err := ensureV4(c.GatewayIP, "address") </s> remove addr := netutil.IPPort{IP: ip, Port: port}.String() </s> add addr := ipp.String() </s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove func CheckPort(network string, ip net.IP, port int) (err error) { </s> add func CheckPort(network string, ipp netip.AddrPort) (err error) { </s> remove s.conf.dnsIPAddrs = []net.IP{defaultIP} </s> add s.conf.dnsIPAddrs = []netip.Addr{defaultIP}
for _, ip := range dnsIPAddrs { ip = ip.To4() if ip == nil { continue } s.conf.dnsIPAddrs = append(s.conf.dnsIPAddrs, netip.AddrFrom4(*(*[4]byte)(ip))) }
if !s.explicitOpts.Has(dhcpv4.OptionDomainNameServer) { s.implicitOpts.Update(dhcpv4.OptDNS(dnsIPAddrs...)) } for _, ip := range dnsIPAddrs { ip = ip.To4() if ip == nil { continue } s.conf.dnsIPAddrs = append(s.conf.dnsIPAddrs, netip.AddrFrom4(*(*[4]byte)(ip))) } var c net.PacketConn if c, err = s.newDHCPConn(iface); err != nil { return err }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix.go
"fmt" "net" "strings" "testing" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
</s> remove "net" </s> add
"net/netip"
"fmt" "net" "net/netip" "strings" "testing" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
[ "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
"github.com/mdlayher/raw" ) var ( DefaultRangeStart = net.IP{192, 168, 10, 100} DefaultRangeEnd = net.IP{192, 168, 10, 200} DefaultGatewayIP = net.IP{192, 168, 10, 1} DefaultSelfIP = net.IP{192, 168, 10, 2} DefaultSubnetMask = net.IP{255, 255, 255, 0} ) // defaultV4ServerConf returns the default configuration for *v4Server to use in // tests. func defaultV4ServerConf() (conf *V4ServerConf) {
</s> remove RangeStart: net.IP{192, 168, 10, 100}, RangeEnd: net.IP{192, 168, 10, 200}, GatewayIP: net.IP{192, 168, 10, 1}, SubnetMask: net.IP{255, 255, 255, 0}, </s> add RangeStart: netip.MustParseAddr("192.168.10.100"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: netip.MustParseAddr("192.168.10.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), </s> remove name: "outside_range_start", </s> add name: "outside_range_start", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.240"), </s> remove name: "outside_range_end", </s> add name: "outside_range_end", gatewayIP: netip.MustParseAddr("192.168.10.1"), subnetMask: netip.MustParseAddr("255.255.255.224"), </s> remove gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, </s> add </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, </s> add
DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0")
"github.com/mdlayher/raw" ) var ( DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0") DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0") DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0") DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0") DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0") ) // defaultV4ServerConf returns the default configuration for *v4Server to use in // tests. func defaultV4ServerConf() (conf *V4ServerConf) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
RangeEnd: DefaultRangeEnd, GatewayIP: DefaultGatewayIP, SubnetMask: DefaultSubnetMask, notify: testNotify, dnsIPAddrs: []net.IP{DefaultSelfIP}, } } // defaultSrv prepares the default DHCPServer to use in tests. The underlying // type of s is *v4Server.
</s> remove RangeStart: net.IP{192, 168, 10, 100}, RangeEnd: net.IP{192, 168, 10, 200}, GatewayIP: net.IP{192, 168, 10, 1}, SubnetMask: net.IP{255, 255, 255, 0}, </s> add RangeStart: netip.MustParseAddr("192.168.10.100"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: netip.MustParseAddr("192.168.10.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), </s> remove RangeStart: net.IP{192, 168, 10, 20}, RangeEnd: net.IP{192, 168, 10, 200}, </s> add RangeStart: netip.MustParseAddr("192.168.10.20"), RangeEnd: netip.MustParseAddr("192.168.10.200"), </s> remove GatewayIP: net.IP{1, 2, 3, 1}, SubnetMask: net.IP{255, 255, 255, 0}, RangeStart: net.IP{1, 2, 3, 2}, RangeEnd: net.IP{1, 2, 3, 10}, </s> add GatewayIP: netip.MustParseAddr("1.2.3.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("1.2.3.2"), RangeEnd: netip.MustParseAddr("1.2.3.10"), </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove DefaultRangeStart = net.IP{192, 168, 10, 100} DefaultRangeEnd = net.IP{192, 168, 10, 200} DefaultGatewayIP = net.IP{192, 168, 10, 1} DefaultSelfIP = net.IP{192, 168, 10, 2} DefaultSubnetMask = net.IP{255, 255, 255, 0} </s> add DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0")
dnsIPAddrs: []netip.Addr{DefaultSelfIP},
RangeEnd: DefaultRangeEnd, GatewayIP: DefaultGatewayIP, SubnetMask: DefaultSubnetMask, notify: testNotify, dnsIPAddrs: []netip.Addr{DefaultSelfIP}, } } // defaultSrv prepares the default DHCPServer to use in tests. The underlying // type of s is *v4Server.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
err = s.AddStaticLease(&Lease{ Expiry: time.Unix(leaseExpireStatic, 0), Hostname: staticName, HWAddr: anotherMAC, IP: anotherIP, }) assert.ErrorIs(t, err, ErrDupHostname) }) t.Run("same_mac", func(t *testing.T) {
</s> remove IP: anotherIP, </s> add IP: anotherIP.AsSlice(), </s> remove resp := discoverAnOffer(t, anotherName, anotherIP, staticMAC) </s> add resp := discoverAnOffer(t, anotherName, anotherIP.AsSlice(), staticMAC) </s> remove resp := discoverAnOffer(t, staticName, anotherIP, anotherMAC) </s> add resp := discoverAnOffer(t, staticName, anotherIP.AsSlice(), anotherMAC) </s> remove err := CheckPort("bad_network", nil, 0) </s> add err := CheckPort("bad_network", netip.AddrPortFrom(netip.Addr{}, 0)) </s> remove err := CheckPort("udp", net.IP{0, 0, 0, 0}, 0) </s> add err := CheckPort("udp", netip.AddrPortFrom(netip.IPv4Unspecified(), 0))
IP: anotherIP.AsSlice(),
err = s.AddStaticLease(&Lease{ Expiry: time.Unix(leaseExpireStatic, 0), Hostname: staticName, HWAddr: anotherMAC, IP: anotherIP.AsSlice(), }) assert.ErrorIs(t, err, ErrDupHostname) }) t.Run("same_mac", func(t *testing.T) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
err = s.AddStaticLease(&Lease{ Expiry: time.Unix(leaseExpireStatic, 0), Hostname: anotherName, HWAddr: staticMAC, IP: anotherIP, }) testutil.AssertErrorMsg(t, wantErrMsg, err) }) t.Run("same_ip", func(t *testing.T) {
</s> remove IP: anotherIP, </s> add IP: anotherIP.AsSlice(), </s> remove resp := discoverAnOffer(t, anotherName, anotherIP, staticMAC) </s> add resp := discoverAnOffer(t, anotherName, anotherIP.AsSlice(), staticMAC) </s> remove err := CheckPort("udp", net.IP{0, 0, 0, 0}, 0) </s> add err := CheckPort("udp", netip.AddrPortFrom(netip.IPv4Unspecified(), 0)) </s> remove err := CheckPort("bad_network", nil, 0) </s> add err := CheckPort("bad_network", netip.AddrPortFrom(netip.Addr{}, 0)) </s> remove conn, err := net.ListenPacket("udp", "127.0.0.1:") </s> add conn, err := net.ListenPacket("udp", laddr.String())
IP: anotherIP.AsSlice(),
err = s.AddStaticLease(&Lease{ Expiry: time.Unix(leaseExpireStatic, 0), Hostname: anotherName, HWAddr: staticMAC, IP: anotherIP.AsSlice(), }) testutil.AssertErrorMsg(t, wantErrMsg, err) }) t.Run("same_ip", func(t *testing.T) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
mac, dhcpv4.WithOption(dhcpv4.OptHostName(name)), dhcpv4.WithOption(dhcpv4.OptRequestedIPAddress(ip)), dhcpv4.WithOption(dhcpv4.OptClientIdentifier([]byte{1, 2, 3, 4, 5, 6, 8})), dhcpv4.WithGatewayIP(DefaultGatewayIP), ) require.NoError(t, err) resp = &dhcpv4.DHCPv4{} res := s4.handle(req, resp)
</s> remove known6 := net.IP{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, } </s> add known4 := netip.MustParseAddr("192.168.0.1") fullBroadcast4 := netip.MustParseAddr("255.255.255.255") known6 := netip.MustParseAddr("102:304:506:708:90a:b0c:d0e:f10") </s> remove GatewayIP: net.IP{1, 2, 3, 1}, SubnetMask: net.IP{255, 255, 255, 0}, RangeStart: net.IP{1, 2, 3, 2}, RangeEnd: net.IP{1, 2, 3, 10}, </s> add GatewayIP: netip.MustParseAddr("1.2.3.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("1.2.3.2"), RangeEnd: netip.MustParseAddr("1.2.3.10"), </s> remove resp := discoverAnOffer(t, staticName, anotherIP, anotherMAC) </s> add resp := discoverAnOffer(t, staticName, anotherIP.AsSlice(), anotherMAC) </s> remove resp := discoverAnOffer(t, anotherName, anotherIP, staticMAC) </s> add resp := discoverAnOffer(t, anotherName, anotherIP.AsSlice(), staticMAC) </s> remove s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) </s> add s.conf.dnsIPAddrs = []netip.Addr{netip.MustParseAddr("192.168.10.1")} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs[0].AsSlice()))
dhcpv4.WithGatewayIP(DefaultGatewayIP.AsSlice()),
mac, dhcpv4.WithOption(dhcpv4.OptHostName(name)), dhcpv4.WithOption(dhcpv4.OptRequestedIPAddress(ip)), dhcpv4.WithOption(dhcpv4.OptClientIdentifier([]byte{1, 2, 3, 4, 5, 6, 8})), dhcpv4.WithGatewayIP(DefaultGatewayIP.AsSlice()), ) require.NoError(t, err) resp = &dhcpv4.DHCPv4{} res := s4.handle(req, resp)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
return resp } t.Run("same_name", func(t *testing.T) { resp := discoverAnOffer(t, staticName, anotherIP, anotherMAC) req, err := dhcpv4.NewRequestFromOffer(resp, dhcpv4.WithOption( dhcpv4.OptHostName(staticName), )) require.NoError(t, err)
</s> remove resp := discoverAnOffer(t, anotherName, anotherIP, staticMAC) </s> add resp := discoverAnOffer(t, anotherName, anotherIP.AsSlice(), staticMAC) </s> remove s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) </s> add s.conf.dnsIPAddrs = []netip.Addr{netip.MustParseAddr("192.168.10.1")} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs[0].AsSlice())) </s> remove IP: anotherIP, </s> add IP: anotherIP.AsSlice(), </s> remove dhcpv4.WithGatewayIP(DefaultGatewayIP), </s> add dhcpv4.WithGatewayIP(DefaultGatewayIP.AsSlice()),
resp := discoverAnOffer(t, staticName, anotherIP.AsSlice(), anotherMAC)
return resp } t.Run("same_name", func(t *testing.T) { resp := discoverAnOffer(t, staticName, anotherIP.AsSlice(), anotherMAC) req, err := dhcpv4.NewRequestFromOffer(resp, dhcpv4.WithOption( dhcpv4.OptHostName(staticName), )) require.NoError(t, err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
assert.Equal(t, aghnet.GenerateHostname(resp.YourIPAddr), resp.HostName()) }) t.Run("same_mac", func(t *testing.T) { resp := discoverAnOffer(t, anotherName, anotherIP, staticMAC) req, err := dhcpv4.NewRequestFromOffer(resp, dhcpv4.WithOption( dhcpv4.OptHostName(anotherName), )) require.NoError(t, err)
</s> remove resp := discoverAnOffer(t, staticName, anotherIP, anotherMAC) </s> add resp := discoverAnOffer(t, staticName, anotherIP.AsSlice(), anotherMAC) </s> remove IP: anotherIP, </s> add IP: anotherIP.AsSlice(), </s> remove IP: anotherIP, </s> add IP: anotherIP.AsSlice(), </s> remove s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) </s> add s.conf.dnsIPAddrs = []netip.Addr{netip.MustParseAddr("192.168.10.1")} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs[0].AsSlice())) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones)
resp := discoverAnOffer(t, anotherName, anotherIP.AsSlice(), staticMAC)
assert.Equal(t, aghnet.GenerateHostname(resp.YourIPAddr), resp.HostName()) }) t.Run("same_mac", func(t *testing.T) { resp := discoverAnOffer(t, anotherName, anotherIP.AsSlice(), staticMAC) req, err := dhcpv4.NewRequestFromOffer(resp, dhcpv4.WithOption( dhcpv4.OptHostName(anotherName), )) require.NoError(t, err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
}, { lease: &Lease{ Hostname: "probably-router.local", HWAddr: net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}, IP: DefaultGatewayIP, }, name: "with_gateway_ip", wantErrMsg: "dhcpv4: adding static lease: " + "can't assign the gateway IP 192.168.10.1 to the lease", }, {
</s> remove s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) </s> add dnsAddr := netip.MustParseAddr("192.168.10.1") s.conf.dnsIPAddrs = []netip.Addr{dnsAddr} s.implicitOpts.Update(dhcpv4.OptDNS(dnsAddr.AsSlice())) </s> remove s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) </s> add s.conf.dnsIPAddrs = []netip.Addr{netip.MustParseAddr("192.168.10.1")} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs[0].AsSlice())) </s> remove gatewayIP: net.IP{192, 168, 10, 120}, subnetMask: net.IP{255, 255, 255, 0}, </s> add </s> remove gatewayIP: net.IP{192, 168, 10, 1}, subnetMask: net.IP{255, 255, 255, 240}, </s> add </s> remove name: "gateway_in_range", </s> add name: "gateway_in_range", gatewayIP: netip.MustParseAddr("192.168.10.120"), subnetMask: netip.MustParseAddr("255.255.255.0"),
IP: DefaultGatewayIP.AsSlice(),
}, { lease: &Lease{ Hostname: "probably-router.local", HWAddr: net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}, IP: DefaultGatewayIP.AsSlice(), }, name: "with_gateway_ip", wantErrMsg: "dhcpv4: adding static lease: " + "can't assign the gateway IP 192.168.10.1 to the lease", }, {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
} } func TestV4Server_handle_optionsPriority(t *testing.T) { defaultIP := net.IP{192, 168, 1, 1} knownIP := net.IP{1, 2, 3, 4} // prepareSrv creates a *v4Server and sets the opt6IPs in the initial // configuration of the server as the value for DHCP option 6. prepareSrv := func(t *testing.T, opt6IPs []net.IP) (s *v4Server) {
</s> remove DefaultRangeStart = net.IP{192, 168, 10, 100} DefaultRangeEnd = net.IP{192, 168, 10, 200} DefaultGatewayIP = net.IP{192, 168, 10, 1} DefaultSelfIP = net.IP{192, 168, 10, 2} DefaultSubnetMask = net.IP{255, 255, 255, 0} </s> add DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0") </s> remove dnsIPAddrs []net.IP // IPv4 addresses to return to DHCP clients as DNS server addresses </s> add dnsIPAddrs []netip.Addr // IPv4 addresses to return to DHCP clients as DNS server addresses </s> remove if !s.conf.subnet.Contains(reqIP) { </s> add if !s.conf.subnet.Contains(netip.AddrFrom4(*(*[4]byte)(ip4))) { </s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove if ip4 := reqIP.To4(); ip4 == nil { </s> add ip4 := reqIP.To4() if ip4 == nil {
defaultIP := netip.MustParseAddr("192.168.1.1")
} } func TestV4Server_handle_optionsPriority(t *testing.T) { defaultIP := netip.MustParseAddr("192.168.1.1") knownIP := net.IP{1, 2, 3, 4} // prepareSrv creates a *v4Server and sets the opt6IPs in the initial // configuration of the server as the value for DHCP option 6. prepareSrv := func(t *testing.T, opt6IPs []net.IP) (s *v4Server) {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
stringutil.WriteToBuilder(b, ",", ip.String()) } conf.Options = []string{b.String()} } else { defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP)) }() } var err error s, err = v4Create(conf) require.NoError(t, err)
</s> remove s.conf.dnsIPAddrs = []net.IP{defaultIP} </s> add s.conf.dnsIPAddrs = []netip.Addr{defaultIP} </s> remove s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) </s> add s.conf.dnsIPAddrs = []netip.Addr{netip.MustParseAddr("192.168.10.1")} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs[0].AsSlice())) </s> remove return nil, fmt.Errorf("couldn't get interfaces: %w", err) } else if len(ifaces) == 0 { return nil, errors.Error("couldn't find any legible interface") </s> add return nil, fmt.Errorf("failed to get addresses for interface %s: %w", iface.Name, err) </s> remove l, err := net.Listen("tcp", "127.0.0.1:") </s> add l, err := net.Listen("tcp", laddr.String())
defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP.AsSlice())) }()
stringutil.WriteToBuilder(b, ",", ip.String()) } conf.Options = []string{b.String()} } else { defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP.AsSlice())) }() } var err error s, err = v4Create(conf) require.NoError(t, err)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
var err error s, err = v4Create(conf) require.NoError(t, err) s.conf.dnsIPAddrs = []net.IP{defaultIP} return s } // checkResp creates a discovery message with DHCP option 6 requested amd
</s> remove s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) </s> add s.conf.dnsIPAddrs = []netip.Addr{netip.MustParseAddr("192.168.10.1")} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs[0].AsSlice())) </s> remove defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP)) }() </s> add defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP.AsSlice())) }() </s> remove var subnet *net.IPNet </s> add var subnet netip.Prefix </s> remove s.conf.dnsIPAddrs = dnsIPAddrs </s> add for _, ip := range dnsIPAddrs { ip = ip.To4() if ip == nil { continue } s.conf.dnsIPAddrs = append(s.conf.dnsIPAddrs, netip.AddrFrom4(*(*[4]byte)(ip))) } </s> remove checkResp(t, s, []net.IP{defaultIP}) </s> add checkResp(t, s, []net.IP{defaultIP.AsSlice()})
s.conf.dnsIPAddrs = []netip.Addr{defaultIP}
var err error s, err = v4Create(conf) require.NoError(t, err) s.conf.dnsIPAddrs = []netip.Addr{defaultIP} return s } // checkResp creates a discovery message with DHCP option 6 requested amd
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
t.Run("default", func(t *testing.T) { s := prepareSrv(t, nil) checkResp(t, s, []net.IP{defaultIP}) }) t.Run("explicitly_configured", func(t *testing.T) { s := prepareSrv(t, []net.IP{knownIP, knownIP})
</s> remove // Just to avoid nil pointer dereference. subnet: &net.IPNet{}, </s> add </s> remove err := CheckPort("bad_network", nil, 0) </s> add err := CheckPort("bad_network", netip.AddrPortFrom(netip.Addr{}, 0)) </s> remove err := CheckPort("udp", net.IP{0, 0, 0, 0}, 0) </s> add err := CheckPort("udp", netip.AddrPortFrom(netip.IPv4Unspecified(), 0)) </s> remove bc := BroadcastFromIPNet(tc.subnet) assert.True(t, bc.Equal(tc.want), bc) </s> add assert.Equal(t, tc.want, BroadcastFromPref(tc.pref)) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones)
checkResp(t, s, []net.IP{defaultIP.AsSlice()})
t.Run("default", func(t *testing.T) { s := prepareSrv(t, nil) checkResp(t, s, []net.IP{defaultIP.AsSlice()}) }) t.Run("explicitly_configured", func(t *testing.T) { s := prepareSrv(t, []net.IP{knownIP, knownIP})
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
s, ok := sIface.(*v4Server) require.True(t, ok) s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) l := &Lease{ Hostname: "static-1.local", HWAddr: net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}, IP: net.IP{192, 168, 10, 150},
</s> remove s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) </s> add s.conf.dnsIPAddrs = []netip.Addr{netip.MustParseAddr("192.168.10.1")} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs[0].AsSlice())) </s> remove IP: DefaultGatewayIP, </s> add IP: DefaultGatewayIP.AsSlice(), </s> remove ip4, ip6 := net.IP{1, 2, 3, 4}, net.IP{0xAA, 0xAA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} mask4, mask6 := net.CIDRMask(24, netutil.IPv4BitLen), net.CIDRMask(8, netutil.IPv6BitLen) </s> add ip4, ok := netip.AddrFromSlice([]byte{1, 2, 3, 4}) require.True(t, ok) ip6, ok := netip.AddrFromSlice([]byte{0xAA, 0xAA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}) require.True(t, ok) net4 := netip.PrefixFrom(ip4, 24) net6 := netip.PrefixFrom(ip6, 8) </s> remove RangeStart: net.IP{192, 168, 10, 100}, RangeEnd: net.IP{192, 168, 10, 200}, GatewayIP: net.IP{192, 168, 10, 1}, SubnetMask: net.IP{255, 255, 255, 0}, </s> add RangeStart: netip.MustParseAddr("192.168.10.100"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: netip.MustParseAddr("192.168.10.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), </s> remove DefaultRangeStart = net.IP{192, 168, 10, 100} DefaultRangeEnd = net.IP{192, 168, 10, 200} DefaultGatewayIP = net.IP{192, 168, 10, 1} DefaultSelfIP = net.IP{192, 168, 10, 2} DefaultSubnetMask = net.IP{255, 255, 255, 0} </s> add DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0")
dnsAddr := netip.MustParseAddr("192.168.10.1") s.conf.dnsIPAddrs = []netip.Addr{dnsAddr} s.implicitOpts.Update(dhcpv4.OptDNS(dnsAddr.AsSlice()))
s, ok := sIface.(*v4Server) require.True(t, ok) dnsAddr := netip.MustParseAddr("192.168.10.1") s.conf.dnsIPAddrs = []netip.Addr{dnsAddr} s.implicitOpts.Update(dhcpv4.OptDNS(dnsAddr.AsSlice())) dnsAddr := netip.MustParseAddr("192.168.10.1") s.conf.dnsIPAddrs = []netip.Addr{dnsAddr} s.implicitOpts.Update(dhcpv4.OptDNS(dnsAddr.AsSlice())) l := &Lease{ Hostname: "static-1.local", HWAddr: net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}, IP: net.IP{192, 168, 10, 150},
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
t.Run("offer", func(t *testing.T) { assert.Equal(t, dhcpv4.MessageTypeOffer, resp.MessageType()) assert.Equal(t, mac, resp.ClientHWAddr) assert.True(t, l.IP.Equal(resp.YourIPAddr)) assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) }) t.Run("request", func(t *testing.T) { req, err = dhcpv4.NewRequestFromOffer(resp)
</s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.Equal(t, s.conf.RangeStart, resp.YourIPAddr) assert.Equal(t, s.conf.GatewayIP, resp.ServerIdentifier()) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.True(t, s.conf.RangeStart.Equal(resp.YourIPAddr)) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones)
assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones)
t.Run("offer", func(t *testing.T) { assert.Equal(t, dhcpv4.MessageTypeOffer, resp.MessageType()) assert.Equal(t, mac, resp.ClientHWAddr) assert.True(t, l.IP.Equal(resp.YourIPAddr)) assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) }) t.Run("request", func(t *testing.T) { req, err = dhcpv4.NewRequestFromOffer(resp)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
t.Run("ack", func(t *testing.T) { assert.Equal(t, dhcpv4.MessageTypeAck, resp.MessageType()) assert.Equal(t, mac, resp.ClientHWAddr) assert.True(t, l.IP.Equal(resp.YourIPAddr)) assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) }) dnsAddrs := resp.DNS() require.Len(t, dnsAddrs, 1)
</s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.True(t, s.conf.RangeStart.Equal(resp.YourIPAddr)) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) </s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.Equal(t, s.conf.RangeStart, resp.YourIPAddr) assert.Equal(t, s.conf.GatewayIP, resp.ServerIdentifier()) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice()))
assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones)
t.Run("ack", func(t *testing.T) { assert.Equal(t, dhcpv4.MessageTypeAck, resp.MessageType()) assert.Equal(t, mac, resp.ClientHWAddr) assert.True(t, l.IP.Equal(resp.YourIPAddr)) assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) }) dnsAddrs := resp.DNS() require.Len(t, dnsAddrs, 1)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
dnsAddrs := resp.DNS() require.Len(t, dnsAddrs, 1) assert.True(t, s.conf.GatewayIP.Equal(dnsAddrs[0])) t.Run("check_lease", func(t *testing.T) { ls := s.GetLeases(LeasesStatic) require.Len(t, ls, 1)
</s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.True(t, s.conf.RangeStart.Equal(resp.YourIPAddr)) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) </s> remove assert.Equal(t, s.conf.RangeStart, resp.YourIPAddr) assert.Equal(t, s.conf.GatewayIP, resp.ServerIdentifier()) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice()))
assert.True(t, dnsAddrs[0].Equal(s.conf.GatewayIP.AsSlice()))
dnsAddrs := resp.DNS() require.Len(t, dnsAddrs, 1) assert.True(t, dnsAddrs[0].Equal(s.conf.GatewayIP.AsSlice())) t.Run("check_lease", func(t *testing.T) { ls := s.GetLeases(LeasesStatic) require.Len(t, ls, 1)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
s, err := v4Create(conf) require.NoError(t, err) s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) var req, resp *dhcpv4.DHCPv4 mac := net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA} t.Run("discover", func(t *testing.T) {
</s> remove s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs...)) </s> add dnsAddr := netip.MustParseAddr("192.168.10.1") s.conf.dnsIPAddrs = []netip.Addr{dnsAddr} s.implicitOpts.Update(dhcpv4.OptDNS(dnsAddr.AsSlice())) </s> remove IP: DefaultGatewayIP, </s> add IP: DefaultGatewayIP.AsSlice(), </s> remove s.conf.dnsIPAddrs = []net.IP{defaultIP} </s> add s.conf.dnsIPAddrs = []netip.Addr{defaultIP} </s> remove resp := discoverAnOffer(t, staticName, anotherIP, anotherMAC) </s> add resp := discoverAnOffer(t, staticName, anotherIP.AsSlice(), anotherMAC) </s> remove resp := discoverAnOffer(t, anotherName, anotherIP, staticMAC) </s> add resp := discoverAnOffer(t, anotherName, anotherIP.AsSlice(), staticMAC)
s.conf.dnsIPAddrs = []netip.Addr{netip.MustParseAddr("192.168.10.1")} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs[0].AsSlice()))
s, err := v4Create(conf) require.NoError(t, err) s.conf.dnsIPAddrs = []netip.Addr{netip.MustParseAddr("192.168.10.1")} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs[0].AsSlice())) s.conf.dnsIPAddrs = []netip.Addr{netip.MustParseAddr("192.168.10.1")} s.implicitOpts.Update(dhcpv4.OptDNS(s.conf.dnsIPAddrs[0].AsSlice())) var req, resp *dhcpv4.DHCPv4 mac := net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA} t.Run("discover", func(t *testing.T) {
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
t.Run("offer", func(t *testing.T) { assert.Equal(t, dhcpv4.MessageTypeOffer, resp.MessageType()) assert.Equal(t, mac, resp.ClientHWAddr) assert.Equal(t, s.conf.RangeStart, resp.YourIPAddr) assert.Equal(t, s.conf.GatewayIP, resp.ServerIdentifier()) router := resp.Router() require.Len(t, router, 1) assert.Equal(t, s.conf.GatewayIP, router[0])
</s> remove assert.True(t, s.conf.RangeStart.Equal(resp.YourIPAddr)) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) </s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones)
assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice()))
t.Run("offer", func(t *testing.T) { assert.Equal(t, dhcpv4.MessageTypeOffer, resp.MessageType()) assert.Equal(t, mac, resp.ClientHWAddr) assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) router := resp.Router() require.Len(t, router, 1) assert.Equal(t, s.conf.GatewayIP, router[0])
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
router := resp.Router() require.Len(t, router, 1) assert.Equal(t, s.conf.GatewayIP, router[0]) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) assert.Equal(t, []byte("012"), resp.Options.Get(dhcpv4.OptionFQDN))
</s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.Equal(t, s.conf.RangeStart, resp.YourIPAddr) assert.Equal(t, s.conf.GatewayIP, resp.ServerIdentifier()) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.True(t, s.conf.RangeStart.Equal(resp.YourIPAddr)) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice()))
assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice()))
router := resp.Router() require.Len(t, router, 1) assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) assert.Equal(t, []byte("012"), resp.Options.Get(dhcpv4.OptionFQDN))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
require.Len(t, router, 1) assert.Equal(t, s.conf.GatewayIP, router[0]) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) assert.Equal(t, []byte("012"), resp.Options.Get(dhcpv4.OptionFQDN)) rai := resp.RelayAgentInfo() require.NotNil(t, rai)
</s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.Equal(t, s.conf.RangeStart, resp.YourIPAddr) assert.Equal(t, s.conf.GatewayIP, resp.ServerIdentifier()) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones)
ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones)
require.Len(t, router, 1) assert.Equal(t, s.conf.GatewayIP, router[0]) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) assert.Equal(t, []byte("012"), resp.Options.Get(dhcpv4.OptionFQDN)) rai := resp.RelayAgentInfo() require.NotNil(t, rai)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
t.Run("ack", func(t *testing.T) { assert.Equal(t, dhcpv4.MessageTypeAck, resp.MessageType()) assert.Equal(t, mac, resp.ClientHWAddr) assert.True(t, s.conf.RangeStart.Equal(resp.YourIPAddr)) router := resp.Router() require.Len(t, router, 1) assert.Equal(t, s.conf.GatewayIP, router[0])
</s> remove assert.Equal(t, s.conf.RangeStart, resp.YourIPAddr) assert.Equal(t, s.conf.GatewayIP, resp.ServerIdentifier()) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones)
assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice()))
t.Run("ack", func(t *testing.T) { assert.Equal(t, dhcpv4.MessageTypeAck, resp.MessageType()) assert.Equal(t, mac, resp.ClientHWAddr) assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) router := resp.Router() require.Len(t, router, 1) assert.Equal(t, s.conf.GatewayIP, router[0])
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
router := resp.Router() require.Len(t, router, 1) assert.Equal(t, s.conf.GatewayIP, router[0]) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) })
</s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.Equal(t, s.conf.RangeStart, resp.YourIPAddr) assert.Equal(t, s.conf.GatewayIP, resp.ServerIdentifier()) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.True(t, s.conf.RangeStart.Equal(resp.YourIPAddr)) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice()))
assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice()))
router := resp.Router() require.Len(t, router, 1) assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) })
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
require.Len(t, router, 1) assert.Equal(t, s.conf.GatewayIP, router[0]) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) }) dnsAddrs := resp.DNS() require.Len(t, dnsAddrs, 1)
</s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.Equal(t, s.conf.GatewayIP, router[0]) </s> add assert.True(t, router[0].Equal(s.conf.GatewayIP.AsSlice())) </s> remove assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0])) assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier())) assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add assert.True(t, resp.Router()[0].Equal(s.conf.GatewayIP.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice())) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask()) </s> add ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) </s> remove assert.Equal(t, s.conf.RangeStart, resp.YourIPAddr) assert.Equal(t, s.conf.GatewayIP, resp.ServerIdentifier()) </s> add assert.True(t, resp.YourIPAddr.Equal(s.conf.RangeStart.AsSlice())) assert.True(t, resp.ServerIdentifier().Equal(s.conf.GatewayIP.AsSlice()))
ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones)
require.Len(t, router, 1) assert.Equal(t, s.conf.GatewayIP, router[0]) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) ones, _ := resp.SubnetMask().Size() assert.Equal(t, s.conf.subnet.Bits(), ones) assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds()) }) dnsAddrs := resp.DNS() require.Len(t, dnsAddrs, 1)
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dhcpd/v4_unix_test.go
// accessCtx controls IP and client blocking that takes place before all other // processing. An accessCtx is safe for concurrent use. type accessCtx struct { allowedIPs *netutil.IPMap blockedIPs *netutil.IPMap allowedClientIDs *stringutil.Set
</s> remove IP net.IP `json:"ip"` Port int `json:"port"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"`
// TODO(e.burkov): Use map[netip.Addr]struct{} instead.
// accessCtx controls IP and client blocking that takes place before all other // processing. An accessCtx is safe for concurrent use. type accessCtx struct { // TODO(e.burkov): Use map[netip.Addr]struct{} instead. allowedIPs *netutil.IPMap blockedIPs *netutil.IPMap allowedClientIDs *stringutil.Set
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dnsforward/access.go
tableHostToIP hostToIPTable tableHostToIPLock sync.Mutex tableIPToHost *netutil.IPMap tableIPToHostLock sync.Mutex // clientIDCache is a temporary storage for ClientIDs that were extracted
</s> remove if !s.conf.subnet.Contains(reqIP) { </s> add if !s.conf.subnet.Contains(netip.AddrFrom4(*(*[4]byte)(ip4))) {
// TODO(e.burkov): Use map[netip.Addr]struct{} instead.
tableHostToIP hostToIPTable tableHostToIPLock sync.Mutex // TODO(e.burkov): Use map[netip.Addr]struct{} instead. tableIPToHost *netutil.IPMap tableIPToHostLock sync.Mutex // clientIDCache is a temporary storage for ClientIDs that were extracted
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/dnsforward/dnsforward.go
// ipToRC is the IP address to *RuntimeClient map. ipToRC *netutil.IPMap lock sync.Mutex
</s> remove broadcastIP net.IP </s> add broadcastIP netip.Addr
// // TODO(e.burkov): Use map[netip.Addr]struct{} instead.
// ipToRC is the IP address to *RuntimeClient map. // // TODO(e.burkov): Use map[netip.Addr]struct{} instead. ipToRC *netutil.IPMap lock sync.Mutex
[ "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/clients.go
import ( "net" "os" "runtime" "testing" "time" "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
</s> remove "net" </s> add </s> remove "net" </s> add </s> remove "net" </s> add "net/netip"
"net/netip"
import ( "net" "net/netip" "os" "runtime" "testing" "time" "github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/clients_test.go
Enabled: true, DBFilePath: "leases.db", Conf4: dhcpd.V4ServerConf{ Enabled: true, GatewayIP: net.IP{1, 2, 3, 1}, SubnetMask: net.IP{255, 255, 255, 0}, RangeStart: net.IP{1, 2, 3, 2}, RangeEnd: net.IP{1, 2, 3, 10}, }, } dhcpServer, err := dhcpd.Create(config) require.NoError(t, err)
</s> remove RangeStart: net.IP{192, 168, 10, 100}, RangeEnd: net.IP{192, 168, 10, 200}, GatewayIP: net.IP{192, 168, 10, 1}, SubnetMask: net.IP{255, 255, 255, 0}, </s> add RangeStart: netip.MustParseAddr("192.168.10.100"), RangeEnd: netip.MustParseAddr("192.168.10.200"), GatewayIP: netip.MustParseAddr("192.168.10.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), </s> remove RangeStart: net.IP{192, 168, 10, 20}, RangeEnd: net.IP{192, 168, 10, 200}, </s> add RangeStart: netip.MustParseAddr("192.168.10.20"), RangeEnd: netip.MustParseAddr("192.168.10.200"), </s> remove opts: options{bindHost: net.IP{1, 2, 3, 4}}, </s> add </s> remove want net.IP </s> add want netip.Addr name string </s> remove name: "success_v4", </s> add
GatewayIP: netip.MustParseAddr("1.2.3.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("1.2.3.2"), RangeEnd: netip.MustParseAddr("1.2.3.10"),
Enabled: true, DBFilePath: "leases.db", Conf4: dhcpd.V4ServerConf{ Enabled: true, GatewayIP: netip.MustParseAddr("1.2.3.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("1.2.3.2"), RangeEnd: netip.MustParseAddr("1.2.3.10"), GatewayIP: netip.MustParseAddr("1.2.3.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("1.2.3.2"), RangeEnd: netip.MustParseAddr("1.2.3.10"), GatewayIP: netip.MustParseAddr("1.2.3.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("1.2.3.2"), RangeEnd: netip.MustParseAddr("1.2.3.10"), GatewayIP: netip.MustParseAddr("1.2.3.1"), SubnetMask: netip.MustParseAddr("255.255.255.0"), RangeStart: netip.MustParseAddr("1.2.3.2"), RangeEnd: netip.MustParseAddr("1.2.3.10"), }, } dhcpServer, err := dhcpd.Create(config) require.NoError(t, err)
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/clients_test.go
import ( "bytes" "fmt" "net" "os" "path/filepath" "sync" "github.com/AdguardTeam/AdGuardHome/internal/aghalg"
</s> remove "net" </s> add "net/netip" </s> remove "net" </s> add "net/netip" </s> remove "net" </s> add
"net/netip"
import ( "bytes" "fmt" "net/netip" "os" "path/filepath" "sync" "github.com/AdguardTeam/AdGuardHome/internal/aghalg"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/config.go
// Raw file data to avoid re-reading of configuration file // It's reset after config is parsed fileData []byte BindHost net.IP `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to BindPort int `yaml:"bind_port"` // BindPort is the port the HTTP server BetaBindPort int `yaml:"beta_bind_port"` // BetaBindPort is the port for new client Users []webUser `yaml:"users"` // Users that can access HTTP server // AuthAttempts is the maximum number of failed login attempts a user // can do before being blocked. AuthAttempts uint `yaml:"auth_attempts"` // AuthBlockMin is the duration, in minutes, of the block of new login // attempts after AuthAttempts unsuccessful login attempts.
</s> remove AuthBlockMin uint `yaml:"block_auth_min"` ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client Language string `yaml:"language"` // two-letter ISO 639-1 language code DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 </s> add AuthBlockMin uint `yaml:"block_auth_min"` // ProxyURL is the address of proxy server for the internal HTTP client. ProxyURL string `yaml:"http_proxy"` // Language is a two-letter ISO 639-1 language code. Language string `yaml:"language"` // DebugPProf defines if the profiling HTTP handler will listen on :6060. DebugPProf bool `yaml:"debug_pprof"` </s> remove bindHost net.IP </s> add bindHost netip.Addr </s> remove BindHost net.IP </s> add BindHost netip.Addr </s> remove subnet *net.IPNet </s> add subnet netip.Prefix </s> remove dnsIPAddrs []net.IP // IPv4 addresses to return to DHCP clients as DNS server addresses </s> add dnsIPAddrs []netip.Addr // IPv4 addresses to return to DHCP clients as DNS server addresses
// BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` // BetaBindPort is the port for the new client's web interface server to // listen on. BetaBindPort int `yaml:"beta_bind_port"` // Users are the clients capable for accessing the web interface. Users []webUser `yaml:"users"`
// Raw file data to avoid re-reading of configuration file // It's reset after config is parsed fileData []byte // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` // BetaBindPort is the port for the new client's web interface server to // listen on. BetaBindPort int `yaml:"beta_bind_port"` // Users are the clients capable for accessing the web interface. Users []webUser `yaml:"users"` // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` // BetaBindPort is the port for the new client's web interface server to // listen on. BetaBindPort int `yaml:"beta_bind_port"` // Users are the clients capable for accessing the web interface. Users []webUser `yaml:"users"` // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` // BetaBindPort is the port for the new client's web interface server to // listen on. BetaBindPort int `yaml:"beta_bind_port"` // Users are the clients capable for accessing the web interface. Users []webUser `yaml:"users"` // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` // BetaBindPort is the port for the new client's web interface server to // listen on. BetaBindPort int `yaml:"beta_bind_port"` // Users are the clients capable for accessing the web interface. Users []webUser `yaml:"users"` // AuthAttempts is the maximum number of failed login attempts a user // can do before being blocked. AuthAttempts uint `yaml:"auth_attempts"` // AuthBlockMin is the duration, in minutes, of the block of new login // attempts after AuthAttempts unsuccessful login attempts.
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/config.go
// can do before being blocked. AuthAttempts uint `yaml:"auth_attempts"` // AuthBlockMin is the duration, in minutes, of the block of new login // attempts after AuthAttempts unsuccessful login attempts. AuthBlockMin uint `yaml:"block_auth_min"` ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client Language string `yaml:"language"` // two-letter ISO 639-1 language code DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 // TTL for a web session (in hours) // An active session is automatically refreshed once a day. WebSessionTTLHours uint32 `yaml:"web_session_ttl"`
</s> remove BindHost net.IP `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to BindPort int `yaml:"bind_port"` // BindPort is the port the HTTP server BetaBindPort int `yaml:"beta_bind_port"` // BetaBindPort is the port for new client Users []webUser `yaml:"users"` // Users that can access HTTP server </s> add // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` // BetaBindPort is the port for the new client's web interface server to // listen on. BetaBindPort int `yaml:"beta_bind_port"` // Users are the clients capable for accessing the web interface. Users []webUser `yaml:"users"` </s> remove bindHost net.IP </s> add bindHost netip.Addr </s> remove QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file </s> add // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` </s> remove QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats </s> add QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // AnonymizeClientIP defines if clients' IP addresses should be anonymized // in query log and statistics. AnonymizeClientIP bool `yaml:"anonymize_client_ip"` </s> remove // time interval for statistics (in days) </s> add // StatsInterval is the time interval for flushing statistics to the disk in // days.
AuthBlockMin uint `yaml:"block_auth_min"` // ProxyURL is the address of proxy server for the internal HTTP client. ProxyURL string `yaml:"http_proxy"` // Language is a two-letter ISO 639-1 language code. Language string `yaml:"language"` // DebugPProf defines if the profiling HTTP handler will listen on :6060. DebugPProf bool `yaml:"debug_pprof"`
// can do before being blocked. AuthAttempts uint `yaml:"auth_attempts"` // AuthBlockMin is the duration, in minutes, of the block of new login // attempts after AuthAttempts unsuccessful login attempts. AuthBlockMin uint `yaml:"block_auth_min"` // ProxyURL is the address of proxy server for the internal HTTP client. ProxyURL string `yaml:"http_proxy"` // Language is a two-letter ISO 639-1 language code. Language string `yaml:"language"` // DebugPProf defines if the profiling HTTP handler will listen on :6060. DebugPProf bool `yaml:"debug_pprof"` AuthBlockMin uint `yaml:"block_auth_min"` // ProxyURL is the address of proxy server for the internal HTTP client. ProxyURL string `yaml:"http_proxy"` // Language is a two-letter ISO 639-1 language code. Language string `yaml:"language"` // DebugPProf defines if the profiling HTTP handler will listen on :6060. DebugPProf bool `yaml:"debug_pprof"` AuthBlockMin uint `yaml:"block_auth_min"` // ProxyURL is the address of proxy server for the internal HTTP client. ProxyURL string `yaml:"http_proxy"` // Language is a two-letter ISO 639-1 language code. Language string `yaml:"language"` // DebugPProf defines if the profiling HTTP handler will listen on :6060. DebugPProf bool `yaml:"debug_pprof"` AuthBlockMin uint `yaml:"block_auth_min"` // ProxyURL is the address of proxy server for the internal HTTP client. ProxyURL string `yaml:"http_proxy"` // Language is a two-letter ISO 639-1 language code. Language string `yaml:"language"` // DebugPProf defines if the profiling HTTP handler will listen on :6060. DebugPProf bool `yaml:"debug_pprof"` // TTL for a web session (in hours) // An active session is automatically refreshed once a day. WebSessionTTLHours uint32 `yaml:"web_session_ttl"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/config.go
// cloned from the filtering module back here. // // TODO(e.burkov): Move all the filtering configuration fields into the // only configuration subsection covering the changes with a single // migration. Filters []filtering.FilterYAML `yaml:"filters"` WhitelistFilters []filtering.FilterYAML `yaml:"whitelist_filters"` UserRules []string `yaml:"user_rules"` DHCP *dhcpd.ServerConfig `yaml:"dhcp"`
</s> remove "github.com/AdguardTeam/golibs/netutil" </s> add </s> remove config.DNS.BindHosts = []net.IP{req.DNS.IP} </s> add config.DNS.BindHosts = []netip.Addr{req.DNS.IP} </s> remove defaultIP := net.IP{192, 168, 1, 1} </s> add defaultIP := netip.MustParseAddr("192.168.1.1") </s> remove return aghnet.CheckPort("tcp", req.Web.IP, portInt) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> remove dnsIPAddrs []net.IP // IPv4 addresses to return to DHCP clients as DNS server addresses </s> add dnsIPAddrs []netip.Addr // IPv4 addresses to return to DHCP clients as DNS server addresses
// migration. Also keep the blocked services in mind.
// cloned from the filtering module back here. // // TODO(e.burkov): Move all the filtering configuration fields into the // only configuration subsection covering the changes with a single // migration. Also keep the blocked services in mind. Filters []filtering.FilterYAML `yaml:"filters"` WhitelistFilters []filtering.FilterYAML `yaml:"whitelist_filters"` UserRules []string `yaml:"user_rules"` DHCP *dhcpd.ServerConfig `yaml:"dhcp"`
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/config.go
} // field ordering is important -- yaml fields will mirror ordering from here type dnsConfig struct { BindHosts []net.IP `yaml:"bind_hosts"` Port int `yaml:"port"` // time interval for statistics (in days) StatsInterval uint32 `yaml:"statistics_interval"` QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled
</s> remove // time interval for statistics (in days) </s> add // StatsInterval is the time interval for flushing statistics to the disk in // days. </s> remove QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file </s> add // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` </s> remove QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats </s> add QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // AnonymizeClientIP defines if clients' IP addresses should be anonymized // in query log and statistics. AnonymizeClientIP bool `yaml:"anonymize_client_ip"` </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"`
BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"`
} // field ordering is important -- yaml fields will mirror ordering from here type dnsConfig struct { BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"` BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"` // time interval for statistics (in days) StatsInterval uint32 `yaml:"statistics_interval"` QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/config.go
type dnsConfig struct { BindHosts []net.IP `yaml:"bind_hosts"` Port int `yaml:"port"` // time interval for statistics (in days) StatsInterval uint32 `yaml:"statistics_interval"` QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file // QueryLogInterval is the interval for query log's files rotation.
</s> remove QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file </s> add // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` </s> remove BindHosts []net.IP `yaml:"bind_hosts"` Port int `yaml:"port"` </s> add BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"` </s> remove QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats </s> add QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // AnonymizeClientIP defines if clients' IP addresses should be anonymized // in query log and statistics. AnonymizeClientIP bool `yaml:"anonymize_client_ip"` </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> remove IP net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"`
// StatsInterval is the time interval for flushing statistics to the disk in // days.
type dnsConfig struct { BindHosts []net.IP `yaml:"bind_hosts"` Port int `yaml:"port"` // StatsInterval is the time interval for flushing statistics to the disk in // days. StatsInterval uint32 `yaml:"statistics_interval"` QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file // QueryLogInterval is the interval for query log's files rotation.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/config.go
// time interval for statistics (in days) StatsInterval uint32 `yaml:"statistics_interval"` QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
</s> remove QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats </s> add QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // AnonymizeClientIP defines if clients' IP addresses should be anonymized // in query log and statistics. AnonymizeClientIP bool `yaml:"anonymize_client_ip"` </s> remove // time interval for statistics (in days) </s> add // StatsInterval is the time interval for flushing statistics to the disk in // days. </s> remove BindHosts []net.IP `yaml:"bind_hosts"` Port int `yaml:"port"` </s> add BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"` </s> remove AuthBlockMin uint `yaml:"block_auth_min"` ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client Language string `yaml:"language"` // two-letter ISO 639-1 language code DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 </s> add AuthBlockMin uint `yaml:"block_auth_min"` // ProxyURL is the address of proxy server for the internal HTTP client. ProxyURL string `yaml:"http_proxy"` // Language is a two-letter ISO 639-1 language code. Language string `yaml:"language"` // DebugPProf defines if the profiling HTTP handler will listen on :6060. DebugPProf bool `yaml:"debug_pprof"` </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"`
// QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"`
// time interval for statistics (in days) StatsInterval uint32 `yaml:"statistics_interval"` // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/config.go
QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // number of entries kept in memory before they are flushed to disk AnonymizeClientIP bool `yaml:"anonymize_client_ip"` // anonymize clients' IP addresses in logs and stats dnsforward.FilteringConfig `yaml:",inline"` DnsfilterConf *filtering.Config `yaml:",inline"`
</s> remove QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file </s> add // QueryLogEnabled defines if the query log is enabled. QueryLogEnabled bool `yaml:"querylog_enabled"` // QueryLogFileEnabled defines, if the query log is written to the file. QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` </s> remove // time interval for statistics (in days) </s> add // StatsInterval is the time interval for flushing statistics to the disk in // days. </s> remove BindHosts []net.IP `yaml:"bind_hosts"` Port int `yaml:"port"` </s> add BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"` </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> remove AuthBlockMin uint `yaml:"block_auth_min"` ProxyURL string `yaml:"http_proxy"` // Proxy address for our HTTP client Language string `yaml:"language"` // two-letter ISO 639-1 language code DebugPProf bool `yaml:"debug_pprof"` // Enable pprof HTTP server on port 6060 </s> add AuthBlockMin uint `yaml:"block_auth_min"` // ProxyURL is the address of proxy server for the internal HTTP client. ProxyURL string `yaml:"http_proxy"` // Language is a two-letter ISO 639-1 language code. Language string `yaml:"language"` // DebugPProf defines if the profiling HTTP handler will listen on :6060. DebugPProf bool `yaml:"debug_pprof"`
QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // AnonymizeClientIP defines if clients' IP addresses should be anonymized // in query log and statistics. AnonymizeClientIP bool `yaml:"anonymize_client_ip"`
QueryLogEnabled bool `yaml:"querylog_enabled"` // if true, query log is enabled QueryLogFileEnabled bool `yaml:"querylog_file_enabled"` // if true, query log will be written to a file // QueryLogInterval is the interval for query log's files rotation. QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // AnonymizeClientIP defines if clients' IP addresses should be anonymized // in query log and statistics. AnonymizeClientIP bool `yaml:"anonymize_client_ip"` QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // AnonymizeClientIP defines if clients' IP addresses should be anonymized // in query log and statistics. AnonymizeClientIP bool `yaml:"anonymize_client_ip"` QueryLogInterval timeutil.Duration `yaml:"querylog_interval"` // QueryLogMemSize is the number of entries kept in memory before they are // flushed to disk. QueryLogMemSize uint32 `yaml:"querylog_size_memory"` // AnonymizeClientIP defines if clients' IP addresses should be anonymized // in query log and statistics. AnonymizeClientIP bool `yaml:"anonymize_client_ip"` dnsforward.FilteringConfig `yaml:",inline"` DnsfilterConf *filtering.Config `yaml:",inline"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/config.go
// TODO(a.garipov, e.burkov): This global is awful and must be removed. var config = &configuration{ BindPort: 3000, BetaBindPort: 0, BindHost: net.IP{0, 0, 0, 0}, AuthAttempts: 5, AuthBlockMin: 15, WebSessionTTLHours: 30 * 24, DNS: dnsConfig{ BindHosts: []net.IP{{0, 0, 0, 0}},
</s> remove BindHosts: []net.IP{{0, 0, 0, 0}}, </s> add BindHosts: []netip.Addr{netip.IPv4Unspecified()}, </s> remove BindHosts: []net.IP{netutil.IPv4Zero()}, </s> add BindHosts: []netip.Addr{netip.IPv4Unspecified()}, </s> remove subnet: &net.IPNet{ IP: net.IP{192, 168, 1, 2}, }, want: net.IP{192, 168, 1, 255}, </s> add </s> remove subnet: &net.IPNet{ IP: net.IP{0, 0, 0, 0}, Mask: net.IPMask{0, 0, 0, 0}, }, want: net.IPv4bcast, </s> add }, { pref: netip.Prefix{}, want: netip.Addr{}, name: "invalid", </s> remove err := CheckPort("udp", net.IP{0, 0, 0, 0}, 0) </s> add err := CheckPort("udp", netip.AddrPortFrom(netip.IPv4Unspecified(), 0))
BindHost: netip.IPv4Unspecified(),
// TODO(a.garipov, e.burkov): This global is awful and must be removed. var config = &configuration{ BindPort: 3000, BetaBindPort: 0, BindHost: netip.IPv4Unspecified(), AuthAttempts: 5, AuthBlockMin: 15, WebSessionTTLHours: 30 * 24, DNS: dnsConfig{ BindHosts: []net.IP{{0, 0, 0, 0}},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/config.go
AuthAttempts: 5, AuthBlockMin: 15, WebSessionTTLHours: 30 * 24, DNS: dnsConfig{ BindHosts: []net.IP{{0, 0, 0, 0}}, Port: defaultPortDNS, StatsInterval: 1, QueryLogEnabled: true, QueryLogFileEnabled: true, QueryLogInterval: timeutil.Duration{Duration: 90 * timeutil.Day},
</s> remove BindHost: net.IP{0, 0, 0, 0}, </s> add BindHost: netip.IPv4Unspecified(), </s> remove BindHosts: []net.IP{netutil.IPv4Zero()}, </s> add BindHosts: []netip.Addr{netip.IPv4Unspecified()}, </s> remove subnet: &net.IPNet{ IP: net.IP{192, 168, 1, 2}, }, want: net.IP{192, 168, 1, 255}, </s> add </s> remove known6 := net.IP{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, } </s> add known4 := netip.MustParseAddr("192.168.0.1") fullBroadcast4 := netip.MustParseAddr("255.255.255.255") known6 := netip.MustParseAddr("102:304:506:708:90a:b0c:d0e:f10") </s> remove subnet: &net.IPNet{ IP: net.IP{0, 0, 0, 0}, Mask: net.IPMask{0, 0, 0, 0}, }, want: net.IPv4bcast, </s> add }, { pref: netip.Prefix{}, want: netip.Addr{}, name: "invalid",
BindHosts: []netip.Addr{netip.IPv4Unspecified()},
AuthAttempts: 5, AuthBlockMin: 15, WebSessionTTLHours: 30 * 24, DNS: dnsConfig{ BindHosts: []netip.Addr{netip.IPv4Unspecified()}, Port: defaultPortDNS, StatsInterval: 1, QueryLogEnabled: true, QueryLogFileEnabled: true, QueryLogInterval: timeutil.Duration{Duration: 90 * timeutil.Day},
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/config.go
package home import ( "fmt" "net" "net/http" "net/url" "runtime" "strings" "time"
</s> remove "net" </s> add "net/netip" </s> remove "net" </s> add "net/netip"
package home import ( "fmt" "net/http" "net/url" "runtime" "strings" "time"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/control.go
"fmt" "net/http" "net/url" "runtime" "strings" "time"
</s> remove "net" </s> add </s> remove "net" </s> add
"net/netip"
"fmt" "net/http" "net/netip" "net/url" "runtime" "strings" "time"
[ "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/control.go
) // appendDNSAddrs is a convenient helper for appending a formatted form of DNS // addresses to a slice of strings. func appendDNSAddrs(dst []string, addrs ...net.IP) (res []string) { for _, addr := range addrs { var hostport string if config.DNS.Port != defaultPortDNS { hostport = netutil.JoinHostPort(addr.String(), config.DNS.Port) } else {
</s> remove hostport = netutil.JoinHostPort(addr.String(), config.DNS.Port) </s> add hostport = netip.AddrPortFrom(addr, uint16(config.DNS.Port)).String() </s> remove func appendDNSAddrsWithIfaces(dst []string, src []net.IP) (res []string, err error) { </s> add func appendDNSAddrsWithIfaces(dst []string, src []netip.Addr) (res []string, err error) { </s> remove addrs = appendDNSAddrs(addrs, net.IP{127, 0, 0, 1}) </s> add addr := aghnet.IPv4Localhost() addrs = appendDNSAddrs(addrs, addr) </s> remove return nil, err </s> add return netip.Prefix{}, err
func appendDNSAddrs(dst []string, addrs ...netip.Addr) (res []string) {
) // appendDNSAddrs is a convenient helper for appending a formatted form of DNS // addresses to a slice of strings. func appendDNSAddrs(dst []string, addrs ...netip.Addr) (res []string) { for _, addr := range addrs { var hostport string if config.DNS.Port != defaultPortDNS { hostport = netutil.JoinHostPort(addr.String(), config.DNS.Port) } else {
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/control.go
func appendDNSAddrs(dst []string, addrs ...net.IP) (res []string) { for _, addr := range addrs { var hostport string if config.DNS.Port != defaultPortDNS { hostport = netutil.JoinHostPort(addr.String(), config.DNS.Port) } else { hostport = addr.String() } dst = append(dst, hostport)
</s> remove func appendDNSAddrs(dst []string, addrs ...net.IP) (res []string) { </s> add func appendDNSAddrs(dst []string, addrs ...netip.Addr) (res []string) { </s> remove func appendDNSAddrsWithIfaces(dst []string, src []net.IP) (res []string, err error) { </s> add func appendDNSAddrsWithIfaces(dst []string, src []netip.Addr) (res []string, err error) { </s> remove for _, iface := range ifaces { var addrs []net.Addr addrs, err = iface.Addrs() if err != nil { return nil, fmt.Errorf("failed to get addresses for interface %s: %w", iface.Name, err) </s> add // Collect network interface addresses. for _, addr := range addrs { n, ok := addr.(*net.IPNet) if !ok { // Should be *net.IPNet, this is weird. return nil, fmt.Errorf("expected %[2]s to be %[1]T, got %[2]T", n, addr) } else if ip4 := n.IP.To4(); ip4 != nil { n.IP = ip4 </s> remove return nil, err </s> add return netip.Prefix{}, err
hostport = netip.AddrPortFrom(addr, uint16(config.DNS.Port)).String()
func appendDNSAddrs(dst []string, addrs ...net.IP) (res []string) { for _, addr := range addrs { var hostport string if config.DNS.Port != defaultPortDNS { hostport = netip.AddrPortFrom(addr, uint16(config.DNS.Port)).String() } else { hostport = addr.String() } dst = append(dst, hostport)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/control.go
// appendDNSAddrsWithIfaces formats and appends all DNS addresses from src to // dst. It also adds the IP addresses of all network interfaces if src contains // an unspecified IP address. func appendDNSAddrsWithIfaces(dst []string, src []net.IP) (res []string, err error) { ifacesAdded := false for _, h := range src { if !h.IsUnspecified() { dst = appendDNSAddrs(dst, h)
</s> remove addrs = appendDNSAddrs(addrs, net.IP{127, 0, 0, 1}) </s> add addr := aghnet.IPv4Localhost() addrs = appendDNSAddrs(addrs, addr) </s> remove func appendDNSAddrs(dst []string, addrs ...net.IP) (res []string) { </s> add func appendDNSAddrs(dst []string, addrs ...netip.Addr) (res []string) { </s> remove hostport = netutil.JoinHostPort(addr.String(), config.DNS.Port) </s> add hostport = netip.AddrPortFrom(addr, uint16(config.DNS.Port)).String() </s> remove dnsIPAddrs []net.IP // IPv4 addresses to return to DHCP clients as DNS server addresses </s> add dnsIPAddrs []netip.Addr // IPv4 addresses to return to DHCP clients as DNS server addresses </s> remove subnet *net.IPNet </s> add subnet netip.Prefix
func appendDNSAddrsWithIfaces(dst []string, src []netip.Addr) (res []string, err error) {
// appendDNSAddrsWithIfaces formats and appends all DNS addresses from src to // dst. It also adds the IP addresses of all network interfaces if src contains // an unspecified IP address. func appendDNSAddrsWithIfaces(dst []string, src []netip.Addr) (res []string, err error) { ifacesAdded := false for _, h := range src { if !h.IsUnspecified() { dst = appendDNSAddrs(dst, h)
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/control.go
// collectDNSAddresses returns the list of DNS addresses the server is listening // on, including the addresses on all interfaces in cases of unspecified IPs. func collectDNSAddresses() (addrs []string, err error) { if hosts := config.DNS.BindHosts; len(hosts) == 0 { addrs = appendDNSAddrs(addrs, net.IP{127, 0, 0, 1}) } else { addrs, err = appendDNSAddrsWithIfaces(addrs, hosts) if err != nil { return nil, fmt.Errorf("collecting dns addresses: %w", err) }
</s> remove func appendDNSAddrsWithIfaces(dst []string, src []net.IP) (res []string, err error) { </s> add func appendDNSAddrsWithIfaces(dst []string, src []netip.Addr) (res []string, err error) { </s> remove return nil, fmt.Errorf("couldn't get interfaces: %w", err) } else if len(ifaces) == 0 { return nil, errors.Error("couldn't find any legible interface") </s> add return nil, fmt.Errorf("failed to get addresses for interface %s: %w", iface.Name, err) </s> remove // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and // WEB only we do not return link-local addresses here. // // TODO(e.burkov): Can't properly test the function since it's nontrivial to // substitute net.Interface.Addrs and the net.InterfaceAddrs can't be used. func GetValidNetInterfacesForWeb() (netIfaces []*NetInterface, err error) { ifaces, err := net.Interfaces() </s> add func NetInterfaceFrom(iface *net.Interface) (niface *NetInterface, err error) { niface = &NetInterface{ Name: iface.Name, HardwareAddr: iface.HardwareAddr, Flags: iface.Flags, MTU: iface.MTU, } addrs, err := iface.Addrs() </s> remove hosts = []net.IP{{127, 0, 0, 1}} </s> add hosts = []netip.Addr{aghnet.IPv4Localhost()} </s> remove // Discard interfaces with no addresses. if len(netIface.Addresses) != 0 { netIfaces = append(netIfaces, netIface) </s> add ones, _ := n.Mask.Size() p := netip.PrefixFrom(ip, ones) niface.Addresses = append(niface.Addresses, ip) niface.Subnets = append(niface.Subnets, p) } return niface, nil } // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and // WEB only we do not return link-local addresses here. // // TODO(e.burkov): Can't properly test the function since it's nontrivial to // substitute net.Interface.Addrs and the net.InterfaceAddrs can't be used. func GetValidNetInterfacesForWeb() (nifaces []*NetInterface, err error) { ifaces, err := net.Interfaces() if err != nil { return nil, fmt.Errorf("getting interfaces: %w", err) } else if len(ifaces) == 0 { return nil, errors.Error("no legible interfaces") } for i := range ifaces { var niface *NetInterface niface, err = NetInterfaceFrom(&ifaces[i]) if err != nil { return nil, err } else if len(niface.Addresses) != 0 { // Discard interfaces with no addresses. nifaces = append(nifaces, niface)
addr := aghnet.IPv4Localhost() addrs = appendDNSAddrs(addrs, addr)
// collectDNSAddresses returns the list of DNS addresses the server is listening // on, including the addresses on all interfaces in cases of unspecified IPs. func collectDNSAddresses() (addrs []string, err error) { if hosts := config.DNS.BindHosts; len(hosts) == 0 { addr := aghnet.IPv4Localhost() addrs = appendDNSAddrs(addrs, addr) } else { addrs, err = appendDNSAddrsWithIfaces(addrs, hosts) if err != nil { return nil, fmt.Errorf("collecting dns addresses: %w", err) }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/control.go
"context" "encoding/json" "fmt" "io" "net" "net/http" "os" "os/exec" "path/filepath" "runtime"
</s> remove "net" </s> add "net/netip"
"context" "encoding/json" "fmt" "io" "net/http" "os" "os/exec" "path/filepath" "runtime"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
"encoding/json" "fmt" "io" "net/http" "os" "os/exec" "path/filepath" "runtime"
</s> remove "net" </s> add
"net/netip"
"encoding/json" "fmt" "io" "net/http" "net/netip" "os" "os/exec" "path/filepath" "runtime"
[ "keep", "keep", "keep", "add", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
_ = aghhttp.WriteJSONResponse(w, r, data) } type checkConfReqEnt struct { IP net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` } type checkConfReq struct { Web checkConfReqEnt `json:"web"` DNS checkConfReqEnt `json:"dns"`
</s> remove IP net.IP `json:"ip"` Port int `json:"port"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"` </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` </s> remove BindHosts []net.IP `yaml:"bind_hosts"` Port int `yaml:"port"` </s> add BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"` </s> remove BindHost net.IP </s> add BindHost netip.Addr
IP netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"`
_ = aghhttp.WriteJSONResponse(w, r, data) } type checkConfReqEnt struct { IP netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` IP netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` IP netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` } type checkConfReq struct { Web checkConfReqEnt `json:"web"` DNS checkConfReqEnt `json:"dns"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
// Go on and check the port binding only if it's not zero or won't be // unbound after install. } return aghnet.CheckPort("tcp", req.Web.IP, portInt) } // validateDNS returns error if the DNS part of the initial configuration can't // be set. canAutofix is true if the port can be unbound by AdGuard Home // automatically.
</s> remove err := aghnet.CheckPort("tcp", net.IP{127, 0, 0, 1}, defaultPortDNS) </s> add err := aghnet.CheckPort("tcp", netip.AddrPortFrom(aghnet.IPv4Localhost(), defaultPortDNS)) </s> remove bindHost net.IP </s> add bindHost netip.Addr </s> remove return nil </s> add return p </s> remove // GetSubnet returns pointer to net.IPNet for the specified interface or nil if </s> add // GetSubnet returns the subnet corresponding to the interface of zero prefix if </s> remove BindHost net.IP `yaml:"bind_host"` // BindHost is the IP address of the HTTP server to bind to BindPort int `yaml:"bind_port"` // BindPort is the port the HTTP server BetaBindPort int `yaml:"beta_bind_port"` // BetaBindPort is the port for new client Users []webUser `yaml:"users"` // Users that can access HTTP server </s> add // BindHost is the address for the web interface server to listen on. BindHost netip.Addr `yaml:"bind_host"` // BindPort is the port for the web interface server to listen on. BindPort int `yaml:"bind_port"` // BetaBindPort is the port for the new client's web interface server to // listen on. BetaBindPort int `yaml:"beta_bind_port"` // Users are the clients capable for accessing the web interface. Users []webUser `yaml:"users"`
return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt)))
// Go on and check the port binding only if it's not zero or won't be // unbound after install. } return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) } // validateDNS returns error if the DNS part of the initial configuration can't // be set. canAutofix is true if the port can be unbound by AdGuard Home // automatically.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
if err = tcpPorts.Validate(); err != nil { return false, err } err = aghnet.CheckPort("tcp", req.DNS.IP, port) if err != nil { return false, err } }
</s> remove err = aghnet.CheckPort("udp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove err = aghnet.CheckPort("tcp", req.Web.IP, req.Web.Port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port))) </s> remove restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port </s> add restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, req.DNS.Port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port))) </s> remove err = aghnet.CheckPort("udp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port)))
err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(port)))
if err = tcpPorts.Validate(); err != nil { return false, err } err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) if err != nil { return false, err } }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
return false, err } } err = aghnet.CheckPort("udp", req.DNS.IP, port) if !aghnet.IsAddrInUse(err) { return false, err } // Try to fix automatically.
</s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove err = aghnet.CheckPort("udp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove err = aghnet.CheckPort("udp", req.DNS.IP, req.DNS.Port) </s> add err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port))) </s> remove dst := netutil.IPPort{ IP: BroadcastFromIPNet(subnet), Port: 67, }.String() </s> add dst := netip.AddrPortFrom(BroadcastFromPref(subnet), 67).String() </s> remove restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port </s> add restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port
err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port)))
return false, err } } err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) if !aghnet.IsAddrInUse(err) { return false, err } // Try to fix automatically.
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
if derr := disableDNSStubListener(); derr != nil { log.Error("disabling DNSStubListener: %s", err) } err = aghnet.CheckPort("udp", req.DNS.IP, port) canAutofix = false } return canAutofix, err }
</s> remove err = aghnet.CheckPort("udp", req.DNS.IP, req.DNS.Port) </s> add err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port))) </s> remove err = aghnet.CheckPort("udp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, req.DNS.Port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port))) </s> remove v4conf.Enabled = s.conf.Enabled && len(v4conf.RangeStart) != 0 </s> add v4conf.Enabled = s.conf.Enabled && v4conf.RangeStart.IsValid()
err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port)))
if derr := disableDNSStubListener(); derr != nil { log.Error("disabling DNSStubListener: %s", err) } err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) canAutofix = false } return canAutofix, err }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
// handleStaticIP - handles static IP request // It either checks if we have a static IP // Or if set=true, it tries to set it func handleStaticIP(ip net.IP, set bool) staticIPJSON { resp := staticIPJSON{} interfaceName := aghnet.InterfaceByIP(ip) resp.Static = "no"
</s> remove func dhcpcdConfIface(ifaceName string, ipNet *net.IPNet, gwIP net.IP) (conf string) { </s> add func dhcpcdConfIface(ifaceName string, subnet netip.Prefix, gateway netip.Addr) (conf string) { </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` </s> remove func appendDNSAddrsWithIfaces(dst []string, src []net.IP) (res []string, err error) { </s> add func appendDNSAddrsWithIfaces(dst []string, src []netip.Addr) (res []string, err error) { </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"`
func handleStaticIP(ip netip.Addr, set bool) staticIPJSON {
// handleStaticIP - handles static IP request // It either checks if we have a static IP // Or if set=true, it tries to set it func handleStaticIP(ip netip.Addr, set bool) staticIPJSON { resp := staticIPJSON{} interfaceName := aghnet.InterfaceByIP(ip) resp.Static = "no"
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
return nil } type applyConfigReqEnt struct { IP net.IP `json:"ip"` Port int `json:"port"` } type applyConfigReq struct { Username string `json:"username"` Password string `json:"password"`
</s> remove IP net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> remove Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP net.IP `json:"gateway_ip"` Addrs4 []net.IP `json:"ipv4_addresses"` Addrs6 []net.IP `json:"ipv6_addresses"` </s> add Name string `json:"name"` HardwareAddr string `json:"hardware_address"` Flags string `json:"flags"` GatewayIP netip.Addr `json:"gateway_ip"` Addrs4 []netip.Addr `json:"ipv4_addresses"` Addrs6 []netip.Addr `json:"ipv6_addresses"` </s> remove BindHost net.IP </s> add BindHost netip.Addr
IP netip.Addr `json:"ip"` Port int `json:"port"`
return nil } type applyConfigReqEnt struct { IP netip.Addr `json:"ip"` Port int `json:"port"` IP netip.Addr `json:"ip"` Port int `json:"port"` } type applyConfigReq struct { Username string `json:"username"` Password string `json:"password"`
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
return } err = aghnet.CheckPort("udp", req.DNS.IP, req.DNS.Port) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) return }
</s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, req.DNS.Port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port))) </s> remove err = aghnet.CheckPort("udp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove err = aghnet.CheckPort("udp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove return nil </s> add return netip.Addr{}
err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port)))
return } err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port))) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) return }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
return } err = aghnet.CheckPort("tcp", req.DNS.IP, req.DNS.Port) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) return }
</s> remove err = aghnet.CheckPort("udp", req.DNS.IP, req.DNS.Port) </s> add err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port))) </s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove err = aghnet.CheckPort("udp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("udp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove err = aghnet.CheckPort("tcp", req.Web.IP, req.Web.Port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port))) </s> remove restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port </s> add restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port
err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port)))
return } err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port))) if err != nil { aghhttp.Error(r, w, http.StatusBadRequest, "%s", err) return }
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
Context.firstRun = false config.BindHost = req.Web.IP config.BindPort = req.Web.Port config.DNS.BindHosts = []net.IP{req.DNS.IP} config.DNS.Port = req.DNS.Port // TODO(e.burkov): StartMods() should be put in a separate goroutine at the // moment we'll allow setting up TLS in the initial configuration or the // configuration itself will use HTTPS protocol, because the underlying
</s> remove restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port </s> add restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> remove // migration. </s> add // migration. Also keep the blocked services in mind. </s> remove return aghnet.CheckPort("tcp", req.Web.IP, portInt) </s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) </s> remove IP []net.IP `json:"ip"` Port int `json:"port"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` </s> remove DefaultRangeStart = net.IP{192, 168, 10, 100} DefaultRangeEnd = net.IP{192, 168, 10, 200} DefaultGatewayIP = net.IP{192, 168, 10, 1} DefaultSelfIP = net.IP{192, 168, 10, 2} DefaultSubnetMask = net.IP{255, 255, 255, 0} </s> add DefaultRangeStart = netip.MustParseAddr("192.168.10.100") DefaultRangeEnd = netip.MustParseAddr("192.168.10.200") DefaultGatewayIP = netip.MustParseAddr("192.168.10.1") DefaultSelfIP = netip.MustParseAddr("192.168.10.2") DefaultSubnetMask = netip.MustParseAddr("255.255.255.0")
config.DNS.BindHosts = []netip.Addr{req.DNS.IP}
Context.firstRun = false config.BindHost = req.Web.IP config.BindPort = req.Web.Port config.DNS.BindHosts = []netip.Addr{req.DNS.IP} config.DNS.Port = req.DNS.Port // TODO(e.burkov): StartMods() should be put in a separate goroutine at the // moment we'll allow setting up TLS in the initial configuration or the // configuration itself will use HTTPS protocol, because the underlying
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
if req.Web.Port == 0 || req.DNS.Port == 0 { return nil, false, errors.Error("ports cannot be 0") } restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port if restartHTTP { err = aghnet.CheckPort("tcp", req.Web.IP, req.Web.Port) if err != nil { return nil, false, fmt.Errorf( "checking address %s:%d: %w",
</s> remove err = aghnet.CheckPort("tcp", req.Web.IP, req.Web.Port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port))) </s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove return nil, fmt.Errorf("couldn't get interfaces: %w", err) } else if len(ifaces) == 0 { return nil, errors.Error("couldn't find any legible interface") </s> add return nil, fmt.Errorf("failed to get addresses for interface %s: %w", iface.Name, err) </s> remove v4conf.Enabled = s.conf.Enabled && len(v4conf.RangeStart) != 0 </s> add v4conf.Enabled = s.conf.Enabled && v4conf.RangeStart.IsValid() </s> remove // Discard interfaces with no addresses. if len(netIface.Addresses) != 0 { netIfaces = append(netIfaces, netIface) </s> add ones, _ := n.Mask.Size() p := netip.PrefixFrom(ip, ones) niface.Addresses = append(niface.Addresses, ip) niface.Subnets = append(niface.Subnets, p) } return niface, nil } // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and // WEB only we do not return link-local addresses here. // // TODO(e.burkov): Can't properly test the function since it's nontrivial to // substitute net.Interface.Addrs and the net.InterfaceAddrs can't be used. func GetValidNetInterfacesForWeb() (nifaces []*NetInterface, err error) { ifaces, err := net.Interfaces() if err != nil { return nil, fmt.Errorf("getting interfaces: %w", err) } else if len(ifaces) == 0 { return nil, errors.Error("no legible interfaces") } for i := range ifaces { var niface *NetInterface niface, err = NetInterfaceFrom(&ifaces[i]) if err != nil { return nil, err } else if len(niface.Addresses) != 0 { // Discard interfaces with no addresses. nifaces = append(nifaces, niface)
restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port
if req.Web.Port == 0 || req.DNS.Port == 0 { return nil, false, errors.Error("ports cannot be 0") } restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port if restartHTTP { err = aghnet.CheckPort("tcp", req.Web.IP, req.Web.Port) if err != nil { return nil, false, fmt.Errorf( "checking address %s:%d: %w",
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
} restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port if restartHTTP { err = aghnet.CheckPort("tcp", req.Web.IP, req.Web.Port) if err != nil { return nil, false, fmt.Errorf( "checking address %s:%d: %w", req.Web.IP.String(), req.Web.Port,
</s> remove restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port </s> add restartHTTP = config.BindHost != req.Web.IP || config.BindPort != req.Web.Port </s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(port))) </s> remove dst := netutil.IPPort{ IP: BroadcastFromIPNet(subnet), Port: 67, }.String() </s> add dst := netip.AddrPortFrom(BroadcastFromPref(subnet), 67).String() </s> remove err = aghnet.CheckPort("tcp", req.DNS.IP, req.DNS.Port) </s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.DNS.IP, uint16(req.DNS.Port))) </s> remove v4conf.Enabled = s.conf.Enabled && len(v4conf.RangeStart) != 0 </s> add v4conf.Enabled = s.conf.Enabled && v4conf.RangeStart.IsValid()
err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port)))
} restartHTTP = !config.BindHost.Equal(req.Web.IP) || config.BindPort != req.Web.Port if restartHTTP { err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(req.Web.Port))) if err != nil { return nil, false, fmt.Errorf( "checking address %s:%d: %w", req.Web.IP.String(), req.Web.Port,
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
// // TODO(e.burkov): This should removed with the API v1 when the appropriate // functionality will appear in default checkConfigReqEnt. type checkConfigReqEntBeta struct { IP []net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` } // checkConfigReqBeta is a struct representing new client's config check request // body. It uses checkConfigReqEntBeta instead of checkConfigReqEnt. //
</s> remove IP []net.IP `json:"ip"` Port int `json:"port"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` </s> remove IP net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> remove IP net.IP `json:"ip"` Port int `json:"port"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"` </s> remove // time interval for statistics (in days) </s> add // StatsInterval is the time interval for flushing statistics to the disk in // days. </s> remove BindHosts []net.IP `yaml:"bind_hosts"` Port int `yaml:"port"` </s> add BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"`
IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"`
// // TODO(e.burkov): This should removed with the API v1 when the appropriate // functionality will appear in default checkConfigReqEnt. type checkConfigReqEntBeta struct { IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` } // checkConfigReqBeta is a struct representing new client's config check request // body. It uses checkConfigReqEntBeta instead of checkConfigReqEnt. //
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
// // TODO(e.burkov): This should removed with the API v1 when the appropriate // functionality will appear in default applyConfigReqEnt. type applyConfigReqEntBeta struct { IP []net.IP `json:"ip"` Port int `json:"port"` } // applyConfigReqBeta is a struct representing new client's config setting // request body. It uses applyConfigReqEntBeta instead of applyConfigReqEnt. //
</s> remove IP []net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP []netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> remove IP net.IP `json:"ip"` Port int `json:"port"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"` </s> remove IP net.IP `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> add IP netip.Addr `json:"ip"` Port int `json:"port"` Autofix bool `json:"autofix"` </s> remove // time interval for statistics (in days) </s> add // StatsInterval is the time interval for flushing statistics to the disk in // days. </s> remove BindHosts []net.IP `yaml:"bind_hosts"` Port int `yaml:"port"` </s> add BindHosts []netip.Addr `yaml:"bind_hosts"` Port int `yaml:"port"`
IP []netip.Addr `json:"ip"` Port int `json:"port"`
// // TODO(e.burkov): This should removed with the API v1 when the appropriate // functionality will appear in default applyConfigReqEnt. type applyConfigReqEntBeta struct { IP []netip.Addr `json:"ip"` Port int `json:"port"` IP []netip.Addr `json:"ip"` Port int `json:"port"` } // applyConfigReqBeta is a struct representing new client's config setting // request body. It uses applyConfigReqEntBeta instead of applyConfigReqEnt. //
[ "keep", "keep", "keep", "keep", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/controlinstall.go
import ( "fmt" "net" "net/url" "os" "path/filepath" "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
</s> remove "net" </s> add "net/netip" </s> remove "net" </s> add </s> remove "net" </s> add "net/netip" </s> remove "net" </s> add "net/netip"
"net/netip"
import ( "fmt" "net" "net/netip" "net/url" "os" "path/filepath" "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
[ "keep", "keep", "add", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/dns.go
Context.whois.Begin(ip) } } func ipsToTCPAddrs(ips []net.IP, port int) (tcpAddrs []*net.TCPAddr) { if ips == nil { return nil } tcpAddrs = make([]*net.TCPAddr, len(ips))
</s> remove func ipsToUDPAddrs(ips []net.IP, port int) (udpAddrs []*net.UDPAddr) { </s> add func ipsToUDPAddrs(ips []netip.Addr, port int) (udpAddrs []*net.UDPAddr) { </s> remove tcpAddrs = make([]*net.TCPAddr, len(ips)) for i, ip := range ips { tcpAddrs[i] = &net.TCPAddr{ IP: ip, Port: port, } </s> add tcpAddrs = make([]*net.TCPAddr, 0, len(ips)) for _, ip := range ips { tcpAddrs = append(tcpAddrs, net.TCPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) </s> remove udpAddrs = make([]*net.UDPAddr, len(ips)) for i, ip := range ips { udpAddrs[i] = &net.UDPAddr{ IP: ip, Port: port, } </s> add udpAddrs = make([]*net.UDPAddr, 0, len(ips)) for _, ip := range ips { udpAddrs = append(udpAddrs, net.UDPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) </s> remove func newDNSCrypt(hosts []net.IP, tlsConf tlsConfigSettings) (dnscc dnsforward.DNSCryptConfig, err error) { </s> add func newDNSCrypt(hosts []netip.Addr, tlsConf tlsConfigSettings) (dnscc dnsforward.DNSCryptConfig, err error) { </s> remove return nil </s> add return p
func ipsToTCPAddrs(ips []netip.Addr, port int) (tcpAddrs []*net.TCPAddr) {
Context.whois.Begin(ip) } } func ipsToTCPAddrs(ips []netip.Addr, port int) (tcpAddrs []*net.TCPAddr) { if ips == nil { return nil } tcpAddrs = make([]*net.TCPAddr, len(ips))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/dns.go
if ips == nil { return nil } tcpAddrs = make([]*net.TCPAddr, len(ips)) for i, ip := range ips { tcpAddrs[i] = &net.TCPAddr{ IP: ip, Port: port, } } return tcpAddrs }
</s> remove udpAddrs = make([]*net.UDPAddr, len(ips)) for i, ip := range ips { udpAddrs[i] = &net.UDPAddr{ IP: ip, Port: port, } </s> add udpAddrs = make([]*net.UDPAddr, 0, len(ips)) for _, ip := range ips { udpAddrs = append(udpAddrs, net.UDPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) </s> remove func ipsToTCPAddrs(ips []net.IP, port int) (tcpAddrs []*net.TCPAddr) { </s> add func ipsToTCPAddrs(ips []netip.Addr, port int) (tcpAddrs []*net.TCPAddr) { </s> remove func ipsToUDPAddrs(ips []net.IP, port int) (udpAddrs []*net.UDPAddr) { </s> add func ipsToUDPAddrs(ips []netip.Addr, port int) (udpAddrs []*net.UDPAddr) { </s> remove s.conf.dnsIPAddrs = dnsIPAddrs </s> add for _, ip := range dnsIPAddrs { ip = ip.To4() if ip == nil { continue } s.conf.dnsIPAddrs = append(s.conf.dnsIPAddrs, netip.AddrFrom4(*(*[4]byte)(ip))) } </s> remove mask := n.Mask if mask == nil { mask = dc.DefaultMask() </s> add maskLen, addrLen := p.Bits(), bc.BitLen() if maskLen == addrLen { return bc
tcpAddrs = make([]*net.TCPAddr, 0, len(ips)) for _, ip := range ips { tcpAddrs = append(tcpAddrs, net.TCPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port))))
if ips == nil { return nil } tcpAddrs = make([]*net.TCPAddr, 0, len(ips)) for _, ip := range ips { tcpAddrs = append(tcpAddrs, net.TCPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) tcpAddrs = make([]*net.TCPAddr, 0, len(ips)) for _, ip := range ips { tcpAddrs = append(tcpAddrs, net.TCPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) tcpAddrs = make([]*net.TCPAddr, 0, len(ips)) for _, ip := range ips { tcpAddrs = append(tcpAddrs, net.TCPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) tcpAddrs = make([]*net.TCPAddr, 0, len(ips)) for _, ip := range ips { tcpAddrs = append(tcpAddrs, net.TCPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) tcpAddrs = make([]*net.TCPAddr, 0, len(ips)) for _, ip := range ips { tcpAddrs = append(tcpAddrs, net.TCPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) tcpAddrs = make([]*net.TCPAddr, 0, len(ips)) for _, ip := range ips { tcpAddrs = append(tcpAddrs, net.TCPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) } return tcpAddrs }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/dns.go
return tcpAddrs } func ipsToUDPAddrs(ips []net.IP, port int) (udpAddrs []*net.UDPAddr) { if ips == nil { return nil } udpAddrs = make([]*net.UDPAddr, len(ips))
</s> remove func ipsToTCPAddrs(ips []net.IP, port int) (tcpAddrs []*net.TCPAddr) { </s> add func ipsToTCPAddrs(ips []netip.Addr, port int) (tcpAddrs []*net.TCPAddr) { </s> remove udpAddrs = make([]*net.UDPAddr, len(ips)) for i, ip := range ips { udpAddrs[i] = &net.UDPAddr{ IP: ip, Port: port, } </s> add udpAddrs = make([]*net.UDPAddr, 0, len(ips)) for _, ip := range ips { udpAddrs = append(udpAddrs, net.UDPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) </s> remove tcpAddrs = make([]*net.TCPAddr, len(ips)) for i, ip := range ips { tcpAddrs[i] = &net.TCPAddr{ IP: ip, Port: port, } </s> add tcpAddrs = make([]*net.TCPAddr, 0, len(ips)) for _, ip := range ips { tcpAddrs = append(tcpAddrs, net.TCPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) </s> remove func newDNSCrypt(hosts []net.IP, tlsConf tlsConfigSettings) (dnscc dnsforward.DNSCryptConfig, err error) { </s> add func newDNSCrypt(hosts []netip.Addr, tlsConf tlsConfigSettings) (dnscc dnsforward.DNSCryptConfig, err error) { </s> remove return nil </s> add return p
func ipsToUDPAddrs(ips []netip.Addr, port int) (udpAddrs []*net.UDPAddr) {
return tcpAddrs } func ipsToUDPAddrs(ips []netip.Addr, port int) (udpAddrs []*net.UDPAddr) { if ips == nil { return nil } udpAddrs = make([]*net.UDPAddr, len(ips))
[ "keep", "keep", "keep", "keep", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/dns.go
if ips == nil { return nil } udpAddrs = make([]*net.UDPAddr, len(ips)) for i, ip := range ips { udpAddrs[i] = &net.UDPAddr{ IP: ip, Port: port, } } return udpAddrs }
</s> remove tcpAddrs = make([]*net.TCPAddr, len(ips)) for i, ip := range ips { tcpAddrs[i] = &net.TCPAddr{ IP: ip, Port: port, } </s> add tcpAddrs = make([]*net.TCPAddr, 0, len(ips)) for _, ip := range ips { tcpAddrs = append(tcpAddrs, net.TCPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) </s> remove func ipsToUDPAddrs(ips []net.IP, port int) (udpAddrs []*net.UDPAddr) { </s> add func ipsToUDPAddrs(ips []netip.Addr, port int) (udpAddrs []*net.UDPAddr) { </s> remove func ipsToTCPAddrs(ips []net.IP, port int) (tcpAddrs []*net.TCPAddr) { </s> add func ipsToTCPAddrs(ips []netip.Addr, port int) (tcpAddrs []*net.TCPAddr) { </s> remove s.conf.dnsIPAddrs = dnsIPAddrs </s> add for _, ip := range dnsIPAddrs { ip = ip.To4() if ip == nil { continue } s.conf.dnsIPAddrs = append(s.conf.dnsIPAddrs, netip.AddrFrom4(*(*[4]byte)(ip))) } </s> remove mask := n.Mask if mask == nil { mask = dc.DefaultMask() </s> add maskLen, addrLen := p.Bits(), bc.BitLen() if maskLen == addrLen { return bc
udpAddrs = make([]*net.UDPAddr, 0, len(ips)) for _, ip := range ips { udpAddrs = append(udpAddrs, net.UDPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port))))
if ips == nil { return nil } udpAddrs = make([]*net.UDPAddr, 0, len(ips)) for _, ip := range ips { udpAddrs = append(udpAddrs, net.UDPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) udpAddrs = make([]*net.UDPAddr, 0, len(ips)) for _, ip := range ips { udpAddrs = append(udpAddrs, net.UDPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) udpAddrs = make([]*net.UDPAddr, 0, len(ips)) for _, ip := range ips { udpAddrs = append(udpAddrs, net.UDPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) udpAddrs = make([]*net.UDPAddr, 0, len(ips)) for _, ip := range ips { udpAddrs = append(udpAddrs, net.UDPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) udpAddrs = make([]*net.UDPAddr, 0, len(ips)) for _, ip := range ips { udpAddrs = append(udpAddrs, net.UDPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) udpAddrs = make([]*net.UDPAddr, 0, len(ips)) for _, ip := range ips { udpAddrs = append(udpAddrs, net.UDPAddrFromAddrPort(netip.AddrPortFrom(ip, uint16(port)))) } return udpAddrs }
[ "keep", "keep", "keep", "keep", "replace", "replace", "replace", "replace", "replace", "replace", "keep", "keep", "keep", "keep", "keep" ]
Pull request: Migrate to netip.Addr vol.1 Merge in DNS/adguard-home from 2926-lla-v6 to master Updates #2926. Updates #5035. Squashed commit of the following: commit 2e770d4b6d4e1ec3f7762f2f2466662983bf146c Merge: 25c1afc5 893358ea Author: Eugene Burkov <[email protected]> Date: Fri Oct 14 15:14:56 2022 +0300 Merge branch 'master' into 2926-lla-v6 commit 25c1afc5f0a5027fafac9dee77618886aefee29c Author: Eugene Burkov <[email protected]> Date: Thu Oct 13 18:24:20 2022 +0300 all: imp code, docs commit 59549c4f74ee17b10eae542d1f1828d4e59894c9 Author: Eugene Burkov <[email protected]> Date: Tue Oct 11 18:49:09 2022 +0300 dhcpd: use netip initially commit 1af623096b0517d07752385540f2f750f7f5b3bb Author: Eugene Burkov <[email protected]> Date: Fri Sep 30 18:03:52 2022 +0300 all: imp docs, code commit e9faeb71dbc0e887b25a7f3d5b33a401805f2ae7 Author: Eugene Burkov <[email protected]> Date: Thu Sep 29 14:56:37 2022 +0300 all: use netip for web commit 38305e555a6884c3bd1b0839330b942ce0e59093 Author: Eugene Burkov <[email protected]> Date: Wed Sep 28 19:13:58 2022 +0300 add basic lla
https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a
internal/home/dns.go