github.com/ava-labs/avalanchego@v1.11.11/network/peer/config.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  	"time"
     8  
     9  	"github.com/ava-labs/avalanchego/ids"
    10  	"github.com/ava-labs/avalanchego/message"
    11  	"github.com/ava-labs/avalanchego/network/throttling"
    12  	"github.com/ava-labs/avalanchego/snow/networking/router"
    13  	"github.com/ava-labs/avalanchego/snow/networking/tracker"
    14  	"github.com/ava-labs/avalanchego/snow/uptime"
    15  	"github.com/ava-labs/avalanchego/snow/validators"
    16  	"github.com/ava-labs/avalanchego/utils/logging"
    17  	"github.com/ava-labs/avalanchego/utils/set"
    18  	"github.com/ava-labs/avalanchego/utils/timer/mockable"
    19  	"github.com/ava-labs/avalanchego/version"
    20  )
    21  
    22  type Config struct {
    23  	// Size, in bytes, of the buffer this peer reads messages into
    24  	ReadBufferSize int
    25  	// Size, in bytes, of the buffer this peer writes messages into
    26  	WriteBufferSize int
    27  	Clock           mockable.Clock
    28  	Metrics         *Metrics
    29  	MessageCreator  message.Creator
    30  
    31  	Log                  logging.Logger
    32  	InboundMsgThrottler  throttling.InboundMsgThrottler
    33  	Network              Network
    34  	Router               router.InboundHandler
    35  	VersionCompatibility version.Compatibility
    36  	MyNodeID             ids.NodeID
    37  	// MySubnets does not include the primary network ID
    38  	MySubnets          set.Set[ids.ID]
    39  	Beacons            validators.Manager
    40  	Validators         validators.Manager
    41  	NetworkID          uint32
    42  	PingFrequency      time.Duration
    43  	PongTimeout        time.Duration
    44  	MaxClockDifference time.Duration
    45  
    46  	SupportedACPs []uint32
    47  	ObjectedACPs  []uint32
    48  
    49  	// Unix time of the last message sent and received respectively
    50  	// Must only be accessed atomically
    51  	LastSent, LastReceived int64
    52  
    53  	// Tracks CPU/disk usage caused by each peer.
    54  	ResourceTracker tracker.ResourceTracker
    55  
    56  	// Calculates uptime of peers
    57  	UptimeCalculator uptime.Calculator
    58  
    59  	// Signs my IP so I can send my signed IP address in the Handshake message
    60  	IPSigner *IPSigner
    61  }