chore: netip.Prefix should not using pointer
This commit is contained in:
@ -51,7 +51,7 @@ func createCachefileStore(options Options) (*Pool, string, error) {
|
||||
func TestPool_Basic(t *testing.T) {
|
||||
ipnet := netip.MustParsePrefix("192.168.0.0/28")
|
||||
pools, tempfile, err := createPools(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 10,
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
@ -79,7 +79,7 @@ func TestPool_Basic(t *testing.T) {
|
||||
func TestPool_BasicV6(t *testing.T) {
|
||||
ipnet := netip.MustParsePrefix("2001:4860:4860::8888/118")
|
||||
pools, tempfile, err := createPools(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 10,
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
@ -107,7 +107,7 @@ func TestPool_BasicV6(t *testing.T) {
|
||||
func TestPool_Case_Insensitive(t *testing.T) {
|
||||
ipnet := netip.MustParsePrefix("192.168.0.1/29")
|
||||
pools, tempfile, err := createPools(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 10,
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
@ -128,7 +128,7 @@ func TestPool_Case_Insensitive(t *testing.T) {
|
||||
func TestPool_CycleUsed(t *testing.T) {
|
||||
ipnet := netip.MustParsePrefix("192.168.0.16/28")
|
||||
pools, tempfile, err := createPools(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 10,
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
@ -152,7 +152,7 @@ func TestPool_Skip(t *testing.T) {
|
||||
tree := trie.New[struct{}]()
|
||||
tree.Insert("example.com", struct{}{})
|
||||
pools, tempfile, err := createPools(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 10,
|
||||
Host: tree,
|
||||
})
|
||||
@ -168,7 +168,7 @@ func TestPool_Skip(t *testing.T) {
|
||||
func TestPool_MaxCacheSize(t *testing.T) {
|
||||
ipnet := netip.MustParsePrefix("192.168.0.1/24")
|
||||
pool, _ := New(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 2,
|
||||
})
|
||||
|
||||
@ -183,7 +183,7 @@ func TestPool_MaxCacheSize(t *testing.T) {
|
||||
func TestPool_DoubleMapping(t *testing.T) {
|
||||
ipnet := netip.MustParsePrefix("192.168.0.1/24")
|
||||
pool, _ := New(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 2,
|
||||
})
|
||||
|
||||
@ -213,7 +213,7 @@ func TestPool_DoubleMapping(t *testing.T) {
|
||||
func TestPool_Clone(t *testing.T) {
|
||||
ipnet := netip.MustParsePrefix("192.168.0.1/24")
|
||||
pool, _ := New(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 2,
|
||||
})
|
||||
|
||||
@ -223,7 +223,7 @@ func TestPool_Clone(t *testing.T) {
|
||||
assert.True(t, last == netip.AddrFrom4([4]byte{192, 168, 0, 5}))
|
||||
|
||||
newPool, _ := New(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 2,
|
||||
})
|
||||
newPool.CloneFrom(pool)
|
||||
@ -236,7 +236,7 @@ func TestPool_Clone(t *testing.T) {
|
||||
func TestPool_Error(t *testing.T) {
|
||||
ipnet := netip.MustParsePrefix("192.168.0.1/31")
|
||||
_, err := New(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 10,
|
||||
})
|
||||
|
||||
@ -246,7 +246,7 @@ func TestPool_Error(t *testing.T) {
|
||||
func TestPool_FlushFileCache(t *testing.T) {
|
||||
ipnet := netip.MustParsePrefix("192.168.0.1/28")
|
||||
pools, tempfile, err := createPools(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 10,
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
@ -278,7 +278,7 @@ func TestPool_FlushFileCache(t *testing.T) {
|
||||
func TestPool_FlushMemoryCache(t *testing.T) {
|
||||
ipnet := netip.MustParsePrefix("192.168.0.1/28")
|
||||
pool, _ := New(Options{
|
||||
IPNet: &ipnet,
|
||||
IPNet: ipnet,
|
||||
Size: 10,
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user