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
|
---|---|---|---|---|
ip = a.IP
maskLen, _ = ip.DefaultMask().Size() | <mask>
<mask> for _, a := range addrs {
<mask> switch a := a.(type) {
<mask> case *net.IPAddr:
<mask> subnet = &net.IPNet{
<mask> IP: a.IP,
<mask> Mask: a.IP.DefaultMask(),
<mask> }
<mask> case *net.IPNet:
<mask> subnet = a
<mask> default:
<mask> continue
<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 subnet = a
</s> add ip = a.IP
maskLen, _ = a.Mask.Size() </s> remove return nil, err
</s> add return netip.Prefix{}, err </s> remove func appendDNSAddrs(dst []string, addrs ...net.IP) (res []string) {
</s> add func appendDNSAddrs(dst []string, addrs ...netip.Addr) (res []string) { </s> remove var subnet *net.IPNet
</s> add var subnet netip.Prefix | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/dhcp_unix.go |
ip = a.IP
maskLen, _ = a.Mask.Size() | <mask> IP: a.IP,
<mask> Mask: a.IP.DefaultMask(),
<mask> }
<mask> case *net.IPNet:
<mask> subnet = a
<mask> default:
<mask> continue
<mask> }
<mask>
<mask> if ip4 := subnet.IP.To4(); ip4 != nil {
</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: a.IP,
Mask: a.IP.DefaultMask(),
}
</s> add ip = a.IP
maskLen, _ = ip.DefaultMask().Size() </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 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 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/aghnet/dhcp_unix.go |
if ip = ip.To4(); ip != nil {
return netip.PrefixFrom(netip.AddrFrom4(*(*[4]byte)(ip)), maskLen), nil | <mask> default:
<mask> continue
<mask> }
<mask>
<mask> if ip4 := subnet.IP.To4(); ip4 != nil {
<mask> subnet.IP = ip4
<mask>
<mask> return subnet, nil
<mask> }
<mask> }
<mask>
<mask> return nil, fmt.Errorf("interface %s has no ipv4 addresses", iface.Name)
<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 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 subnet = a
</s> add ip = a.IP
maskLen, _ = a.Mask.Size() </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 ip4 := reqIP.To4(); ip4 == nil {
</s> add ip4 := reqIP.To4()
if ip4 == nil { </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 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/dhcp_unix.go |
return netip.Prefix{}, fmt.Errorf("interface %s has no ipv4 addresses", iface.Name) | <mask> return subnet, nil
<mask> }
<mask> }
<mask>
<mask> return nil, fmt.Errorf("interface %s has no ipv4 addresses", iface.Name)
<mask> }
<mask>
<mask> // checkOtherDHCPv4 sends a DHCP request to the specified network interface, and
<mask> // waits for a response for a period defined by defaultDiscoverTime.
<mask> func checkOtherDHCPv4(iface *net.Interface) (ok bool, err error) {
</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 subnet *net.IPNet
</s> add var subnet netip.Prefix </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 return nil, err
</s> add return netip.Prefix{}, err </s> remove if !s.conf.subnet.Contains(reqIP) {
</s> add if !s.conf.subnet.Contains(netip.AddrFrom4(*(*[4]byte)(ip4))) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/dhcp_unix.go |
var subnet netip.Prefix | <mask>
<mask> // checkOtherDHCPv4 sends a DHCP request to the specified network interface, and
<mask> // waits for a response for a period defined by defaultDiscoverTime.
<mask> func checkOtherDHCPv4(iface *net.Interface) (ok bool, err error) {
<mask> var subnet *net.IPNet
<mask> if subnet, err = ifaceIPv4Subnet(iface); err != nil {
<mask> return false, err
<mask> }
<mask>
<mask> // Resolve broadcast addr.
</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 return nil, err
</s> add return netip.Prefix{}, err </s> remove dst := netutil.IPPort{
IP: BroadcastFromIPNet(subnet),
Port: 67,
}.String()
</s> add dst := netip.AddrPortFrom(BroadcastFromPref(subnet), 67).String() </s> remove func ifaceIPv4Subnet(iface *net.Interface) (subnet *net.IPNet, err error) {
</s> add func ifaceIPv4Subnet(iface *net.Interface) (subnet netip.Prefix, err error) { </s> remove func GetSubnet(ifaceName string) *net.IPNet {
</s> add func GetSubnet(ifaceName string) (p netip.Prefix) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/dhcp_unix.go |
dst := netip.AddrPortFrom(BroadcastFromPref(subnet), 67).String() | <mask> return false, err
<mask> }
<mask>
<mask> // Resolve broadcast addr.
<mask> dst := netutil.IPPort{
<mask> IP: BroadcastFromIPNet(subnet),
<mask> Port: 67,
<mask> }.String()
<mask> var dstAddr *net.UDPAddr
<mask> if dstAddr, err = net.ResolveUDPAddr("udp4", dst); err != nil {
<mask> return false, fmt.Errorf("couldn't resolve UDP address %s: %w", dst, err)
<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 var subnet *net.IPNet
</s> add var subnet netip.Prefix </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 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.Web.IP, req.Web.Port)
</s> add err = aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(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) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/dhcp_unix.go |
//
// TODO(e.burkov): Use map[netip.Addr]struct{} instead. | <mask> // done is the channel to sign closing the container.
<mask> done chan struct{}
<mask>
<mask> // updates is the channel for receiving updated hosts.
<mask> updates chan *netutil.IPMap
<mask>
<mask> // last is the set of hosts that was cached within last detected change.
<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 </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 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 subnet *net.IPNet
</s> add subnet netip.Prefix | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/hostscontainer.go |
//
// TODO(e.burkov): Use map[netip.Addr]struct{} instead. | <mask> // TODO(e.burkov): Use map[netip.Addr]struct{} instead.
<mask> updates chan *netutil.IPMap
<mask>
<mask> // last is the set of hosts that was cached within last detected change.
<mask> last *netutil.IPMap
<mask>
<mask> // fsys is the working file system to read hosts files from.
<mask> fsys fs.FS
</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",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/hostscontainer.go |
"net/netip" | <mask> "encoding/json"
<mask> "fmt"
<mask> "io"
<mask> "net"
<mask> "syscall"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
</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 "github.com/AdguardTeam/golibs/netutil"
</s> add | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/log"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> )
<mask>
<mask> // Variables and functions to substitute in tests.
<mask> var (
<mask> // aghosRunCommand is the function to run shell commands.
</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 "net"
</s> add "net/netip" </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </s> remove dnsIPAddrs: []net.IP{DefaultSelfIP},
</s> add dnsIPAddrs: []netip.Addr{DefaultSelfIP}, | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
|
// IPv4Localhost returns 127.0.0.1, which returns true for [netip.Addr.Is4].
func IPv4Localhost() (ip netip.Addr) { return netip.AddrFrom4([4]byte{127, 0, 0, 1}) }
// IPv6Localhost returns ::1, which returns true for [netip.Addr.Is6].
func IPv6Localhost() (ip netip.Addr) { return netip.AddrFrom16([16]byte{15: 1}) }
| <mask> // ErrNoStaticIPInfo is returned by IfaceHasStaticIP when no information about
<mask> // the IP being static is available.
<mask> const ErrNoStaticIPInfo errors.Error = "no information about static ip"
<mask>
<mask> // IfaceHasStaticIP checks if interface is configured to have static IP address.
<mask> // If it can't give a definitive answer, it returns false and an error for which
<mask> // errors.Is(err, ErrNoStaticIPInfo) is true.
<mask> func IfaceHasStaticIP(ifaceName string) (has bool, err error) {
<mask> return ifaceHasStaticIP(ifaceName)
</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 handleStaticIP(ip net.IP, set bool) staticIPJSON {
</s> add func handleStaticIP(ip netip.Addr, set bool) staticIPJSON { </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 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 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 func appendDNSAddrsWithIfaces(dst []string, src []net.IP) (res []string, err error) {
</s> add func appendDNSAddrsWithIfaces(dst []string, src []netip.Addr) (res []string, err error) { | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
func GatewayIP(ifaceName string) (ip netip.Addr) { | <mask> // GatewayIP returns IP address of interface's gateway.
<mask> //
<mask> // TODO(e.burkov): Investigate if the gateway address may be fetched in another
<mask> // way since not every machine has the software installed.
<mask> func GatewayIP(ifaceName string) (ip net.IP) {
<mask> code, out, err := aghosRunCommand("ip", "route", "show", "dev", ifaceName)
<mask> if err != nil {
<mask> log.Debug("%s", err)
<mask>
<mask> return nil
</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
</s> add return netip.Addr{} </s> remove func InterfaceByIP(ip net.IP) (ifaceName string) {
</s> add func InterfaceByIP(ip netip.Addr) (ifaceName string) { </s> remove func GetSubnet(ifaceName string) *net.IPNet {
</s> add func GetSubnet(ifaceName string) (p netip.Prefix) { </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/aghnet/net.go |
return netip.Addr{} | <mask> code, out, err := aghosRunCommand("ip", "route", "show", "dev", ifaceName)
<mask> if err != nil {
<mask> log.Debug("%s", err)
<mask>
<mask> return nil
<mask> } else if code != 0 {
<mask> log.Debug("fetching gateway ip: unexpected exit code: %d", code)
<mask>
<mask> return nil
<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 return nil
</s> add return netip.Addr{} </s> remove func GatewayIP(ifaceName string) (ip net.IP) {
</s> add func GatewayIP(ifaceName string) (ip netip.Addr) { </s> remove return nil
</s> add return p </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 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/aghnet/net.go |
return netip.Addr{} | <mask> return nil
<mask> } else if code != 0 {
<mask> log.Debug("fetching gateway ip: unexpected exit code: %d", code)
<mask>
<mask> return nil
<mask> }
<mask>
<mask> fields := bytes.Fields(out)
<mask> // The meaningful "ip route" command output should contain the word
<mask> // "default" at first field and default gateway IP address at third field.
</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
</s> add return netip.Addr{} </s> remove return nil
</s> add return netip.Addr{} </s> remove broadcastIP net.IP
</s> add broadcastIP netip.Addr </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 func GatewayIP(ifaceName string) (ip net.IP) {
</s> add func GatewayIP(ifaceName string) (ip netip.Addr) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
return netip.Addr{} | <mask> fields := bytes.Fields(out)
<mask> // The meaningful "ip route" command output should contain the word
<mask> // "default" at first field and default gateway IP address at third field.
<mask> if len(fields) < 3 || string(fields[0]) != "default" {
<mask> return nil
<mask> }
<mask>
<mask> return net.ParseIP(string(fields[2]))
<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 return nil
</s> add return netip.Addr{} </s> remove return net.ParseIP(string(fields[2]))
</s> add ip, err = netip.ParseAddr(string(fields[2]))
if err != nil {
return netip.Addr{}
}
return ip </s> remove broadcastIP net.IP
</s> add broadcastIP netip.Addr </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 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"` | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
ip, err = netip.ParseAddr(string(fields[2]))
if err != nil {
return netip.Addr{}
}
return ip | <mask> if len(fields) < 3 || string(fields[0]) != "default" {
<mask> return nil
<mask> }
<mask>
<mask> return net.ParseIP(string(fields[2]))
<mask> }
<mask>
<mask> // CanBindPrivilegedPorts checks if current process can bind to privileged
<mask> // ports.
<mask> func CanBindPrivilegedPorts() (can bool, err error) {
</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
</s> add return netip.Addr{} </s> remove if ipNet.IP == nil {
</s> add if !ipNet.Addr().IsValid() { </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 var subnet *net.IPNet
</s> add var subnet netip.Prefix </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/aghnet/net.go |
Addresses []netip.Addr `json:"ip_addresses,omitempty"` | <mask>
<mask> // NetInterface represents an entry of network interfaces map.
<mask> type NetInterface struct {
<mask> // Addresses are the network interface addresses.
<mask> Addresses []net.IP `json:"ip_addresses,omitempty"`
<mask> // Subnets are the IP networks for this network interface.
<mask> Subnets []*net.IPNet `json:"-"`
<mask> Name string `json:"name"`
<mask> HardwareAddr net.HardwareAddr `json:"hardware_address"`
<mask> Flags net.Flags `json:"flags"`
</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 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 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 func GetSubnet(ifaceName string) *net.IPNet {
</s> add func GetSubnet(ifaceName string) (p netip.Prefix) { </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",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
Subnets []netip.Prefix `json:"-"` | <mask> type NetInterface struct {
<mask> // Addresses are the network interface addresses.
<mask> Addresses []net.IP `json:"ip_addresses,omitempty"`
<mask> // Subnets are the IP networks for this network interface.
<mask> Subnets []*net.IPNet `json:"-"`
<mask> Name string `json:"name"`
<mask> HardwareAddr net.HardwareAddr `json:"hardware_address"`
<mask> Flags net.Flags `json:"flags"`
<mask> MTU int `json:"mtu"`
<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 Addresses []net.IP `json:"ip_addresses,omitempty"`
</s> add Addresses []netip.Addr `json:"ip_addresses,omitempty"` </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 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"`
</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"` | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
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() | <mask> netInterface: netInterface(iface),
<mask> })
<mask> }
<mask>
<mask> // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and
<mask> // WEB only we do not return link-local addresses here.
<mask> //
<mask> // TODO(e.burkov): Can't properly test the function since it's nontrivial to
<mask> // substitute net.Interface.Addrs and the net.InterfaceAddrs can't be used.
<mask> func GetValidNetInterfacesForWeb() (netIfaces []*NetInterface, err error) {
<mask> ifaces, err := net.Interfaces()
<mask> if err != nil {
<mask> return nil, fmt.Errorf("couldn't get interfaces: %w", err)
<mask> } else if len(ifaces) == 0 {
<mask> return nil, errors.Error("couldn't find any legible interface")
<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 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 // 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 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 addrs = appendDNSAddrs(addrs, net.IP{127, 0, 0, 1})
</s> add addr := aghnet.IPv4Localhost()
addrs = appendDNSAddrs(addrs, addr) </s> remove func GetSubnet(ifaceName string) *net.IPNet {
</s> add func GetSubnet(ifaceName string) (p netip.Prefix) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
return nil, fmt.Errorf("failed to get addresses for interface %s: %w", iface.Name, err) | <mask> // substitute net.Interface.Addrs and the net.InterfaceAddrs can't be used.
<mask> func GetValidNetInterfacesForWeb() (netIfaces []*NetInterface, err error) {
<mask> ifaces, err := net.Interfaces()
<mask> if err != nil {
<mask> return nil, fmt.Errorf("couldn't get interfaces: %w", err)
<mask> } else if len(ifaces) == 0 {
<mask> return nil, errors.Error("couldn't find any legible interface")
<mask> }
<mask>
<mask> for _, iface := range ifaces {
<mask> var addrs []net.Addr
<mask> addrs, err = iface.Addrs()
</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 // 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 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 // 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 return nil, err
</s> add return netip.Prefix{}, err </s> remove func ifaceIPv4Subnet(iface *net.Interface) (subnet *net.IPNet, err error) {
</s> add func ifaceIPv4Subnet(iface *net.Interface) (subnet netip.Prefix, err error) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
// 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 | <mask> } else if len(ifaces) == 0 {
<mask> return nil, errors.Error("couldn't find any legible interface")
<mask> }
<mask>
<mask> for _, iface := range ifaces {
<mask> var addrs []net.Addr
<mask> addrs, err = iface.Addrs()
<mask> if err != nil {
<mask> return nil, fmt.Errorf("failed to get addresses for interface %s: %w", iface.Name, err)
<mask> }
<mask>
<mask> netIface := &NetInterface{
<mask> MTU: iface.MTU,
<mask> Name: iface.Name,
</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("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 netIface := &NetInterface{
MTU: iface.MTU,
Name: iface.Name,
HardwareAddr: iface.HardwareAddr,
Flags: iface.Flags,
</s> add ip, ok := netip.AddrFromSlice(n.IP)
if !ok {
return nil, fmt.Errorf("bad address %s", n.IP) </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 return nil, err
</s> add return netip.Prefix{}, err </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",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
ip, ok := netip.AddrFromSlice(n.IP)
if !ok {
return nil, fmt.Errorf("bad address %s", n.IP) | <mask> if err != nil {
<mask> return nil, fmt.Errorf("failed to get addresses for interface %s: %w", iface.Name, err)
<mask> }
<mask>
<mask> netIface := &NetInterface{
<mask> MTU: iface.MTU,
<mask> Name: iface.Name,
<mask> HardwareAddr: iface.HardwareAddr,
<mask> Flags: iface.Flags,
<mask> }
<mask>
<mask> // Collect network interface addresses.
<mask> for _, addr := range addrs {
<mask> ipNet, ok := addr.(*net.IPNet)
</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 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 // 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 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 return nil
</s> add return p | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
ip = ip.Unmap()
if ip.IsLinkLocalUnicast() {
// Ignore link-local IPv4.
if ip.Is4() { | <mask> HardwareAddr: iface.HardwareAddr,
<mask> Flags: iface.Flags,
<mask> }
<mask>
<mask> // Collect network interface addresses.
<mask> for _, addr := range addrs {
<mask> ipNet, ok := addr.(*net.IPNet)
<mask> if !ok {
<mask> // Should be net.IPNet, this is weird.
<mask> return nil, fmt.Errorf("got %s that is not net.IPNet, it is %T", addr, addr)
<mask> }
<mask>
<mask> // Ignore link-local.
<mask> if ipNet.IP.IsLinkLocalUnicast() {
<mask> continue
<mask> }
<mask>
<mask> netIface.Addresses = append(netIface.Addresses, ipNet.IP)
<mask> netIface.Subnets = append(netIface.Subnets, ipNet)
</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 netIface := &NetInterface{
MTU: iface.MTU,
Name: iface.Name,
HardwareAddr: iface.HardwareAddr,
Flags: iface.Flags,
</s> add ip, ok := netip.AddrFromSlice(n.IP)
if !ok {
return nil, fmt.Errorf("bad address %s", n.IP) </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 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 addr := netutil.IPPort{IP: ip, Port: port}.String()
</s> add addr := ipp.String() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
ip = ip.WithZone(iface.Name) | <mask> if ipNet.IP.IsLinkLocalUnicast() {
<mask> continue
<mask> }
<mask>
<mask> netIface.Addresses = append(netIface.Addresses, ipNet.IP)
<mask> netIface.Subnets = append(netIface.Subnets, ipNet)
<mask> }
<mask>
<mask> // Discard interfaces with no addresses.
<mask> if len(netIface.Addresses) != 0 {
<mask> netIfaces = append(netIfaces, netIface)
</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 // 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 // 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 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 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 return netIfaces, nil
</s> add return nifaces, nil | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
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) | <mask> netIface.Addresses = append(netIface.Addresses, ipNet.IP)
<mask> netIface.Subnets = append(netIface.Subnets, ipNet)
<mask> }
<mask>
<mask> // Discard interfaces with no addresses.
<mask> if len(netIface.Addresses) != 0 {
<mask> netIfaces = append(netIfaces, netIface)
<mask> }
<mask> }
<mask>
<mask> return netIfaces, nil
<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 netIface.Addresses = append(netIface.Addresses, ipNet.IP)
netIface.Subnets = append(netIface.Subnets, ipNet)
</s> add ip = ip.WithZone(iface.Name) </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 return netIfaces, nil
</s> add return nifaces, nil </s> remove return nil
</s> add return p </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",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
return nifaces, nil | <mask> netIfaces = append(netIfaces, netIface)
<mask> }
<mask> }
<mask>
<mask> return netIfaces, nil
<mask> }
<mask>
<mask> // InterfaceByIP returns the name of the interface bound to ip.
<mask> //
<mask> // TODO(a.garipov, e.burkov): This function is technically incorrect, since one
</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 InterfaceByIP(ip net.IP) (ifaceName string) {
</s> add func InterfaceByIP(ip netip.Addr) (ifaceName string) { </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 // 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 netIface.Addresses = append(netIface.Addresses, ipNet.IP)
netIface.Subnets = append(netIface.Subnets, ipNet)
</s> add ip = ip.WithZone(iface.Name) </s> remove func GetSubnet(ifaceName string) *net.IPNet {
</s> add func GetSubnet(ifaceName string) (p netip.Prefix) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
func InterfaceByIP(ip netip.Addr) (ifaceName string) { | <mask> // TODO(a.garipov, e.burkov): This function is technically incorrect, since one
<mask> // IP address can be shared by multiple interfaces in some configurations.
<mask> //
<mask> // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
<mask> func InterfaceByIP(ip net.IP) (ifaceName string) {
<mask> ifaces, err := GetValidNetInterfacesForWeb()
<mask> if err != nil {
<mask> return ""
<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 return netIfaces, nil
</s> add return nifaces, nil </s> remove func GetSubnet(ifaceName string) *net.IPNet {
</s> add func GetSubnet(ifaceName string) (p netip.Prefix) { </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 func GatewayIP(ifaceName string) (ip net.IP) {
</s> add func GatewayIP(ifaceName string) (ip netip.Addr) { </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",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
if ip == addr { | <mask> }
<mask>
<mask> for _, iface := range ifaces {
<mask> for _, addr := range iface.Addresses {
<mask> if ip.Equal(addr) {
<mask> return iface.Name
<mask> }
<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 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, 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 return nil, err
</s> add return netip.Prefix{}, err </s> remove hostport = netutil.JoinHostPort(addr.String(), config.DNS.Port)
</s> add hostport = netip.AddrPortFrom(addr, uint16(config.DNS.Port)).String() </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)))) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
// GetSubnet returns the subnet corresponding to the interface of zero prefix if | <mask>
<mask> return ""
<mask> }
<mask>
<mask> // GetSubnet returns pointer to net.IPNet for the specified interface or nil if
<mask> // the search fails.
<mask> //
<mask> // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
<mask> func GetSubnet(ifaceName string) *net.IPNet {
<mask> netIfaces, err := GetValidNetInterfacesForWeb()
</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 GetSubnet(ifaceName string) *net.IPNet {
</s> add func GetSubnet(ifaceName string) (p netip.Prefix) { </s> remove func InterfaceByIP(ip net.IP) (ifaceName string) {
</s> add func InterfaceByIP(ip netip.Addr) (ifaceName string) { </s> remove return nil
</s> add return p </s> remove if ipNet.IP == nil {
</s> add if !ipNet.Addr().IsValid() { </s> remove func GatewayIP(ifaceName string) (ip net.IP) {
</s> add func GatewayIP(ifaceName string) (ip netip.Addr) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
func GetSubnet(ifaceName string) (p netip.Prefix) { | <mask> // GetSubnet returns pointer to net.IPNet for the specified interface or nil if
<mask> // the search fails.
<mask> //
<mask> // TODO(e.burkov): See TODO on GetValidNetInterfacesForWeb.
<mask> func GetSubnet(ifaceName string) *net.IPNet {
<mask> netIfaces, err := GetValidNetInterfacesForWeb()
<mask> if err != nil {
<mask> log.Error("Could not get network interfaces info: %v", err)
<mask> return nil
<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 // 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 return nil
</s> add return p </s> remove func InterfaceByIP(ip net.IP) (ifaceName string) {
</s> add func InterfaceByIP(ip netip.Addr) (ifaceName string) { </s> remove if ipNet.IP == nil {
</s> add if !ipNet.Addr().IsValid() { </s> remove func GatewayIP(ifaceName string) (ip net.IP) {
</s> add func GatewayIP(ifaceName string) (ip netip.Addr) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
return p | <mask> func GetSubnet(ifaceName string) *net.IPNet {
<mask> netIfaces, err := GetValidNetInterfacesForWeb()
<mask> if err != nil {
<mask> log.Error("Could not get network interfaces info: %v", err)
<mask> return nil
<mask> }
<mask>
<mask> for _, netIface := range netIfaces {
<mask> if netIface.Name == ifaceName && len(netIface.Subnets) > 0 {
<mask> return netIface.Subnets[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 func GetSubnet(ifaceName string) *net.IPNet {
</s> add func GetSubnet(ifaceName string) (p netip.Prefix) { </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 // 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 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 if ipNet.IP == nil {
</s> add if !ipNet.Addr().IsValid() { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
return p | <mask> return netIface.Subnets[0]
<mask> }
<mask> }
<mask>
<mask> return nil
<mask> }
<mask>
<mask> // CheckPort checks if the port is available for binding. network is expected
<mask> // to be one of "udp" and "tcp".
<mask> func CheckPort(network string, ip net.IP, port int) (err error) {
</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 CheckPort(network string, ip net.IP, port int) (err error) {
</s> add func CheckPort(network string, ipp netip.AddrPort) (err error) { </s> remove addr := netutil.IPPort{IP: ip, Port: port}.String()
</s> add addr := ipp.String() </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 return aghnet.CheckPort("tcp", req.Web.IP, portInt)
</s> add return aghnet.CheckPort("tcp", netip.AddrPortFrom(req.Web.IP, uint16(portInt))) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
func CheckPort(network string, ipp netip.AddrPort) (err error) { | <mask> }
<mask>
<mask> // CheckPort checks if the port is available for binding. network is expected
<mask> // to be one of "udp" and "tcp".
<mask> func CheckPort(network string, ip net.IP, port int) (err error) {
<mask> var c io.Closer
<mask> addr := netutil.IPPort{IP: ip, Port: port}.String()
<mask> switch network {
<mask> case "tcp":
<mask> c, err = net.Listen(network, addr)
</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
</s> add return p </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) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
addr := ipp.String() | <mask> // CheckPort checks if the port is available for binding. network is expected
<mask> // to be one of "udp" and "tcp".
<mask> func CheckPort(network string, ip net.IP, port int) (err error) {
<mask> var c io.Closer
<mask> addr := netutil.IPPort{IP: ip, Port: port}.String()
<mask> switch network {
<mask> case "tcp":
<mask> c, err = net.Listen(network, addr)
<mask> case "udp":
<mask> c, err = net.ListenPacket(network, addr)
</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 CheckPort(network string, ip net.IP, port int) (err error) {
</s> add func CheckPort(network string, ipp netip.AddrPort) (err error) { </s> remove return nil
</s> add return p </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 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/aghnet/net.go |
// BroadcastFromPref calculates the broadcast IP address for p.
func BroadcastFromPref(p netip.Prefix) (bc netip.Addr) {
bc = p.Addr().Unmap()
if !bc.IsValid() {
return netip.Addr{}
} | <mask>
<mask> return addrs, nil
<mask> }
<mask>
<mask> // BroadcastFromIPNet calculates the broadcast IP address for n.
<mask> func BroadcastFromIPNet(n *net.IPNet) (dc net.IP) {
<mask> dc = netutil.CloneIP(n.IP)
<mask>
<mask> mask := n.Mask
<mask> if mask == nil {
<mask> mask = dc.DefaultMask()
<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 mask := n.Mask
if mask == nil {
mask = dc.DefaultMask()
</s> add maskLen, addrLen := p.Bits(), bc.BitLen()
if maskLen == addrLen {
return bc </s> remove for i, b := range mask {
dc[i] |= ^b
</s> add ipBytes := bc.AsSlice()
for i := maskLen; i < addrLen; i++ {
ipBytes[i/8] |= 1 << (7 - (i % 8)) </s> remove return dc
</s> add return bc </s> remove if ip4 := reqIP.To4(); ip4 == nil {
</s> add ip4 := reqIP.To4()
if ip4 == nil { </s> remove func GatewayIP(ifaceName string) (ip net.IP) {
</s> add func GatewayIP(ifaceName string) (ip netip.Addr) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
maskLen, addrLen := p.Bits(), bc.BitLen()
if maskLen == addrLen {
return bc | <mask> // BroadcastFromIPNet calculates the broadcast IP address for n.
<mask> func BroadcastFromIPNet(n *net.IPNet) (dc net.IP) {
<mask> dc = netutil.CloneIP(n.IP)
<mask>
<mask> mask := n.Mask
<mask> if mask == nil {
<mask> mask = dc.DefaultMask()
<mask> }
<mask>
<mask> for i, b := range mask {
<mask> dc[i] |= ^b
<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 // BroadcastFromIPNet calculates the broadcast IP address for n.
func BroadcastFromIPNet(n *net.IPNet) (dc net.IP) {
dc = netutil.CloneIP(n.IP)
</s> add // BroadcastFromPref calculates the broadcast IP address for p.
func BroadcastFromPref(p netip.Prefix) (bc netip.Addr) {
bc = p.Addr().Unmap()
if !bc.IsValid() {
return netip.Addr{}
} </s> remove for i, b := range mask {
dc[i] |= ^b
</s> add ipBytes := bc.AsSlice()
for i := maskLen; i < addrLen; i++ {
ipBytes[i/8] |= 1 << (7 - (i % 8)) </s> remove return dc
</s> add return bc </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)))) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
ipBytes := bc.AsSlice()
for i := maskLen; i < addrLen; i++ {
ipBytes[i/8] |= 1 << (7 - (i % 8)) | <mask> if mask == nil {
<mask> mask = dc.DefaultMask()
<mask> }
<mask>
<mask> for i, b := range mask {
<mask> dc[i] |= ^b
<mask> }
<mask>
<mask> return dc
<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 return dc
</s> add return bc </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 // BroadcastFromIPNet calculates the broadcast IP address for n.
func BroadcastFromIPNet(n *net.IPNet) (dc net.IP) {
dc = netutil.CloneIP(n.IP)
</s> add // BroadcastFromPref calculates the broadcast IP address for p.
func BroadcastFromPref(p netip.Prefix) (bc netip.Addr) {
bc = p.Addr().Unmap()
if !bc.IsValid() {
return netip.Addr{}
} </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)))) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
bc, _ = netip.AddrFromSlice(ipBytes) | <mask> ipBytes := bc.AsSlice()
<mask> for i := maskLen; i < addrLen; i++ {
<mask> ipBytes[i/8] |= 1 << (7 - (i % 8))
<mask> }
<mask>
<mask> return bc
<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 for i, b := range mask {
dc[i] |= ^b
</s> add ipBytes := bc.AsSlice()
for i := maskLen; i < addrLen; i++ {
ipBytes[i/8] |= 1 << (7 - (i % 8)) </s> remove return dc
</s> add return bc </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 bc := BroadcastFromIPNet(tc.subnet)
assert.True(t, bc.Equal(tc.want), bc)
</s> add assert.Equal(t, tc.want, BroadcastFromPref(tc.pref)) </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",
"add",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
return bc | <mask> for i, b := range mask {
<mask> dc[i] |= ^b
<mask> }
<mask>
<mask> return dc
<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 for i, b := range mask {
dc[i] |= ^b
</s> add ipBytes := bc.AsSlice()
for i := maskLen; i < addrLen; i++ {
ipBytes[i/8] |= 1 << (7 - (i % 8)) </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 // BroadcastFromIPNet calculates the broadcast IP address for n.
func BroadcastFromIPNet(n *net.IPNet) (dc net.IP) {
dc = netutil.CloneIP(n.IP)
</s> add // BroadcastFromPref calculates the broadcast IP address for p.
func BroadcastFromPref(p netip.Prefix) (bc netip.Addr) {
bc = p.Addr().Unmap()
if !bc.IsValid() {
return netip.Addr{}
} </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)))) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net.go |
"net/netip" | <mask> import (
<mask> "bufio"
<mask> "fmt"
<mask> "io"
<mask> "net"
<mask> "os"
<mask> "strings"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghos"
<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",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_linux.go |
if !ipNet.Addr().IsValid() { | <mask> // ifaceSetStaticIP configures the system to retain its current IP on the
<mask> // interface through dhcpcd.conf.
<mask> func ifaceSetStaticIP(ifaceName string) (err error) {
<mask> ipNet := GetSubnet(ifaceName)
<mask> if ipNet.IP == nil {
<mask> return errors.Error("can't get IP address")
<mask> }
<mask>
<mask> body, err := os.ReadFile(dhcpcdConf)
<mask> if err != nil && !errors.Is(err, os.ErrNotExist) {
</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 GetSubnet(ifaceName string) *net.IPNet {
</s> add func GetSubnet(ifaceName string) (p netip.Prefix) { </s> remove return nil
</s> add return p </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 // 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 func InterfaceByIP(ip net.IP) (ifaceName string) {
</s> add func InterfaceByIP(ip netip.Addr) (ifaceName string) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_linux.go |
func dhcpcdConfIface(ifaceName string, subnet netip.Prefix, gateway netip.Addr) (conf string) { | <mask> }
<mask>
<mask> // dhcpcdConfIface returns configuration lines for the dhcpdc.conf files that
<mask> // configure the interface to have a static IP.
<mask> func dhcpcdConfIface(ifaceName string, ipNet *net.IPNet, gwIP net.IP) (conf string) {
<mask> b := &strings.Builder{}
<mask> stringutil.WriteToBuilder(
<mask> b,
<mask> "\n# ",
<mask> ifaceName,
</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 // 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 ipNet.String(),
</s> add subnet.String(), </s> remove func GetSubnet(ifaceName string) *net.IPNet {
</s> add func GetSubnet(ifaceName string) (p netip.Prefix) { </s> remove if ipNet.IP == nil {
</s> add if !ipNet.Addr().IsValid() { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_linux.go |
subnet.String(), | <mask> ifaceName,
<mask> " added by AdGuard Home.\ninterface ",
<mask> ifaceName,
<mask> "\nstatic ip_address=",
<mask> ipNet.String(),
<mask> "\n",
<mask> )
<mask>
<mask> if gwIP != nil {
<mask> stringutil.WriteToBuilder(b, "static routers=", gwIP.String(), "\n")
</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 gwIP != nil {
stringutil.WriteToBuilder(b, "static routers=", gwIP.String(), "\n")
</s> add if gateway != (netip.Addr{}) {
stringutil.WriteToBuilder(b, "static routers=", gateway.String(), "\n") </s> remove stringutil.WriteToBuilder(b, "static domain_name_servers=", ipNet.IP.String(), "\n\n")
</s> add stringutil.WriteToBuilder(b, "static domain_name_servers=", subnet.Addr().String(), "\n\n") </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 err := aghnet.CheckPort("tcp", net.IP{127, 0, 0, 1}, defaultPortDNS)
</s> add err := aghnet.CheckPort("tcp", netip.AddrPortFrom(aghnet.IPv4Localhost(), defaultPortDNS)) </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)) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_linux.go |
if gateway != (netip.Addr{}) {
stringutil.WriteToBuilder(b, "static routers=", gateway.String(), "\n") | <mask> ipNet.String(),
<mask> "\n",
<mask> )
<mask>
<mask> if gwIP != nil {
<mask> stringutil.WriteToBuilder(b, "static routers=", gwIP.String(), "\n")
<mask> }
<mask>
<mask> stringutil.WriteToBuilder(b, "static domain_name_servers=", ipNet.IP.String(), "\n\n")
<mask>
<mask> return b.String()
</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 stringutil.WriteToBuilder(b, "static domain_name_servers=", ipNet.IP.String(), "\n\n")
</s> add stringutil.WriteToBuilder(b, "static domain_name_servers=", subnet.Addr().String(), "\n\n") </s> remove ipNet.String(),
</s> add subnet.String(), </s> remove defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP)) }()
</s> add defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP.AsSlice())) }() </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 if !c.subnet.Contains(c.RangeStart) {
</s> add if !c.subnet.Contains(rangeStart) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_linux.go |
stringutil.WriteToBuilder(b, "static domain_name_servers=", subnet.Addr().String(), "\n\n") | <mask> if gwIP != nil {
<mask> stringutil.WriteToBuilder(b, "static routers=", gwIP.String(), "\n")
<mask> }
<mask>
<mask> stringutil.WriteToBuilder(b, "static domain_name_servers=", ipNet.IP.String(), "\n\n")
<mask>
<mask> return b.String()
<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 gwIP != nil {
stringutil.WriteToBuilder(b, "static routers=", gwIP.String(), "\n")
</s> add if gateway != (netip.Addr{}) {
stringutil.WriteToBuilder(b, "static routers=", gateway.String(), "\n") </s> remove ipNet.String(),
</s> add subnet.String(), </s> remove defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP)) }()
</s> add defer func() { s.implicitOpts.Update(dhcpv4.OptDNS(defaultIP.AsSlice())) }() </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 return nil
</s> add return netip.Addr{} | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_linux.go |
"net/netip" | <mask> "encoding/json"
<mask> "fmt"
<mask> "io/fs"
<mask> "net"
<mask> "os"
<mask> "strings"
<mask> "testing"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghtest"
<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",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
<mask> const ifaceName = "ifaceName"
<mask> const cmd = "ip route show dev " + ifaceName
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> shell mapShell
<mask> want net.IP
<mask> }{{
<mask> name: "success_v4",
<mask> shell: theOnlyCmd(cmd, 0, `default via 1.2.3.4 onlink`, nil),
</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 want net.IP
</s> add want netip.Addr
name string </s> remove name: "success_v4",
</s> add </s> remove want: net.IP{1, 2, 3, 4}.To16(),
</s> add want: netip.MustParseAddr("1.2.3.4"),
name: "success_v4", </s> remove name: "success_v6",
</s> add </s> remove name: "err_runcmd",
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
|
want netip.Addr
name string | <mask>
<mask> testCases := []struct {
<mask> name string
<mask> shell mapShell
<mask> want net.IP
<mask> }{{
<mask> name: "success_v4",
<mask> shell: theOnlyCmd(cmd, 0, `default via 1.2.3.4 onlink`, nil),
<mask> want: net.IP{1, 2, 3, 4}.To16(),
<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 name: "success_v4",
</s> add </s> remove want: net.IP{1, 2, 3, 4}.To16(),
</s> add want: netip.MustParseAddr("1.2.3.4"),
name: "success_v4", </s> remove name string
</s> add </s> remove name: "success_v6",
</s> add </s> remove want: net.IP{
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0xFF, 0xFF,
},
</s> add want: netip.MustParseAddr("::ffff"),
name: "success_v6", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
<mask> name string
<mask> shell mapShell
<mask> want net.IP
<mask> }{{
<mask> name: "success_v4",
<mask> shell: theOnlyCmd(cmd, 0, `default via 1.2.3.4 onlink`, nil),
<mask> want: net.IP{1, 2, 3, 4}.To16(),
<mask> }, {
<mask> name: "success_v6",
<mask> shell: theOnlyCmd(cmd, 0, `default via ::ffff onlink`, nil),
</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 want: net.IP{1, 2, 3, 4}.To16(),
</s> add want: netip.MustParseAddr("1.2.3.4"),
name: "success_v4", </s> remove want net.IP
</s> add want netip.Addr
name string </s> remove name: "success_v6",
</s> add </s> remove want: net.IP{
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0xFF, 0xFF,
},
</s> add want: netip.MustParseAddr("::ffff"),
name: "success_v6", </s> remove name string
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
|
want: netip.MustParseAddr("1.2.3.4"),
name: "success_v4", | <mask> want net.IP
<mask> }{{
<mask> name: "success_v4",
<mask> shell: theOnlyCmd(cmd, 0, `default via 1.2.3.4 onlink`, nil),
<mask> want: net.IP{1, 2, 3, 4}.To16(),
<mask> }, {
<mask> name: "success_v6",
<mask> shell: theOnlyCmd(cmd, 0, `default via ::ffff onlink`, nil),
<mask> want: net.IP{
<mask> 0x0, 0x0, 0x0, 0x0,
</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: "success_v6",
</s> add </s> remove want: net.IP{
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0xFF, 0xFF,
},
</s> add want: netip.MustParseAddr("::ffff"),
name: "success_v6", </s> remove name: "success_v4",
</s> add </s> remove name: "bad_output",
</s> add </s> remove want net.IP
</s> add want netip.Addr
name string | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
<mask> name: "success_v4",
<mask> shell: theOnlyCmd(cmd, 0, `default via 1.2.3.4 onlink`, nil),
<mask> want: net.IP{1, 2, 3, 4}.To16(),
<mask> }, {
<mask> name: "success_v6",
<mask> shell: theOnlyCmd(cmd, 0, `default via ::ffff onlink`, nil),
<mask> want: net.IP{
<mask> 0x0, 0x0, 0x0, 0x0,
<mask> 0x0, 0x0, 0x0, 0x0,
<mask> 0x0, 0x0, 0x0, 0x0,
</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 want: net.IP{
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0xFF, 0xFF,
},
</s> add want: netip.MustParseAddr("::ffff"),
name: "success_v6", </s> remove want: net.IP{1, 2, 3, 4}.To16(),
</s> add want: netip.MustParseAddr("1.2.3.4"),
name: "success_v4", </s> remove name: "bad_output",
</s> add </s> remove name: "success_v4",
</s> add </s> remove want net.IP
</s> add want netip.Addr
name string | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
|
want: netip.MustParseAddr("::ffff"),
name: "success_v6", | <mask> want: net.IP{1, 2, 3, 4}.To16(),
<mask> }, {
<mask> name: "success_v6",
<mask> shell: theOnlyCmd(cmd, 0, `default via ::ffff onlink`, nil),
<mask> want: net.IP{
<mask> 0x0, 0x0, 0x0, 0x0,
<mask> 0x0, 0x0, 0x0, 0x0,
<mask> 0x0, 0x0, 0x0, 0x0,
<mask> 0x0, 0x0, 0xFF, 0xFF,
<mask> },
<mask> }, {
<mask> name: "bad_output",
<mask> shell: theOnlyCmd(cmd, 0, `non-default via 1.2.3.4 onlink`, nil),
<mask> want: nil,
<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 name: "success_v6",
</s> add </s> remove name: "bad_output",
</s> add </s> remove want: net.IP{1, 2, 3, 4}.To16(),
</s> add want: netip.MustParseAddr("1.2.3.4"),
name: "success_v4", </s> remove name: "success_v4",
</s> add </s> remove want: nil,
</s> add want: netip.Addr{},
name: "bad_output", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
<mask> 0x0, 0x0, 0x0, 0x0,
<mask> 0x0, 0x0, 0xFF, 0xFF,
<mask> },
<mask> }, {
<mask> name: "bad_output",
<mask> shell: theOnlyCmd(cmd, 0, `non-default via 1.2.3.4 onlink`, nil),
<mask> want: nil,
<mask> }, {
<mask> name: "err_runcmd",
<mask> shell: theOnlyCmd(cmd, 0, "", errors.Error("can't run command")),
</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 want: net.IP{
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0xFF, 0xFF,
},
</s> add want: netip.MustParseAddr("::ffff"),
name: "success_v6", </s> remove name: "success_v6",
</s> add </s> remove want: net.IP{1, 2, 3, 4}.To16(),
</s> add want: netip.MustParseAddr("1.2.3.4"),
name: "success_v4", </s> remove name: "err_runcmd",
</s> add </s> remove want: nil,
</s> add want: netip.Addr{},
name: "bad_output", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
|
want: netip.Addr{},
name: "bad_output", | <mask> },
<mask> }, {
<mask> name: "bad_output",
<mask> shell: theOnlyCmd(cmd, 0, `non-default via 1.2.3.4 onlink`, nil),
<mask> want: nil,
<mask> }, {
<mask> name: "err_runcmd",
<mask> shell: theOnlyCmd(cmd, 0, "", errors.Error("can't run command")),
<mask> want: nil,
<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 name: "err_runcmd",
</s> add </s> remove name: "bad_output",
</s> add </s> remove want: nil,
</s> add want: netip.Addr{},
name: "err_runcmd", </s> remove name: "bad_code",
</s> add </s> remove want: net.IP{
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0xFF, 0xFF,
},
</s> add want: netip.MustParseAddr("::ffff"),
name: "success_v6", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
<mask> name: "bad_output",
<mask> shell: theOnlyCmd(cmd, 0, `non-default via 1.2.3.4 onlink`, nil),
<mask> want: nil,
<mask> }, {
<mask> name: "err_runcmd",
<mask> shell: theOnlyCmd(cmd, 0, "", errors.Error("can't run command")),
<mask> want: nil,
<mask> }, {
<mask> name: "bad_code",
<mask> shell: theOnlyCmd(cmd, 1, "", nil),
</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 want: nil,
</s> add want: netip.Addr{},
name: "bad_output", </s> remove want: nil,
</s> add want: netip.Addr{},
name: "err_runcmd", </s> remove name: "bad_output",
</s> add </s> remove name: "bad_code",
</s> add </s> remove want: net.IP{
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0xFF, 0xFF,
},
</s> add want: netip.MustParseAddr("::ffff"),
name: "success_v6", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
|
want: netip.Addr{},
name: "err_runcmd", | <mask> want: nil,
<mask> }, {
<mask> name: "err_runcmd",
<mask> shell: theOnlyCmd(cmd, 0, "", errors.Error("can't run command")),
<mask> want: nil,
<mask> }, {
<mask> name: "bad_code",
<mask> shell: theOnlyCmd(cmd, 1, "", nil),
<mask> want: nil,
<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 name: "bad_code",
</s> add </s> remove name: "err_runcmd",
</s> add </s> remove want: nil,
</s> add want: netip.Addr{},
name: "bad_output", </s> remove name: "bad_output",
</s> add </s> remove want: nil,
</s> add want: netip.Addr{},
name: "bad_code", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
<mask> name: "err_runcmd",
<mask> shell: theOnlyCmd(cmd, 0, "", errors.Error("can't run command")),
<mask> want: nil,
<mask> }, {
<mask> name: "bad_code",
<mask> shell: theOnlyCmd(cmd, 1, "", nil),
<mask> want: nil,
<mask> }}
<mask>
<mask> for _, tc := range testCases {
</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 want: nil,
</s> add want: netip.Addr{},
name: "err_runcmd", </s> remove name: "err_runcmd",
</s> add </s> remove want: nil,
</s> add want: netip.Addr{},
name: "bad_code", </s> remove want: nil,
</s> add want: netip.Addr{},
name: "bad_output", </s> remove name: "bad_output",
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
|
want: netip.Addr{},
name: "bad_code", | <mask> want: nil,
<mask> }, {
<mask> name: "bad_code",
<mask> shell: theOnlyCmd(cmd, 1, "", nil),
<mask> want: nil,
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> substShell(t, tc.shell.RunCmd)
</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: "bad_code",
</s> add </s> remove want: nil,
</s> add want: netip.Addr{},
name: "err_runcmd", </s> remove name: "err_runcmd",
</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 want: nil,
</s> add want: netip.Addr{},
name: "bad_output", | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
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") | <mask> }
<mask> }
<mask>
<mask> func TestBroadcastFromIPNet(t *testing.T) {
<mask> known6 := net.IP{
<mask> 1, 2, 3, 4,
<mask> 5, 6, 7, 8,
<mask> 9, 10, 11, 12,
<mask> 13, 14, 15, 16,
<mask> }
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> subnet *net.IPNet
<mask> want net.IP
</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 string
subnet *net.IPNet
want net.IP
</s> add pref netip.Prefix
want netip.Addr
name string </s> remove want net.IP
</s> add want netip.Addr
name string </s> remove gatewayIP net.IP
subnetMask net.IP
</s> add </s> remove dhcpv4.WithGatewayIP(DefaultGatewayIP),
</s> add dhcpv4.WithGatewayIP(DefaultGatewayIP.AsSlice()), </s> remove name string
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
pref netip.Prefix
want netip.Addr
name string | <mask> 13, 14, 15, 16,
<mask> }
<mask>
<mask> testCases := []struct {
<mask> name string
<mask> subnet *net.IPNet
<mask> want net.IP
<mask> }{{
<mask> name: "full",
<mask> subnet: &net.IPNet{
<mask> IP: net.IP{192, 168, 0, 1},
<mask> Mask: net.IPMask{255, 255, 15, 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 subnet: &net.IPNet{
IP: net.IP{192, 168, 0, 1},
Mask: net.IPMask{255, 255, 15, 0},
},
want: net.IP{192, 168, 240, 255},
</s> add </s> remove name: "ipv6_no_mask",
subnet: &net.IPNet{
IP: known6,
},
</s> add pref: netip.PrefixFrom(known4, 20),
want: netip.MustParseAddr("192.168.15.255"),
name: "full",
}, {
pref: netip.PrefixFrom(known6, netutil.IPv6BitLen), </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{192, 168, 1, 2},
},
want: net.IP{192, 168, 1, 255},
</s> add </s> remove want net.IP
</s> add want netip.Addr
name string | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
pref: netip.PrefixFrom(known4, 0),
want: fullBroadcast4, | <mask> pref netip.Prefix
<mask> want netip.Addr
<mask> name string
<mask> }{{
<mask> name: "full",
<mask> }, {
<mask> pref: netip.PrefixFrom(known4, 20),
<mask> want: netip.MustParseAddr("192.168.15.255"),
<mask> name: "full",
<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 name: "ipv6_no_mask",
subnet: &net.IPNet{
IP: known6,
},
</s> add pref: netip.PrefixFrom(known4, 20),
want: netip.MustParseAddr("192.168.15.255"),
name: "full",
}, {
pref: netip.PrefixFrom(known6, netutil.IPv6BitLen), </s> remove name string
subnet *net.IPNet
want net.IP
</s> add pref netip.Prefix
want netip.Addr
name string </s> remove want net.IP
</s> add want netip.Addr
name string | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
<mask> subnet *net.IPNet
<mask> want net.IP
<mask> }{{
<mask> name: "full",
<mask> subnet: &net.IPNet{
<mask> IP: net.IP{192, 168, 0, 1},
<mask> Mask: net.IPMask{255, 255, 15, 0},
<mask> },
<mask> want: net.IP{192, 168, 240, 255},
<mask> }, {
<mask> name: "ipv6_no_mask",
<mask> subnet: &net.IPNet{
<mask> IP: known6,
<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 name: "ipv6_no_mask",
subnet: &net.IPNet{
IP: known6,
},
</s> add pref: netip.PrefixFrom(known4, 20),
want: netip.MustParseAddr("192.168.15.255"),
name: "full",
}, {
pref: netip.PrefixFrom(known6, netutil.IPv6BitLen), </s> remove subnet: &net.IPNet{
IP: net.IP{192, 168, 1, 2},
},
want: net.IP{192, 168, 1, 255},
</s> add </s> remove name string
subnet *net.IPNet
want net.IP
</s> add pref netip.Prefix
want netip.Addr
name string </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 name: "outside_range_start",
</s> add name: "outside_range_start",
gatewayIP: netip.MustParseAddr("192.168.10.1"),
subnetMask: netip.MustParseAddr("255.255.255.240"), | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
|
pref: netip.PrefixFrom(known4, 20),
want: netip.MustParseAddr("192.168.15.255"),
name: "full",
}, {
pref: netip.PrefixFrom(known6, netutil.IPv6BitLen), | <mask> Mask: net.IPMask{255, 255, 15, 0},
<mask> },
<mask> want: net.IP{192, 168, 240, 255},
<mask> }, {
<mask> name: "ipv6_no_mask",
<mask> subnet: &net.IPNet{
<mask> IP: known6,
<mask> },
<mask> want: known6,
<mask> }, {
<mask> name: "ipv4_no_mask",
<mask> subnet: &net.IPNet{
<mask> IP: net.IP{192, 168, 1, 2},
</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{192, 168, 0, 1},
Mask: net.IPMask{255, 255, 15, 0},
},
want: net.IP{192, 168, 240, 255},
</s> add </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 name string
subnet *net.IPNet
want net.IP
</s> add pref netip.Prefix
want netip.Addr
name string | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
name: "ipv6_no_mask", | <mask> }, {
<mask> pref: netip.PrefixFrom(known6, netutil.IPv6BitLen),
<mask> want: known6,
<mask> }, {
<mask> pref: netip.PrefixFrom(known4, netutil.IPv4BitLen),
<mask> want: known4,
<mask> name: "ipv4_no_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 name: "ipv6_no_mask",
subnet: &net.IPNet{
IP: known6,
},
</s> add pref: netip.PrefixFrom(known4, 20),
want: netip.MustParseAddr("192.168.15.255"),
name: "full",
}, {
pref: netip.PrefixFrom(known6, netutil.IPv6BitLen), </s> remove subnet: &net.IPNet{
IP: net.IP{192, 168, 1, 2},
},
want: net.IP{192, 168, 1, 255},
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
pref: netip.PrefixFrom(known4, netutil.IPv4BitLen),
want: known4, | <mask> name: "ipv6_no_mask",
<mask> }, {
<mask> name: "ipv4_no_mask",
<mask> }, {
<mask> pref: netip.PrefixFrom(netip.IPv4Unspecified(), 0),
<mask> want: fullBroadcast4,
<mask> name: "unspecified",
</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: "ipv6_no_mask",
subnet: &net.IPNet{
IP: known6,
},
</s> add pref: netip.PrefixFrom(known4, 20),
want: netip.MustParseAddr("192.168.15.255"),
name: "full",
}, {
pref: netip.PrefixFrom(known6, netutil.IPv6BitLen), </s> remove subnet: &net.IPNet{
IP: net.IP{192, 168, 1, 2},
},
want: net.IP{192, 168, 1, 255},
</s> add | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
<mask> },
<mask> want: known6,
<mask> }, {
<mask> name: "ipv4_no_mask",
<mask> subnet: &net.IPNet{
<mask> IP: net.IP{192, 168, 1, 2},
<mask> },
<mask> want: net.IP{192, 168, 1, 255},
<mask> }, {
<mask> name: "unspecified",
<mask> subnet: &net.IPNet{
<mask> IP: net.IP{0, 0, 0, 0},
<mask> Mask: net.IPMask{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 name: "ipv6_no_mask",
subnet: &net.IPNet{
IP: known6,
},
</s> add pref: netip.PrefixFrom(known4, 20),
want: netip.MustParseAddr("192.168.15.255"),
name: "full",
}, {
pref: netip.PrefixFrom(known6, netutil.IPv6BitLen), </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 subnet: &net.IPNet{
IP: net.IP{192, 168, 0, 1},
Mask: net.IPMask{255, 255, 15, 0},
},
want: net.IP{192, 168, 240, 255},
</s> add </s> remove name string
subnet *net.IPNet
want net.IP
</s> add pref netip.Prefix
want netip.Addr
name string </s> remove name: "err_runcmd",
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
|
pref: netip.PrefixFrom(netip.IPv4Unspecified(), 0),
want: fullBroadcast4, | <mask> want: known4,
<mask> name: "ipv4_no_mask",
<mask> }, {
<mask> name: "unspecified",
<mask> }, {
<mask> pref: netip.Prefix{},
<mask> want: netip.Addr{},
<mask> name: "invalid",
</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 name: "ipv6_no_mask",
subnet: &net.IPNet{
IP: known6,
},
</s> add pref: netip.PrefixFrom(known4, 20),
want: netip.MustParseAddr("192.168.15.255"),
name: "full",
}, {
pref: netip.PrefixFrom(known6, netutil.IPv6BitLen), </s> remove subnet: &net.IPNet{
IP: net.IP{192, 168, 1, 2},
},
want: net.IP{192, 168, 1, 255},
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
}, {
pref: netip.Prefix{},
want: netip.Addr{},
name: "invalid", | <mask> },
<mask> want: net.IP{192, 168, 1, 255},
<mask> }, {
<mask> name: "unspecified",
<mask> subnet: &net.IPNet{
<mask> IP: net.IP{0, 0, 0, 0},
<mask> Mask: net.IPMask{0, 0, 0, 0},
<mask> },
<mask> want: net.IPv4bcast,
<mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> bc := BroadcastFromIPNet(tc.subnet)
</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{192, 168, 1, 2},
},
want: net.IP{192, 168, 1, 255},
</s> add </s> remove subnet: &net.IPNet{
IP: net.IP{192, 168, 0, 1},
Mask: net.IPMask{255, 255, 15, 0},
},
want: net.IP{192, 168, 240, 255},
</s> add </s> remove name: "ipv6_no_mask",
subnet: &net.IPNet{
IP: known6,
},
</s> add pref: netip.PrefixFrom(known4, 20),
want: netip.MustParseAddr("192.168.15.255"),
name: "full",
}, {
pref: netip.PrefixFrom(known6, netutil.IPv6BitLen), </s> remove want: nil,
</s> add want: netip.Addr{},
name: "bad_code", </s> remove name: "bad_code",
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
assert.Equal(t, tc.want, BroadcastFromPref(tc.pref)) | <mask> }}
<mask>
<mask> for _, tc := range testCases {
<mask> t.Run(tc.name, func(t *testing.T) {
<mask> bc := BroadcastFromIPNet(tc.subnet)
<mask> assert.True(t, bc.Equal(tc.want), bc)
<mask> })
<mask> }
<mask> }
<mask>
<mask> func TestCheckPort(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 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 // Just to avoid nil pointer dereference.
subnet: &net.IPNet{},
</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/aghnet/net_test.go |
laddr := netip.AddrPortFrom(IPv4Localhost(), 0)
| <mask> }
<mask> }
<mask>
<mask> func TestCheckPort(t *testing.T) {
<mask> t.Run("tcp_bound", func(t *testing.T) {
<mask> l, err := net.Listen("tcp", laddr.String())
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, l.Close)
</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 l, err := net.Listen("tcp", "127.0.0.1:")
</s> add l, err := net.Listen("tcp", laddr.String()) </s> remove conn, err := net.ListenPacket("udp", "127.0.0.1:")
</s> add conn, err := net.ListenPacket("udp", laddr.String()) </s> remove ipp := netutil.IPPortFromAddr(l.Addr())
require.NotNil(t, ipp)
require.NotNil(t, ipp.IP)
require.NotZero(t, ipp.Port)
</s> add addr := l.Addr()
require.IsType(t, new(net.TCPAddr), addr)
ipp := addr.(*net.TCPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) </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 err := CheckPort("udp", net.IP{0, 0, 0, 0}, 0)
</s> add err := CheckPort("udp", netip.AddrPortFrom(netip.IPv4Unspecified(), 0)) | [
"keep",
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
l, err := net.Listen("tcp", laddr.String()) | <mask> }
<mask>
<mask> func TestCheckPort(t *testing.T) {
<mask> t.Run("tcp_bound", func(t *testing.T) {
<mask> l, err := net.Listen("tcp", "127.0.0.1:")
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, l.Close)
<mask>
<mask> ipp := netutil.IPPortFromAddr(l.Addr())
<mask> require.NotNil(t, ipp)
</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 ipp := netutil.IPPortFromAddr(l.Addr())
require.NotNil(t, ipp)
require.NotNil(t, ipp.IP)
require.NotZero(t, ipp.Port)
</s> add addr := l.Addr()
require.IsType(t, new(net.TCPAddr), addr)
ipp := addr.(*net.TCPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) </s> remove conn, err := net.ListenPacket("udp", "127.0.0.1:")
</s> add conn, err := net.ListenPacket("udp", laddr.String()) </s> remove ipp := netutil.IPPortFromAddr(conn.LocalAddr())
require.NotNil(t, ipp)
require.NotNil(t, ipp.IP)
require.NotZero(t, ipp.Port)
</s> add addr := conn.LocalAddr()
require.IsType(t, new(net.UDPAddr), addr)
ipp := addr.(*net.UDPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) </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",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
addr := l.Addr()
require.IsType(t, new(net.TCPAddr), addr)
ipp := addr.(*net.TCPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) | <mask> l, err := net.Listen("tcp", "127.0.0.1:")
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, l.Close)
<mask>
<mask> ipp := netutil.IPPortFromAddr(l.Addr())
<mask> require.NotNil(t, ipp)
<mask> require.NotNil(t, ipp.IP)
<mask> require.NotZero(t, ipp.Port)
<mask>
<mask> err = CheckPort("tcp", ipp.IP, ipp.Port)
<mask> target := &net.OpError{}
<mask> require.ErrorAs(t, err, &target)
<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 = CheckPort("tcp", ipp.IP, ipp.Port)
</s> add err = CheckPort("tcp", ipp) </s> remove ipp := netutil.IPPortFromAddr(conn.LocalAddr())
require.NotNil(t, ipp)
require.NotNil(t, ipp.IP)
require.NotZero(t, ipp.Port)
</s> add addr := conn.LocalAddr()
require.IsType(t, new(net.UDPAddr), addr)
ipp := addr.(*net.UDPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) </s> remove err = CheckPort("udp", ipp.IP, ipp.Port)
</s> add err = CheckPort("udp", ipp) </s> remove l, err := net.Listen("tcp", "127.0.0.1:")
</s> add l, err := net.Listen("tcp", laddr.String()) </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",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
err = CheckPort("tcp", ipp) | <mask> require.NotNil(t, ipp)
<mask> require.NotNil(t, ipp.IP)
<mask> require.NotZero(t, ipp.Port)
<mask>
<mask> err = CheckPort("tcp", ipp.IP, ipp.Port)
<mask> target := &net.OpError{}
<mask> require.ErrorAs(t, err, &target)
<mask>
<mask> assert.Equal(t, "listen", target.Op)
<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 = CheckPort("udp", ipp.IP, ipp.Port)
</s> add err = CheckPort("udp", ipp) </s> remove ipp := netutil.IPPortFromAddr(l.Addr())
require.NotNil(t, ipp)
require.NotNil(t, ipp.IP)
require.NotZero(t, ipp.Port)
</s> add addr := l.Addr()
require.IsType(t, new(net.TCPAddr), addr)
ipp := addr.(*net.TCPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) </s> remove ipp := netutil.IPPortFromAddr(conn.LocalAddr())
require.NotNil(t, ipp)
require.NotNil(t, ipp.IP)
require.NotZero(t, ipp.Port)
</s> add addr := conn.LocalAddr()
require.IsType(t, new(net.UDPAddr), addr)
ipp := addr.(*net.UDPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) </s> remove conn, err := net.ListenPacket("udp", "127.0.0.1:")
</s> add conn, err := net.ListenPacket("udp", laddr.String()) </s> remove err := CheckPort("bad_network", nil, 0)
</s> add err := CheckPort("bad_network", netip.AddrPortFrom(netip.Addr{}, 0)) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
conn, err := net.ListenPacket("udp", laddr.String()) | <mask> assert.Equal(t, "listen", target.Op)
<mask> })
<mask>
<mask> t.Run("udp_bound", func(t *testing.T) {
<mask> conn, err := net.ListenPacket("udp", "127.0.0.1:")
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, conn.Close)
<mask>
<mask> ipp := netutil.IPPortFromAddr(conn.LocalAddr())
<mask> require.NotNil(t, ipp)
</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 ipp := netutil.IPPortFromAddr(conn.LocalAddr())
require.NotNil(t, ipp)
require.NotNil(t, ipp.IP)
require.NotZero(t, ipp.Port)
</s> add addr := conn.LocalAddr()
require.IsType(t, new(net.UDPAddr), addr)
ipp := addr.(*net.UDPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) </s> remove l, err := net.Listen("tcp", "127.0.0.1:")
</s> add l, err := net.Listen("tcp", laddr.String()) </s> remove err = CheckPort("udp", ipp.IP, ipp.Port)
</s> add err = CheckPort("udp", ipp) </s> remove err = CheckPort("tcp", ipp.IP, ipp.Port)
</s> add err = CheckPort("tcp", ipp) </s> remove err := CheckPort("bad_network", nil, 0)
</s> add err := CheckPort("bad_network", netip.AddrPortFrom(netip.Addr{}, 0)) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
addr := conn.LocalAddr()
require.IsType(t, new(net.UDPAddr), addr)
ipp := addr.(*net.UDPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) | <mask> conn, err := net.ListenPacket("udp", "127.0.0.1:")
<mask> require.NoError(t, err)
<mask> testutil.CleanupAndRequireSuccess(t, conn.Close)
<mask>
<mask> ipp := netutil.IPPortFromAddr(conn.LocalAddr())
<mask> require.NotNil(t, ipp)
<mask> require.NotNil(t, ipp.IP)
<mask> require.NotZero(t, ipp.Port)
<mask>
<mask> err = CheckPort("udp", ipp.IP, ipp.Port)
<mask> target := &net.OpError{}
<mask> require.ErrorAs(t, err, &target)
<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 = CheckPort("udp", ipp.IP, ipp.Port)
</s> add err = CheckPort("udp", ipp) </s> remove ipp := netutil.IPPortFromAddr(l.Addr())
require.NotNil(t, ipp)
require.NotNil(t, ipp.IP)
require.NotZero(t, ipp.Port)
</s> add addr := l.Addr()
require.IsType(t, new(net.TCPAddr), addr)
ipp := addr.(*net.TCPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) </s> remove err = CheckPort("tcp", ipp.IP, ipp.Port)
</s> add err = CheckPort("tcp", ipp) </s> remove conn, err := net.ListenPacket("udp", "127.0.0.1:")
</s> add conn, err := net.ListenPacket("udp", laddr.String()) </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",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
err = CheckPort("udp", ipp) | <mask> require.NotNil(t, ipp)
<mask> require.NotNil(t, ipp.IP)
<mask> require.NotZero(t, ipp.Port)
<mask>
<mask> err = CheckPort("udp", ipp.IP, ipp.Port)
<mask> target := &net.OpError{}
<mask> require.ErrorAs(t, err, &target)
<mask>
<mask> assert.Equal(t, "listen", target.Op)
<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 = CheckPort("tcp", ipp.IP, ipp.Port)
</s> add err = CheckPort("tcp", ipp) </s> remove ipp := netutil.IPPortFromAddr(conn.LocalAddr())
require.NotNil(t, ipp)
require.NotNil(t, ipp.IP)
require.NotZero(t, ipp.Port)
</s> add addr := conn.LocalAddr()
require.IsType(t, new(net.UDPAddr), addr)
ipp := addr.(*net.UDPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) </s> remove ipp := netutil.IPPortFromAddr(l.Addr())
require.NotNil(t, ipp)
require.NotNil(t, ipp.IP)
require.NotZero(t, ipp.Port)
</s> add addr := l.Addr()
require.IsType(t, new(net.TCPAddr), addr)
ipp := addr.(*net.TCPAddr).AddrPort()
require.Equal(t, laddr.Addr(), ipp.Addr())
require.NotZero(t, ipp.Port()) </s> remove conn, err := net.ListenPacket("udp", "127.0.0.1:")
</s> add conn, err := net.ListenPacket("udp", laddr.String()) </s> remove err := CheckPort("bad_network", nil, 0)
</s> add err := CheckPort("bad_network", netip.AddrPortFrom(netip.Addr{}, 0)) | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
err := CheckPort("bad_network", netip.AddrPortFrom(netip.Addr{}, 0)) | <mask> assert.Equal(t, "listen", target.Op)
<mask> })
<mask>
<mask> t.Run("bad_network", func(t *testing.T) {
<mask> err := CheckPort("bad_network", nil, 0)
<mask> assert.NoError(t, err)
<mask> })
<mask>
<mask> t.Run("can_bind", func(t *testing.T) {
<mask> err := CheckPort("udp", net.IP{0, 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 err := CheckPort("udp", net.IP{0, 0, 0, 0}, 0)
</s> add err := CheckPort("udp", netip.AddrPortFrom(netip.IPv4Unspecified(), 0)) </s> remove conn, err := net.ListenPacket("udp", "127.0.0.1:")
</s> add conn, err := net.ListenPacket("udp", laddr.String()) </s> remove err = CheckPort("udp", ipp.IP, ipp.Port)
</s> add err = CheckPort("udp", ipp) </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/aghnet/net_test.go |
err := CheckPort("udp", netip.AddrPortFrom(netip.IPv4Unspecified(), 0)) | <mask> assert.NoError(t, err)
<mask> })
<mask>
<mask> t.Run("can_bind", func(t *testing.T) {
<mask> err := CheckPort("udp", net.IP{0, 0, 0, 0}, 0)
<mask> assert.NoError(t, err)
<mask> })
<mask> }
<mask>
<mask> func TestCollectAllIfacesAddrs(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 err := CheckPort("bad_network", nil, 0)
</s> add err := CheckPort("bad_network", netip.AddrPortFrom(netip.Addr{}, 0)) </s> remove IP: anotherIP,
</s> add IP: anotherIP.AsSlice(), </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 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/aghnet/net_test.go |
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) | <mask> `"name":"iface0",` +
<mask> `"mtu":1500` +
<mask> `}` + "\n"
<mask>
<mask> 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}
<mask> mask4, mask6 := net.CIDRMask(24, netutil.IPv4BitLen), net.CIDRMask(8, netutil.IPv6BitLen)
<mask>
<mask> iface := &NetInterface{
<mask> Addresses: []net.IP{ip4, ip6},
<mask> Subnets: []*net.IPNet{{
<mask> IP: ip4.Mask(mask4),
</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 Addresses: []net.IP{ip4, ip6},
Subnets: []*net.IPNet{{
IP: ip4.Mask(mask4),
Mask: mask4,
}, {
IP: ip6.Mask(mask6),
Mask: mask6,
}},
</s> add Addresses: []netip.Addr{ip4, ip6},
Subnets: []netip.Prefix{net4, net6}, </s> remove subnet: &net.IPNet{
IP: net.IP{192, 168, 1, 2},
},
want: net.IP{192, 168, 1, 255},
</s> add </s> remove BindHost: net.IP{0, 0, 0, 0},
</s> add BindHost: netip.IPv4Unspecified(), </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 name: "success_v4",
</s> add | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
Addresses: []netip.Addr{ip4, ip6},
Subnets: []netip.Prefix{net4, net6}, | <mask> 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}
<mask> mask4, mask6 := net.CIDRMask(24, netutil.IPv4BitLen), net.CIDRMask(8, netutil.IPv6BitLen)
<mask>
<mask> iface := &NetInterface{
<mask> Addresses: []net.IP{ip4, ip6},
<mask> Subnets: []*net.IPNet{{
<mask> IP: ip4.Mask(mask4),
<mask> Mask: mask4,
<mask> }, {
<mask> IP: ip6.Mask(mask6),
<mask> Mask: mask6,
<mask> }},
<mask> Name: "iface0",
<mask> HardwareAddr: net.HardwareAddr{0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF},
<mask> Flags: net.FlagUp | net.FlagMulticast,
<mask> MTU: 1500,
<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 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 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 name: "success_v4",
</s> add </s> remove BindHost: net.IP{0, 0, 0, 0},
</s> add BindHost: netip.IPv4Unspecified(), | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/aghnet/net_test.go |
"net/netip" | <mask> import (
<mask> "fmt"
<mask> "net"
<mask> "time"
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
<mask> "github.com/AdguardTeam/golibs/errors"
<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 </s> remove "net"
</s> add "net/netip" </s> remove "net"
</s> add | [
"keep",
"keep",
"add",
"keep",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
<mask>
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
<mask> "github.com/AdguardTeam/AdGuardHome/internal/aghnet"
<mask> "github.com/AdguardTeam/golibs/errors"
<mask> "github.com/AdguardTeam/golibs/netutil"
<mask> )
<mask>
<mask> // ServerConfig is the configuration for the DHCP server. The order of YAML
<mask> // fields is important, since the YAML configuration file follows it.
<mask> type ServerConfig struct {
</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 // migration.
</s> add // migration. Also keep the blocked services in mind. </s> remove "github.com/AdguardTeam/golibs/netutil"
</s> add </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/config.go |
|
GatewayIP netip.Addr `yaml:"gateway_ip" json:"gateway_ip"`
SubnetMask netip.Addr `yaml:"subnet_mask" json:"subnet_mask"` | <mask> type V4ServerConf struct {
<mask> Enabled bool `yaml:"-" json:"-"`
<mask> InterfaceName string `yaml:"-" json:"-"`
<mask>
<mask> GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"`
<mask> SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"`
<mask> // broadcastIP is the broadcasting address pre-calculated from the
<mask> // configured gateway IP and subnet mask.
<mask> broadcastIP net.IP
<mask>
<mask> // The first & the last IP address for dynamic leases
</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 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 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"` | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
broadcastIP netip.Addr | <mask> GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"`
<mask> SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"`
<mask> // broadcastIP is the broadcasting address pre-calculated from the
<mask> // configured gateway IP and subnet mask.
<mask> broadcastIP net.IP
<mask>
<mask> // The first & the last IP address for dynamic leases
<mask> // Bytes [0..2] of the last allowed IP address must match the first IP
<mask> RangeStart net.IP `yaml:"range_start" json:"range_start"`
<mask> RangeEnd net.IP `yaml:"range_end" json:"range_end"`
</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 `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 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 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 subnet *net.IPNet
</s> add subnet netip.Prefix </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/dhcpd/config.go |
RangeStart netip.Addr `yaml:"range_start" json:"range_start"`
RangeEnd netip.Addr `yaml:"range_end" json:"range_end"` | <mask> broadcastIP net.IP
<mask>
<mask> // The first & the last IP address for dynamic leases
<mask> // Bytes [0..2] of the last allowed IP address must match the first IP
<mask> RangeStart net.IP `yaml:"range_start" json:"range_start"`
<mask> RangeEnd net.IP `yaml:"range_end" json:"range_end"`
<mask>
<mask> LeaseDuration uint32 `yaml:"lease_duration" json:"lease_duration"` // in seconds
<mask>
<mask> // IP conflict detector: time (ms) to wait for ICMP reply
<mask> // 0: disable
</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 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 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 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",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
dnsIPAddrs []netip.Addr // IPv4 addresses to return to DHCP clients as DNS server addresses | <mask>
<mask> ipRange *ipRange
<mask>
<mask> leaseTime time.Duration // the time during which a dynamic lease is considered valid
<mask> dnsIPAddrs []net.IP // IPv4 addresses to return to DHCP clients as DNS server addresses
<mask>
<mask> // subnet contains the DHCP server's subnet. The IP is the IP of the
<mask> // gateway.
<mask> subnet *net.IPNet
<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 subnet *net.IPNet
</s> add subnet netip.Prefix </s> remove if !s.conf.subnet.Contains(reqIP) {
</s> add if !s.conf.subnet.Contains(netip.AddrFrom4(*(*[4]byte)(ip4))) { </s> remove broadcastIP net.IP
</s> add broadcastIP netip.Addr </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 var subnet *net.IPNet
</s> add var subnet netip.Prefix | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
subnet netip.Prefix | <mask> dnsIPAddrs []net.IP // IPv4 addresses to return to DHCP clients as DNS server addresses
<mask>
<mask> // subnet contains the DHCP server's subnet. The IP is the IP of the
<mask> // gateway.
<mask> subnet *net.IPNet
<mask>
<mask> // notify is a way to signal to other components that leases have been
<mask> // changed. notify must be called outside of locked sections, since the
<mask> // clients might want to get the new data.
<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 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 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 if !s.conf.subnet.Contains(reqIP) {
</s> add if !s.conf.subnet.Contains(netip.AddrFrom4(*(*[4]byte)(ip4))) { </s> remove broadcastIP net.IP
</s> add broadcastIP netip.Addr </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"` | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
// 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) | <mask>
<mask> // errNilConfig is an error returned by validation method if the config is nil.
<mask> const errNilConfig errors.Error = "nil config"
<mask>
<mask> // ensureV4 returns a 4-byte version of ip. An error is returned if the passed
<mask> // ip is not an IPv4.
<mask> func ensureV4(ip net.IP) (ip4 net.IP, err error) {
<mask> if ip == nil {
<mask> return nil, fmt.Errorf("%v is not an IP address", ip)
<mask> }
<mask>
<mask> ip4 = ip.To4()
<mask> if ip4 == nil {
<mask> return nil, fmt.Errorf("%v is not an IPv4 address", ip)
<mask> }
<mask>
<mask> return ip4, nil
<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 var gatewayIP net.IP
gatewayIP, err = ensureV4(c.GatewayIP)
</s> add gatewayIP, err := ensureV4(c.GatewayIP, "address") </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 if c.SubnetMask == nil {
return fmt.Errorf("invalid subnet mask: %v", c.SubnetMask)
</s> add subnetMask, err := ensureV4(c.SubnetMask, "subnet mask")
if err != nil {
// Don't wrap an errors since it's informative enough as is and there is
// an annotation deferred already.
return err | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
gatewayIP, err := ensureV4(c.GatewayIP, "address") | <mask> if c == nil {
<mask> return errNilConfig
<mask> }
<mask>
<mask> var gatewayIP net.IP
<mask> gatewayIP, err = ensureV4(c.GatewayIP)
<mask> if err != nil {
<mask> // Don't wrap an errors since it's inforative enough as is and there is
<mask> // an annotation deferred already.
<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 // 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 c.broadcastIP = aghnet.BroadcastFromIPNet(c.subnet)
</s> add </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 if c.SubnetMask == nil {
return fmt.Errorf("invalid subnet mask: %v", c.SubnetMask)
</s> add subnetMask, err := ensureV4(c.SubnetMask, "subnet mask")
if err != nil {
// Don't wrap an errors since it's informative enough as is and there is
// an annotation deferred already.
return err | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
// Don't wrap an errors since it's informative enough as is and there is | <mask>
<mask> var gatewayIP net.IP
<mask> gatewayIP, err = ensureV4(c.GatewayIP)
<mask> if err != nil {
<mask> // Don't wrap an errors since it's inforative enough as is and there is
<mask> // an annotation deferred already.
<mask> return err
<mask> }
<mask>
<mask> if c.SubnetMask == nil {
</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 // 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 </s> remove if c.SubnetMask == nil {
return fmt.Errorf("invalid subnet mask: %v", c.SubnetMask)
</s> add subnetMask, err := ensureV4(c.SubnetMask, "subnet mask")
if err != nil {
// Don't wrap an errors since it's informative enough as is and there is
// an annotation deferred already.
return err | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
subnetMask, err := ensureV4(c.SubnetMask, "subnet mask")
if err != nil {
// Don't wrap an errors since it's informative enough as is and there is
// an annotation deferred already.
return err | <mask> // an annotation deferred already.
<mask> return err
<mask> }
<mask>
<mask> if c.SubnetMask == nil {
<mask> return fmt.Errorf("invalid subnet mask: %v", c.SubnetMask)
<mask> }
<mask>
<mask> subnetMask := net.IPMask(netutil.CloneIP(c.SubnetMask.To4()))
<mask> c.subnet = &net.IPNet{
<mask> IP: gatewayIP,
</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 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 </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 var gatewayIP net.IP
gatewayIP, err = ensureV4(c.GatewayIP)
</s> add gatewayIP, err := ensureV4(c.GatewayIP, "address") </s> remove if c.ipRange.contains(gatewayIP) {
</s> add if c.ipRange.contains(gatewayIP.AsSlice()) { | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
maskLen, _ := net.IPMask(subnetMask.AsSlice()).Size()
c.subnet = netip.PrefixFrom(gatewayIP, maskLen)
c.broadcastIP = aghnet.BroadcastFromPref(c.subnet) | <mask> return err
<mask> }
<mask>
<mask> rangeStart, err := ensureV4(c.RangeStart, "address")
<mask> if err != nil {
<mask> // Don't wrap an errors since it's informative enough as is and there is
</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 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 // 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 var gatewayIP net.IP
gatewayIP, err = ensureV4(c.GatewayIP)
</s> add gatewayIP, err := ensureV4(c.GatewayIP, "address") </s> remove c.ipRange, err = newIPRange(c.RangeStart, c.RangeEnd)
</s> add c.ipRange, err = newIPRange(rangeStart.AsSlice(), rangeEnd.AsSlice()) | [
"keep",
"add",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
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 | <mask> if c.SubnetMask == nil {
<mask> return fmt.Errorf("invalid subnet mask: %v", c.SubnetMask)
<mask> }
<mask>
<mask> subnetMask := net.IPMask(netutil.CloneIP(c.SubnetMask.To4()))
<mask> c.subnet = &net.IPNet{
<mask> IP: gatewayIP,
<mask> Mask: subnetMask,
<mask> }
<mask> c.broadcastIP = aghnet.BroadcastFromIPNet(c.subnet)
<mask>
<mask> c.ipRange, err = newIPRange(c.RangeStart, c.RangeEnd)
<mask> if err != nil {
</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 c.SubnetMask == nil {
return fmt.Errorf("invalid subnet mask: %v", c.SubnetMask)
</s> add subnetMask, err := ensureV4(c.SubnetMask, "subnet mask")
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 </s> remove c.ipRange, err = newIPRange(c.RangeStart, c.RangeEnd)
</s> add c.ipRange, err = newIPRange(rangeStart.AsSlice(), rangeEnd.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 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"replace",
"replace",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
<mask> c.subnet = &net.IPNet{
<mask> IP: gatewayIP,
<mask> Mask: subnetMask,
<mask> }
<mask> c.broadcastIP = aghnet.BroadcastFromIPNet(c.subnet)
<mask>
<mask> c.ipRange, err = newIPRange(c.RangeStart, c.RangeEnd)
<mask> if err != nil {
<mask> // Don't wrap an errors since it's inforative enough as is and there is
<mask> // an annotation deferred already.
</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 c.ipRange, err = newIPRange(c.RangeStart, c.RangeEnd)
</s> add c.ipRange, err = newIPRange(rangeStart.AsSlice(), rangeEnd.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 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 // 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 if c.SubnetMask == nil {
return fmt.Errorf("invalid subnet mask: %v", c.SubnetMask)
</s> add subnetMask, err := ensureV4(c.SubnetMask, "subnet mask")
if err != nil {
// Don't wrap an errors since it's informative enough as is and there is
// an annotation deferred already.
return err | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
|
c.ipRange, err = newIPRange(rangeStart.AsSlice(), rangeEnd.AsSlice()) | <mask> Mask: subnetMask,
<mask> }
<mask> c.broadcastIP = aghnet.BroadcastFromIPNet(c.subnet)
<mask>
<mask> c.ipRange, err = newIPRange(c.RangeStart, c.RangeEnd)
<mask> if err != nil {
<mask> // Don't wrap an errors since it's inforative enough as is and there is
<mask> // an annotation deferred already.
<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 c.broadcastIP = aghnet.BroadcastFromIPNet(c.subnet)
</s> add </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 // 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 var gatewayIP net.IP
gatewayIP, err = ensureV4(c.GatewayIP)
</s> add gatewayIP, err := ensureV4(c.GatewayIP, "address") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
// Don't wrap an errors since it's informative enough as is and there is | <mask> c.broadcastIP = aghnet.BroadcastFromIPNet(c.subnet)
<mask>
<mask> c.ipRange, err = newIPRange(c.RangeStart, c.RangeEnd)
<mask> if err != nil {
<mask> // Don't wrap an errors since it's inforative enough as is and there is
<mask> // an annotation deferred already.
<mask> return err
<mask> }
<mask>
<mask> if c.ipRange.contains(gatewayIP) {
</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 c.ipRange, err = newIPRange(c.RangeStart, c.RangeEnd)
</s> add c.ipRange, err = newIPRange(rangeStart.AsSlice(), rangeEnd.AsSlice()) </s> remove c.broadcastIP = aghnet.BroadcastFromIPNet(c.subnet)
</s> add </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 // 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 var gatewayIP net.IP
gatewayIP, err = ensureV4(c.GatewayIP)
</s> add gatewayIP, err := ensureV4(c.GatewayIP, "address") | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
if c.ipRange.contains(gatewayIP.AsSlice()) { | <mask> // an annotation deferred already.
<mask> return err
<mask> }
<mask>
<mask> if c.ipRange.contains(gatewayIP) {
<mask> return fmt.Errorf("gateway ip %v in the ip range: %v-%v",
<mask> gatewayIP,
<mask> c.RangeStart,
<mask> c.RangeEnd,
<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 c.SubnetMask == nil {
return fmt.Errorf("invalid subnet mask: %v", c.SubnetMask)
</s> add subnetMask, err := ensureV4(c.SubnetMask, "subnet mask")
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 if !c.subnet.Contains(c.RangeStart) {
</s> add if !c.subnet.Contains(rangeStart) { </s> remove var gatewayIP net.IP
gatewayIP, err = ensureV4(c.GatewayIP)
</s> add gatewayIP, err := ensureV4(c.GatewayIP, "address") </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 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
if !c.subnet.Contains(rangeStart) { | <mask> c.RangeEnd,
<mask> )
<mask> }
<mask>
<mask> if !c.subnet.Contains(c.RangeStart) {
<mask> return fmt.Errorf("range start %v is outside network %v",
<mask> c.RangeStart,
<mask> c.subnet,
<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 !c.subnet.Contains(c.RangeEnd) {
</s> add if !c.subnet.Contains(rangeEnd) { </s> remove if c.ipRange.contains(gatewayIP) {
</s> add if c.ipRange.contains(gatewayIP.AsSlice()) { </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 | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
if !c.subnet.Contains(rangeEnd) { | <mask> c.subnet,
<mask> )
<mask> }
<mask>
<mask> if !c.subnet.Contains(c.RangeEnd) {
<mask> return fmt.Errorf("range end %v is outside network %v",
<mask> c.RangeEnd,
<mask> c.subnet,
<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 !c.subnet.Contains(c.RangeStart) {
</s> add if !c.subnet.Contains(rangeStart) { </s> remove if c.ipRange.contains(gatewayIP) {
</s> add if c.ipRange.contains(gatewayIP.AsSlice()) { </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, 1},
subnetMask: net.IP{255, 255, 255, 224},
</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"), | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/config.go |
bcastIP: s.conf.broadcastIP.AsSlice(), | <mask> }
<mask>
<mask> return &dhcpConn{
<mask> udpConn: bcast,
<mask> bcastIP: s.conf.broadcastIP,
<mask> rawConn: ucast,
<mask> srcMAC: iface.HardwareAddr,
<mask> srcIP: s.conf.dnsIPAddrs[0],
<mask> }, nil
<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 srcIP: s.conf.dnsIPAddrs[0],
</s> add srcIP: s.conf.dnsIPAddrs[0].AsSlice(), </s> remove netIface := &NetInterface{
MTU: iface.MTU,
Name: iface.Name,
HardwareAddr: iface.HardwareAddr,
Flags: iface.Flags,
</s> add ip, ok := netip.AddrFromSlice(n.IP)
if !ok {
return nil, fmt.Errorf("bad address %s", n.IP) </s> remove if o.bindHost == nil {
</s> add if !o.bindHost.IsValid() { </s> remove updateWithValue: func(o options, v string) (options, error) {
o.bindHost = net.ParseIP(v)
return o, nil
</s> add updateWithValue: func(o options, v string) (oo options, err error) {
o.bindHost, err = netip.ParseAddr(v)
return o, 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() | [
"keep",
"keep",
"keep",
"keep",
"replace",
"keep",
"keep",
"keep",
"keep",
"keep"
] | https://github.com/AdguardTeam/AdGuardHome/commit/4582b1c9198dcbc1927b74080839e81ba347265a | internal/dhcpd/conn_unix.go |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.