mirror of
https://github.com/btcsuite/btcd.git
synced 2026-08-13 12:32:51 +02:00
In this commit, we introduce a server-wide admission policy for incomplete inbound handshakes and the CPU-bound portion of v2 responder setup. Source accounting uses normalized IPv4 and IPv6 prefixes, while global, per-source, and concurrent v2 budgets remain independent and bounded. Peer construction passes the policy through a small interface only for inbound v2 responders. Handshake slots release on verack or disconnect, and the connection manager reserves MaxPeers capacity for automatic outbound peers.
26 lines
634 B
Go
26 lines
634 B
Go
// Copyright (c) 2026 The btcsuite developers
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package inbound
|
|
|
|
import "github.com/btcsuite/btclog"
|
|
|
|
// log is initialized with no output filters. This means the package will not
|
|
// perform any logging until the caller requests it.
|
|
var log btclog.Logger
|
|
|
|
// The default amount of logging is none.
|
|
func init() {
|
|
DisableLog()
|
|
}
|
|
|
|
// DisableLog disables all package log output.
|
|
func DisableLog() {
|
|
log = btclog.Disabled
|
|
}
|
|
|
|
// UseLogger uses the specified logger for package output.
|
|
func UseLogger(logger btclog.Logger) {
|
|
log = logger
|
|
}
|