8000 GitHub - dorkamotorka/goby: Goby CLI eBPF Project Generator
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dorkamotorka/goby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Goby

Goby (inspired by combining Golang and eBPF in a cartoon fashion) is a CLI tool that helps you generate the initial project setup for developing eBPF programs using the Cilium eBPF library.

ebpf-gopher

Prerequisites

Before getting started, follow the official Cilium guide to install the required prerequisites: Getting Started Guide.

Additionally, you'll need to install bpftool.

How to Use Goby

  1. Install Goby from the latest release:

    curl -L -o goby https://github.com/dorkamotorka/goby/releases/download/main/goby
    chmod +x goby
    sudo mv goby /usr/local/bin/
  2. Initialize your eBPF project by running the following command from the root of your project:

    goby init <path>

    Replace <path> with the directory where you want to create your eBPF project.

    Note: If the directory doesn't exist, Goby will create it for you.

What Does Goby Do?

Goby generates a set of files to speed up the initial setup of your eBPF project. The current version focuses on simplicity to get you quickly up and running with your idea. Specifically, it generates the following files:

  • program.bpf.c: The file where you write your eBPF kernel code.
  • main.go: The Golang program that loads and attaches eBPF programs.
  • vmlinux.h: A header file generated using bpftool, which is used inside the eBPF kernel program to interact with various kernel structs.
  • Makefile: A wrapper around Go commands to initialize, generate, build, and run the eBPF program.

Inside Your eBPF Golang Project

Check the corresponding files for helpful comments.

  1. Initialize your Golang project using:

    make init
  2. Generate the eBPF skeleton, build the binary, and run it using:

    make run

Development Tips

Check out the example_project, which was initialized using Goby and includes an eBPF tracepoint example.

eBPF Kernel Program (program.bpf.c)

In the eBPF kernel program, you'll mostly write eBPF subprograms that attach to various hooks, such as LSM hooks, XDP, or tracing points.

When designing your eBPF program, refer to the eBPF documentation, which includes useful helper functions and header files for various eBPF hooks.

eBPF User Space Program (main.go)

The user-space program is responsible for loading and attaching your eBPF kernel program.

Cilium’s eBPF library documentation provides useful guidance on how to achieve this.

Note: Be sure to explore my other repositories for different use cases.


With Goby, getting started with eBPF is simple and fast. Happy coding!

About

Goby CLI eBPF Project Generator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0