Golang client to communicate with the BTFHub online server.
go get github.com/seek-ret/btfhub-online-go
All examples available at the examples directory.
client, err := btfhubonline.New("<server address>", btfhubonline.ClientOptions{Secure: true})
btfs, err := client.List()
if err != nil {
log.Fatal(err)
}
for _, btf := range btfs {
fmt.Printf("Server has: \"%s %s %s %s\"\n", btf.Distribution, btf.DistributionVersion, btf.Arch, btf.KernelVersion)
}
btfIdentifier := btfhubonline.BTFRecordIdentifier{
Distribution: "ubuntu",
DistributionVersion: "20.04",
KernelVersion: "5.11.0-1021-gcp",
Arch: "x86_64",
}
btf, err := client.GetRawBTF(btfIdentifier)
bpfByteCode, err := ioutil.ReadFile("<bpf.core.o>")
if err != nil {
log.Fatal(err)
}
btfIdentifier := btfhubonline.BTFRecordIdentifier{
Distribution: "ubuntu",
DistributionVersion: "20.04",
KernelVersion: "5.11.0-1021-gcp",
Arch: "x86_64",
}
btf, err := client.GetCustomBTF(btfIdentifier, bpfByteCode)
cat /etc/os-release | grep "^ID="
Output:
ID=ubuntu
cat /etc/os-release | grep "VERSION_ID="
Output:
VERSION_ID="20.04"
Run:
uname -r
Output:
5.11.0-44-generic
Run:
uname -p
Output:
x86_64
We are welcome you to contribute in any manner there is. We care a lot from the community, thus please read our code of conduct before contributing. You don't have to develop to contribute to the community, and you can do it in one of the following ways:
- Open issues (bugs, feature requests)
- Develop the code (read contributing.md)
- Mention us (twitter, linkedin, blogs)
In our project we use golangci-linter
, and we are using the following linters:
- goimports
- gci
- nakedret
- golint
- misspell
- gosimple
- godot
- whitespace
- staticcheck
- bodyclose
- ineffassign
- unused
- varcheck
- unparam
- godox
- gosec
This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.