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