github.com/MetalBlockchain/metalgo@v1.11.9/network/peer/test_network.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package peer
     5  
     6  import (
     7  	"github.com/MetalBlockchain/metalgo/ids"
     8  	"github.com/MetalBlockchain/metalgo/utils/bloom"
     9  	"github.com/MetalBlockchain/metalgo/utils/ips"
    10  )
    11  
    12  var TestNetwork Network = testNetwork{}
    13  
    14  type testNetwork struct{}
    15  
    16  func (testNetwork) Connected(ids.NodeID) {}
    17  
    18  func (testNetwork) AllowConnection(ids.NodeID) bool {
    19  	return true
    20  }
    21  
    22  func (testNetwork) Track([]*ips.ClaimedIPPort) error {
    23  	return nil
    24  }
    25  
    26  func (testNetwork) Disconnected(ids.NodeID) {}
    27  
    28  func (testNetwork) KnownPeers() ([]byte, []byte) {
    29  	return bloom.EmptyFilter.Marshal(), nil
    30  }
    31  
    32  func (testNetwork) Peers(ids.NodeID, *bloom.ReadFilter, []byte) []*ips.ClaimedIPPort {
    33  	return nil
    34  }