Documentation ¶
Overview ¶
Package connlimiter describes a limiter of the number of active stream-connections.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Stop is the point at which the limiter stops accepting new connections. // Once the number of active connections reaches this limit, new connections // wait for the number to decrease to or below Resume. // // Stop must be greater than zero and greater than or equal to Resume. Stop uint64 // Resume is the point at which the limiter starts accepting new connections // again. // // Resume must be greater than zero and less than or equal to Stop. Resume uint64 }
Config is the configuration structure for the stream-connection limiter.
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter is the stream-connection limiter.
type ListenConfig ¶
type ListenConfig struct {
// contains filtered or unexported fields
}
ListenConfig is a netext.ListenConfig that uses a *Limiter to limit the number of active stream-connections.
func NewListenConfig ¶
func NewListenConfig(c netext.ListenConfig, l *Limiter) (limited *ListenConfig)
NewListenConfig returns a new netext.ListenConfig that uses l to limit the number of active stream-connections.
func (*ListenConfig) Listen ¶
func (c *ListenConfig) Listen( ctx context.Context, network string, address string, ) (l net.Listener, err error)
Listen implements the netext.ListenConfig interface for *ListenConfig. Listen returns a net.Listener wrapped by c's limiter. ctx must contain a dnsserver.ServerInfo.
func (*ListenConfig) ListenPacket ¶
func (c *ListenConfig) ListenPacket( ctx context.Context, network string, address string, ) (conn net.PacketConn, err error)
ListenPacket implements the netext.ListenConfig interface for *ListenConfig.