Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: deprecate the netipx package #53

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ go 1.23.3

require (
github.com/miekg/dns v1.1.62
github.com/rbmk-project/common v0.6.0
github.com/rbmk-project/common v0.7.0
github.com/rbmk-project/dnscore v0.6.0
github.com/rogpeppe/go-internal v1.13.1
github.com/stretchr/testify v1.9.0
golang.org/x/sys v0.27.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/tools v0.27.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ=
github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rbmk-project/common v0.6.0 h1:Pps0IpDQZZP+IL+I/H4gYWgSydcdfzZtD8yjZ86GCok=
github.com/rbmk-project/common v0.6.0/go.mod h1:c/0GCHXVdVjPPLpl54+ZDf5EAFD0OZZ2q4+CbZ1yOQo=
github.com/rbmk-project/common v0.7.0 h1:66zdXL5PC6otXx4PwNpZHmBri+db5gSnKWhaPZHl3PE=
github.com/rbmk-project/common v0.7.0/go.mod h1:BsIum8cGFuNxktk3yWVGlr2B18wtyzn3evb3nhvGyig=
github.com/rbmk-project/dnscore v0.6.0 h1:23rRsLBwTkQqJQMVPf4kimzGSZsw29EY7u3ffHbWkKg=
github.com/rbmk-project/dnscore v0.6.0/go.mod h1:Ct9RhR8HTI6tnq6/HSbzB/F8bk3k7E/6hmEctxSecUQ=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
Expand All @@ -24,7 +24,5 @@ golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
28 changes: 5 additions & 23 deletions netipx/netipx.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
// SPDX-License-Identifier: GPL-3.0-or-later

// Package netipx contains [net/netip] extensions.
//
// Deprecated: use github.com/rbmk-project/common/netipx instead.
package netipx

import (
"net"
"net/netip"
)
import "github.com/rbmk-project/common/netipx"

// AddrToAddrPort converts a [net.Addr] to a [netip.AddrPort].
//
// If the input is nil or neither a [*net.TCPAddr] nor [*net.UDPAddr],
// returns an unspecified IPv6 address with port 0.
//
// For [*net.TCPAddr] and [*net.UDPAddr] addresses, returns their
// corresponding [netip.AddrPort] representation.
func AddrToAddrPort(addr net.Addr) netip.AddrPort {
if addr == nil {
return netip.AddrPortFrom(netip.IPv6Unspecified(), 0)
}
if tcp, ok := addr.(*net.TCPAddr); ok {
return tcp.AddrPort()
}
if udp, ok := addr.(*net.UDPAddr); ok {
return udp.AddrPort()
}
return netip.AddrPortFrom(netip.IPv6Unspecified(), 0)
}
// AddrToAddrPort is an alias for [netipx.AddrToAddrPort].
var AddrToAddrPort = netipx.AddrToAddrPort
57 changes: 0 additions & 57 deletions netipx/netipx_test.go

This file was deleted.