chore(routing): unexport IPIsPrivate as ipIsPrivate
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/qdm12/gluetun/internal/netlink"
|
||||
)
|
||||
|
||||
func IPIsPrivate(ip netip.Addr) bool {
|
||||
func ipIsPrivate(ip netip.Addr) bool {
|
||||
return ip.IsPrivate() || ip.IsLoopback() ||
|
||||
ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast()
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_IPIsPrivate(t *testing.T) {
|
||||
func Test_ipIsPrivate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := map[string]struct {
|
||||
@@ -90,7 +90,7 @@ func Test_IPIsPrivate(t *testing.T) {
|
||||
ip, err := netip.ParseAddr(testCase.ipString)
|
||||
require.NoError(t, err)
|
||||
|
||||
isPrivate := IPIsPrivate(ip)
|
||||
isPrivate := ipIsPrivate(ip)
|
||||
|
||||
assert.Equal(t, testCase.isPrivate, isPrivate)
|
||||
})
|
||||
|
||||
@@ -33,7 +33,7 @@ func (r *Routing) VPNDestinationIP() (ip netip.Addr, err error) {
|
||||
for _, route := range routes {
|
||||
if route.LinkIndex == defaultLinkIndex &&
|
||||
route.Dst.IsValid() &&
|
||||
!IPIsPrivate(route.Dst.Addr()) &&
|
||||
!ipIsPrivate(route.Dst.Addr()) &&
|
||||
route.Dst.IsSingleIP() {
|
||||
return route.Dst.Addr(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user