filtermanager

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package filtermanager is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterManager

type FilterManager struct {
	// contains filtered or unexported fields
}

func Init

func Init(retry int) (*FilterManager, error)

Init returns a new instance of FilterManager. It is a singleton. retry is the number of times to retry adding/deleting IPs to/from the filter map. Retry is exponential backoff with a base of 2. For example, retry=3 means: 1st try: 1 second 2nd try: 2 seconds 3rd try: 4 seconds Total time: 7 seconds The manager locks the cache during retry. Suggest to keep retry to a small number (not more than 3).

func (*FilterManager) AddIPs

func (f *FilterManager) AddIPs(ips []net.IP, r Requestor, m RequestMetadata) error

func (*FilterManager) DeleteIPs

func (f *FilterManager) DeleteIPs(ips []net.IP, r Requestor, m RequestMetadata) error

func (*FilterManager) HasIP

func (f *FilterManager) HasIP(ip net.IP) bool

func (*FilterManager) Reset

func (f *FilterManager) Reset() error

func (*FilterManager) Stop

func (f *FilterManager) Stop() error

type ICache

type ICache interface {
	// contains filtered or unexported methods
}

type IFilterManager

type IFilterManager interface {
	// AddIPs adds the given IPs to the filter map (map in kernel space) and the filterCache.
	// If any of the IP cannot be added to the filter map,
	// no entries will be added to the cache.
	// Note: An error returned doesn't gurantee that no IPs
	// were added to the filter map. Caller should retry adding
	// all the IPs again.
	AddIPs([]net.IP, Requestor, RequestMetadata) error
	// DeleteIPs deletes the given IPs from the filter map (map in kernel space) and the filterCache.
	// If any of the IP cannot be deleted from the filter map,
	// no entries will be deleted from the cache.
	// Note: An error returned doesn't gurantee that no IPs
	// were deleted from the filter map. Caller should retry deleting
	// all the IPs again.
	DeleteIPs([]net.IP, Requestor, RequestMetadata) error
	// HasIP returns true if the given IP is in the filterCache.
	HasIP(net.IP) bool
	// Reset the cache and the filter map.
	// Note: An error returned doesn't gurantee that no IPs
	// were deleted from the filter map. Caller should retry Reset
	// again.
	Reset() error
	// Reset the filterManager and close the kernel map.
	// Error indicates issues deleting all entries in the kernel map.
	Stop() error
}

type MockICache

type MockICache struct {
	// contains filtered or unexported fields
}

MockICache is a mock of ICache interface.

func NewMockICache

func NewMockICache(ctrl *gomock.Controller) *MockICache

NewMockICache creates a new mock instance.

func (*MockICache) EXPECT

func (m *MockICache) EXPECT() *MockICacheMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

type MockICacheMockRecorder

type MockICacheMockRecorder struct {
	// contains filtered or unexported fields
}

MockICacheMockRecorder is the mock recorder for MockICache.

type MockIFilterManager

type MockIFilterManager struct {
	// contains filtered or unexported fields
}

MockIFilterManager is a mock of IFilterManager interface.

func NewMockIFilterManager

func NewMockIFilterManager(ctrl *gomock.Controller) *MockIFilterManager

NewMockIFilterManager creates a new mock instance.

func (*MockIFilterManager) AddIPs

func (m *MockIFilterManager) AddIPs(arg0 []net.IP, arg1 Requestor, arg2 RequestMetadata) error

AddIPs mocks base method.

func (*MockIFilterManager) DeleteIPs

func (m *MockIFilterManager) DeleteIPs(arg0 []net.IP, arg1 Requestor, arg2 RequestMetadata) error

DeleteIPs mocks base method.

func (*MockIFilterManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIFilterManager) HasIP

func (m *MockIFilterManager) HasIP(arg0 net.IP) bool

HasIP mocks base method.

func (*MockIFilterManager) Reset

func (m *MockIFilterManager) Reset() error

Reset mocks base method.

func (*MockIFilterManager) Stop

func (m *MockIFilterManager) Stop() error

Stop mocks base method.

type MockIFilterManagerMockRecorder

type MockIFilterManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockIFilterManagerMockRecorder is the mock recorder for MockIFilterManager.

func (*MockIFilterManagerMockRecorder) AddIPs

func (mr *MockIFilterManagerMockRecorder) AddIPs(arg0, arg1, arg2 interface{}) *gomock.Call

AddIPs indicates an expected call of AddIPs.

func (*MockIFilterManagerMockRecorder) DeleteIPs

func (mr *MockIFilterManagerMockRecorder) DeleteIPs(arg0, arg1, arg2 interface{}) *gomock.Call

DeleteIPs indicates an expected call of DeleteIPs.

func (*MockIFilterManagerMockRecorder) HasIP

func (mr *MockIFilterManagerMockRecorder) HasIP(arg0 interface{}) *gomock.Call

HasIP indicates an expected call of HasIP.

func (*MockIFilterManagerMockRecorder) Reset

Reset indicates an expected call of Reset.

func (*MockIFilterManagerMockRecorder) Stop

Stop indicates an expected call of Stop.

type RequestMetadata

type RequestMetadata struct {
	// Each trace can have multiple rules.
	RuleID string
}

type Requestor

type Requestor string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL