diff --git a/hypd/server/hyp_bpf_bpfeb.go b/hypd/server/hyp_bpf_bpfeb.go new file mode 100644 index 0000000..73d0948 --- /dev/null +++ b/hypd/server/hyp_bpf_bpfeb.go @@ -0,0 +1,125 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package server + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type hyp_bpfKnockData struct { + Srcip uint32 + Dstport uint16 + Pad uint16 +} + +// loadHyp_bpf returns the embedded CollectionSpec for hyp_bpf. +func loadHyp_bpf() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_Hyp_bpfBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load hyp_bpf: %w", err) + } + + return spec, err +} + +// loadHyp_bpfObjects loads hyp_bpf and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *hyp_bpfObjects +// *hyp_bpfPrograms +// *hyp_bpfMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func loadHyp_bpfObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := loadHyp_bpf() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// hyp_bpfSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type hyp_bpfSpecs struct { + hyp_bpfProgramSpecs + hyp_bpfMapSpecs +} + +// hyp_bpfSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type hyp_bpfProgramSpecs struct { + XdpProgFunc *ebpf.ProgramSpec `ebpf:"xdp_prog_func"` +} + +// hyp_bpfMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type hyp_bpfMapSpecs struct { + Rb *ebpf.MapSpec `ebpf:"rb"` +} + +// hyp_bpfObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to loadHyp_bpfObjects or ebpf.CollectionSpec.LoadAndAssign. +type hyp_bpfObjects struct { + hyp_bpfPrograms + hyp_bpfMaps +} + +func (o *hyp_bpfObjects) Close() error { + return _Hyp_bpfClose( + &o.hyp_bpfPrograms, + &o.hyp_bpfMaps, + ) +} + +// hyp_bpfMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to loadHyp_bpfObjects or ebpf.CollectionSpec.LoadAndAssign. +type hyp_bpfMaps struct { + Rb *ebpf.Map `ebpf:"rb"` +} + +func (m *hyp_bpfMaps) Close() error { + return _Hyp_bpfClose( + m.Rb, + ) +} + +// hyp_bpfPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to loadHyp_bpfObjects or ebpf.CollectionSpec.LoadAndAssign. +type hyp_bpfPrograms struct { + XdpProgFunc *ebpf.Program `ebpf:"xdp_prog_func"` +} + +func (p *hyp_bpfPrograms) Close() error { + return _Hyp_bpfClose( + p.XdpProgFunc, + ) +} + +func _Hyp_bpfClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed hyp_bpf_bpfeb.o +var _Hyp_bpfBytes []byte diff --git a/hypd/server/hyp_bpf_bpfel.go b/hypd/server/hyp_bpf_bpfel.go new file mode 100644 index 0000000..1754fde --- /dev/null +++ b/hypd/server/hyp_bpf_bpfel.go @@ -0,0 +1,125 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package server + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type hyp_bpfKnockData struct { + Srcip uint32 + Dstport uint16 + Pad uint16 +} + +// loadHyp_bpf returns the embedded CollectionSpec for hyp_bpf. +func loadHyp_bpf() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_Hyp_bpfBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load hyp_bpf: %w", err) + } + + return spec, err +} + +// loadHyp_bpfObjects loads hyp_bpf and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *hyp_bpfObjects +// *hyp_bpfPrograms +// *hyp_bpfMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func loadHyp_bpfObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := loadHyp_bpf() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// hyp_bpfSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type hyp_bpfSpecs struct { + hyp_bpfProgramSpecs + hyp_bpfMapSpecs +} + +// hyp_bpfSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type hyp_bpfProgramSpecs struct { + XdpProgFunc *ebpf.ProgramSpec `ebpf:"xdp_prog_func"` +} + +// hyp_bpfMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type hyp_bpfMapSpecs struct { + Rb *ebpf.MapSpec `ebpf:"rb"` +} + +// hyp_bpfObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to loadHyp_bpfObjects or ebpf.CollectionSpec.LoadAndAssign. +type hyp_bpfObjects struct { + hyp_bpfPrograms + hyp_bpfMaps +} + +func (o *hyp_bpfObjects) Close() error { + return _Hyp_bpfClose( + &o.hyp_bpfPrograms, + &o.hyp_bpfMaps, + ) +} + +// hyp_bpfMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to loadHyp_bpfObjects or ebpf.CollectionSpec.LoadAndAssign. +type hyp_bpfMaps struct { + Rb *ebpf.Map `ebpf:"rb"` +} + +func (m *hyp_bpfMaps) Close() error { + return _Hyp_bpfClose( + m.Rb, + ) +} + +// hyp_bpfPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to loadHyp_bpfObjects or ebpf.CollectionSpec.LoadAndAssign. +type hyp_bpfPrograms struct { + XdpProgFunc *ebpf.Program `ebpf:"xdp_prog_func"` +} + +func (p *hyp_bpfPrograms) Close() error { + return _Hyp_bpfClose( + p.XdpProgFunc, + ) +} + +func _Hyp_bpfClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed hyp_bpf_bpfel.o +var _Hyp_bpfBytes []byte