Files
zeekay 304946e144 refactor: rename ips package to endpoints
Move IP and endpoint types from ips/ to endpoints/ for clearer naming.
This makes the package purpose more obvious and aligns with usage patterns.
2026-02-04 18:25:56 -08:00

45 lines
772 B
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package endpoints
import (
"net/netip"
"testing"
"github.com/stretchr/testify/require"
)
func TestLookup(t *testing.T) {
tests := []struct {
host string
ip netip.Addr
}{
{
host: "127.0.0.1",
ip: netip.AddrFrom4([4]byte{127, 0, 0, 1}),
},
{
host: "localhost",
ip: netip.AddrFrom4([4]byte{127, 0, 0, 1}),
},
{
host: "::",
ip: netip.IPv6Unspecified(),
},
{
host: "0.0.0.0",
ip: netip.IPv4Unspecified(),
},
}
for _, tt := range tests {
t.Run(tt.host, func(t *testing.T) {
require := require.New(t)
ip, err := Lookup(tt.host)
require.NoError(err)
require.Equal(tt.ip, ip)
})
}
}