Documentation ¶
Overview ¶
Package ratelimit is a generated GoMock package.
Package ratelimit is a generated GoMock package.
Index ¶
- func Monitor(lim *Limiter, stats stats.Stats, interval time.Duration)
- type Handler
- func (h *Handler) Attach(s *dns.Server)
- func (h *Handler) DecorateReader(inner dns.Reader) dns.Reader
- func (h *Handler) MsgAcceptFunc(dh dns.Header) dns.MsgAcceptAction
- func (h *Handler) MsgInvalid([]byte, error)
- func (h *Handler) Name() string
- func (h *Handler) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)
- type Limiter
- type MockHandler
- type MockHandlerMockRecorder
- type MockPacketConnReader
- func (m *MockPacketConnReader) EXPECT() *MockPacketConnReaderMockRecorder
- func (m *MockPacketConnReader) ReadPacketConn(arg0 net.PacketConn, arg1 time.Duration) ([]byte, net.Addr, error)
- func (m *MockPacketConnReader) ReadTCP(arg0 net.Conn, arg1 time.Duration) ([]byte, error)
- func (m *MockPacketConnReader) ReadUDP(arg0 *net.UDPConn, arg1 time.Duration) ([]byte, *dns.SessionUDP, error)
- type MockPacketConnReaderMockRecorder
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
Handler is a plugin.Handler that limits how many queries are currently being processed. It should be the first handler in the chain, and must be used with the associated Reader.
Handler does not provide an absolute guarantee, because each query is marked as "completed" just _before_ its goroutine terminates.
func NewHandler ¶
NewHandler initializes a new concurrency-limiting Handler.
func (*Handler) Attach ¶
Attach connects this handler to a Server's message processing path. This method must be called before the server starts.
func (*Handler) DecorateReader ¶
DecorateReader is a dns.DecorateReader.
func (*Handler) MsgAcceptFunc ¶
func (h *Handler) MsgAcceptFunc(dh dns.Header) dns.MsgAcceptAction
MsgAcceptFunc is a dns.MsgAcceptFunc.
func (*Handler) MsgInvalid ¶
MsgInvalid is a dns.MsgInvalidFunc.
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter is a wrapped Semaphore that exposes a counter.
func NewLimiter ¶
NewLimiter initializes a new concurrency-limiting Limiter.
type MockHandler ¶
type MockHandler struct {
// contains filtered or unexported fields
}
MockHandler is a mock of Handler interface.
func NewMockHandler ¶
func NewMockHandler(ctrl *gomock.Controller) *MockHandler
NewMockHandler creates a new mock instance.
func (*MockHandler) EXPECT ¶
func (m *MockHandler) EXPECT() *MockHandlerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockHandlerMockRecorder ¶
type MockHandlerMockRecorder struct {
// contains filtered or unexported fields
}
MockHandlerMockRecorder is the mock recorder for MockHandler.
func (*MockHandlerMockRecorder) Name ¶
func (mr *MockHandlerMockRecorder) Name() *gomock.Call
Name indicates an expected call of Name.
func (*MockHandlerMockRecorder) ServeDNS ¶
func (mr *MockHandlerMockRecorder) ServeDNS(arg0, arg1, arg2 interface{}) *gomock.Call
ServeDNS indicates an expected call of ServeDNS.
type MockPacketConnReader ¶
type MockPacketConnReader struct {
// contains filtered or unexported fields
}
MockPacketConnReader is a mock of PacketConnReader interface.
func NewMockPacketConnReader ¶
func NewMockPacketConnReader(ctrl *gomock.Controller) *MockPacketConnReader
NewMockPacketConnReader creates a new mock instance.
func (*MockPacketConnReader) EXPECT ¶
func (m *MockPacketConnReader) EXPECT() *MockPacketConnReaderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPacketConnReader) ReadPacketConn ¶
func (m *MockPacketConnReader) ReadPacketConn(arg0 net.PacketConn, arg1 time.Duration) ([]byte, net.Addr, error)
ReadPacketConn mocks base method.
type MockPacketConnReaderMockRecorder ¶
type MockPacketConnReaderMockRecorder struct {
// contains filtered or unexported fields
}
MockPacketConnReaderMockRecorder is the mock recorder for MockPacketConnReader.
func (*MockPacketConnReaderMockRecorder) ReadPacketConn ¶
func (mr *MockPacketConnReaderMockRecorder) ReadPacketConn(arg0, arg1 interface{}) *gomock.Call
ReadPacketConn indicates an expected call of ReadPacketConn.
func (*MockPacketConnReaderMockRecorder) ReadTCP ¶
func (mr *MockPacketConnReaderMockRecorder) ReadTCP(arg0, arg1 interface{}) *gomock.Call
ReadTCP indicates an expected call of ReadTCP.
func (*MockPacketConnReaderMockRecorder) ReadUDP ¶
func (mr *MockPacketConnReaderMockRecorder) ReadUDP(arg0, arg1 interface{}) *gomock.Call
ReadUDP indicates an expected call of ReadUDP.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a dns.Reader that blocks when the concurrency exceeds some threshold.
func (*Reader) ReadPacketConn ¶
func (r *Reader) ReadPacketConn(conn net.PacketConn, timeout time.Duration) ([]byte, net.Addr, error)
ReadPacketConn implements dns.PacketConnReader.
func (*Reader) ReadTCP ¶
ReadTCP implements dns.Reader.