Documentation
¶
Overview ¶
Package sitehttp holds the HTTP/2 settings and the anonymous-connection limit shared by HTTPS listeners. The settings are part of what a scanner can measure, so all HTTP/2 sites must answer alike: change them here, never in one caller. The reusable limiter applies the same source grouping and eviction rule to TCP and QUIC connections.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureSiteHTTP2 ¶
ConfigureSiteHTTP2 keeps the standard Go HTTP/2 settings and raises only connection receive credit. It also bounds the anonymous connections of the site: past the limit the oldest connection of the busiest source is closed to make room, so a new connection (a client's, for one) is always taken in and a flood only evicts itself first.
It must run before the server serves. Handlers reach the connection of a request with Conn, and call MarkAuthenticated once the peer has proven itself.
Types ¶
type AnonymousLimiter ¶
type AnonymousLimiter struct {
// contains filtered or unexported fields
}
AnonymousLimiter bounds connections that have not yet authenticated. Keys must be comparable and stable for the life of a connection. An authenticated key is removed from the set permanently until Remove is called when the connection ends. Add closes evicted connections after releasing the limiter lock.
func NewAnonymousLimiter ¶
func NewAnonymousLimiter() *AnonymousLimiter
NewAnonymousLimiter creates an empty limiter with the site-wide limits and eviction order.
func (*AnonymousLimiter) Add ¶
func (l *AnonymousLimiter) Add(key any, addr net.Addr, closeConn func())
Add records a new anonymous connection. It closes the oldest connection of the busiest source when the total limit is full, and closes a source's oldest connection when that source exceeds its own limit.
func (*AnonymousLimiter) Crowded ¶
func (l *AnonymousLimiter) Crowded() bool
Crowded reports that the anonymous set is at least half full: the site is being scanned or flooded.
func (*AnonymousLimiter) MarkAuthenticated ¶
func (l *AnonymousLimiter) MarkAuthenticated(key any)
MarkAuthenticated removes key from the anonymous set and keeps it out until Remove observes the connection closing.
func (*AnonymousLimiter) Remove ¶
func (l *AnonymousLimiter) Remove(key any)
Remove forgets a connection after it closes.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package sitehttptest checks that an HTTPS site of the node speaks HTTP/2 like every other one.
|
Package sitehttptest checks that an HTTPS site of the node speaks HTTP/2 like every other one. |