inspektor-gadget

Форк
0
154 строки · 3.5 Кб
1
// Code generated by bpf2go; DO NOT EDIT.
2
//go:build 386 || amd64 || amd64p32 || arm || arm64 || loong64 || mips64le || mips64p32le || mipsle || ppc64le || riscv64
3

4
package tracer
5

6
import (
7
	"bytes"
8
	_ "embed"
9
	"fmt"
10
	"io"
11

12
	"github.com/cilium/ebpf"
13
)
14

15
type snisnoopEventT struct {
16
	Netns     uint32
17
	_         [4]byte
18
	MountNsId uint64
19
	Pid       uint32
20
	Tid       uint32
21
	Uid       uint32
22
	Gid       uint32
23
	Task      [16]uint8
24
	Name      [128]uint8
25
	Timestamp uint64
26
}
27

28
type snisnoopSocketsKey struct {
29
	Netns  uint32
30
	Family uint16
31
	Proto  uint16
32
	Port   uint16
33
	_      [2]byte
34
}
35

36
type snisnoopSocketsValue struct {
37
	Mntns             uint64
38
	PidTgid           uint64
39
	UidGid            uint64
40
	Task              [16]int8
41
	Sock              uint64
42
	DeletionTimestamp uint64
43
	Ipv6only          int8
44
	_                 [7]byte
45
}
46

47
// loadSnisnoop returns the embedded CollectionSpec for snisnoop.
48
func loadSnisnoop() (*ebpf.CollectionSpec, error) {
49
	reader := bytes.NewReader(_SnisnoopBytes)
50
	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
51
	if err != nil {
52
		return nil, fmt.Errorf("can't load snisnoop: %w", err)
53
	}
54

55
	return spec, err
56
}
57

58
// loadSnisnoopObjects loads snisnoop and converts it into a struct.
59
//
60
// The following types are suitable as obj argument:
61
//
62
//	*snisnoopObjects
63
//	*snisnoopPrograms
64
//	*snisnoopMaps
65
//
66
// See ebpf.CollectionSpec.LoadAndAssign documentation for details.
67
func loadSnisnoopObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
68
	spec, err := loadSnisnoop()
69
	if err != nil {
70
		return err
71
	}
72

73
	return spec.LoadAndAssign(obj, opts)
74
}
75

76
// snisnoopSpecs contains maps and programs before they are loaded into the kernel.
77
//
78
// It can be passed ebpf.CollectionSpec.Assign.
79
type snisnoopSpecs struct {
80
	snisnoopProgramSpecs
81
	snisnoopMapSpecs
82
}
83

84
// snisnoopSpecs contains programs before they are loaded into the kernel.
85
//
86
// It can be passed ebpf.CollectionSpec.Assign.
87
type snisnoopProgramSpecs struct {
88
	IgTraceSni *ebpf.ProgramSpec `ebpf:"ig_trace_sni"`
89
}
90

91
// snisnoopMapSpecs contains maps before they are loaded into the kernel.
92
//
93
// It can be passed ebpf.CollectionSpec.Assign.
94
type snisnoopMapSpecs struct {
95
	Events        *ebpf.MapSpec `ebpf:"events"`
96
	GadgetSockets *ebpf.MapSpec `ebpf:"gadget_sockets"`
97
}
98

99
// snisnoopObjects contains all objects after they have been loaded into the kernel.
100
//
101
// It can be passed to loadSnisnoopObjects or ebpf.CollectionSpec.LoadAndAssign.
102
type snisnoopObjects struct {
103
	snisnoopPrograms
104
	snisnoopMaps
105
}
106

107
func (o *snisnoopObjects) Close() error {
108
	return _SnisnoopClose(
109
		&o.snisnoopPrograms,
110
		&o.snisnoopMaps,
111
	)
112
}
113

114
// snisnoopMaps contains all maps after they have been loaded into the kernel.
115
//
116
// It can be passed to loadSnisnoopObjects or ebpf.CollectionSpec.LoadAndAssign.
117
type snisnoopMaps struct {
118
	Events        *ebpf.Map `ebpf:"events"`
119
	GadgetSockets *ebpf.Map `ebpf:"gadget_sockets"`
120
}
121

122
func (m *snisnoopMaps) Close() error {
123
	return _SnisnoopClose(
124
		m.Events,
125
		m.GadgetSockets,
126
	)
127
}
128

129
// snisnoopPrograms contains all programs after they have been loaded into the kernel.
130
//
131
// It can be passed to loadSnisnoopObjects or ebpf.CollectionSpec.LoadAndAssign.
132
type snisnoopPrograms struct {
133
	IgTraceSni *ebpf.Program `ebpf:"ig_trace_sni"`
134
}
135

136
func (p *snisnoopPrograms) Close() error {
137
	return _SnisnoopClose(
138
		p.IgTraceSni,
139
	)
140
}
141

142
func _SnisnoopClose(closers ...io.Closer) error {
143
	for _, closer := range closers {
144
		if err := closer.Close(); err != nil {
145
			return err
146
		}
147
	}
148
	return nil
149
}
150

151
// Do not access this directly.
152
//
153
//go:embed snisnoop_bpfel.o
154
var _SnisnoopBytes []byte
155

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.