-
Notifications
You must be signed in to change notification settings - Fork 195
/
types.go
34 lines (28 loc) · 879 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package filter
import (
"net"
"github.com/cilium/ebpf"
)
//go:generate go run github.com/golang/mock/mockgen@v1.6.0 -source=types.go -destination=mocks/mock_types.go -package=mocks
/*
A thin wrapper around the eBPF map that allows adding and deleting IPv4 addresses.
Adding this separately here because:
- C code uses the lib for generation/compilation
- Plugins import retina_filter.c to use lookup function
*/
type IFilterMap interface {
Add([]net.IP) error
Delete([]net.IP) error
Close()
}
// Interface for eBPF map.
// Added for UTs.
type IEbpfMap interface {
BatchUpdate(keys, values interface{}, opts *ebpf.BatchOptions) (int, error)
BatchDelete(keys interface{}, opts *ebpf.BatchOptions) (int, error)
Put(key, value interface{}) error
Delete(key interface{}) error
Close() error
}