cloudflared/mocks/mock_limiter.go
João "Pisco" Fernandes bf4954e96a TUN-8861: Add session limiter to UDP session manager
## Summary
In order to make cloudflared behavior more predictable and
prevent an exhaustion of resources, we have decided to add
session limits that can be configured by the user. This first
commit introduces the session limiter and adds it to the UDP
handling path. For now the limiter is set to run only in
unlimited mode.
2025-01-20 02:52:32 -08:00

151 lines
4.0 KiB
Go

// Code generated by MockGen. DO NOT EDIT.
// Source: ../session/limiter.go
//
// Generated by this command:
//
// mockgen -typed -build_flags=-tags=gomock -package mocks -destination mock_limiter.go -source=../session/limiter.go Limiter
//
// Package mocks is a generated GoMock package.
package mocks
import (
reflect "reflect"
gomock "go.uber.org/mock/gomock"
)
// MockLimiter is a mock of Limiter interface.
type MockLimiter struct {
ctrl *gomock.Controller
recorder *MockLimiterMockRecorder
isgomock struct{}
}
// MockLimiterMockRecorder is the mock recorder for MockLimiter.
type MockLimiterMockRecorder struct {
mock *MockLimiter
}
// NewMockLimiter creates a new mock instance.
func NewMockLimiter(ctrl *gomock.Controller) *MockLimiter {
mock := &MockLimiter{ctrl: ctrl}
mock.recorder = &MockLimiterMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockLimiter) EXPECT() *MockLimiterMockRecorder {
return m.recorder
}
// Acquire mocks base method.
func (m *MockLimiter) Acquire(sessionType string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Acquire", sessionType)
ret0, _ := ret[0].(error)
return ret0
}
// Acquire indicates an expected call of Acquire.
func (mr *MockLimiterMockRecorder) Acquire(sessionType any) *MockLimiterAcquireCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Acquire", reflect.TypeOf((*MockLimiter)(nil).Acquire), sessionType)
return &MockLimiterAcquireCall{Call: call}
}
// MockLimiterAcquireCall wrap *gomock.Call
type MockLimiterAcquireCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockLimiterAcquireCall) Return(arg0 error) *MockLimiterAcquireCall {
c.Call = c.Call.Return(arg0)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockLimiterAcquireCall) Do(f func(string) error) *MockLimiterAcquireCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockLimiterAcquireCall) DoAndReturn(f func(string) error) *MockLimiterAcquireCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// Release mocks base method.
func (m *MockLimiter) Release() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Release")
}
// Release indicates an expected call of Release.
func (mr *MockLimiterMockRecorder) Release() *MockLimiterReleaseCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Release", reflect.TypeOf((*MockLimiter)(nil).Release))
return &MockLimiterReleaseCall{Call: call}
}
// MockLimiterReleaseCall wrap *gomock.Call
type MockLimiterReleaseCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockLimiterReleaseCall) Return() *MockLimiterReleaseCall {
c.Call = c.Call.Return()
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockLimiterReleaseCall) Do(f func()) *MockLimiterReleaseCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockLimiterReleaseCall) DoAndReturn(f func()) *MockLimiterReleaseCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// SetLimit mocks base method.
func (m *MockLimiter) SetLimit(arg0 uint64) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetLimit", arg0)
}
// SetLimit indicates an expected call of SetLimit.
func (mr *MockLimiterMockRecorder) SetLimit(arg0 any) *MockLimiterSetLimitCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLimit", reflect.TypeOf((*MockLimiter)(nil).SetLimit), arg0)
return &MockLimiterSetLimitCall{Call: call}
}
// MockLimiterSetLimitCall wrap *gomock.Call
type MockLimiterSetLimitCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockLimiterSetLimitCall) Return() *MockLimiterSetLimitCall {
c.Call = c.Call.Return()
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockLimiterSetLimitCall) Do(f func(uint64)) *MockLimiterSetLimitCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockLimiterSetLimitCall) DoAndReturn(f func(uint64)) *MockLimiterSetLimitCall {
c.Call = c.Call.DoAndReturn(f)
return c
}