offsets

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const GoStdLib = "go"

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	// Versions range that are tracked for this given field
	Versions VersionInfo `json:"versions"`
	Offsets  []Versioned `json:"offsets"`
}

Field offests must be sorted from higher to lower semantic version

func (*Field) GetOffset

func (field *Field) GetOffset(libVersion string) (uint64, bool)

GetOffset assumes that the fields offsets list is sorted from older to newer version

type InputLibs

type InputLibs map[string]LibQuery

InputLibs key: name of the library, or "go" for the Go standard library

type LibQuery

type LibQuery struct {
	// Inspect provides the path to a Go source file that will be compiled and
	// will inspect the offsets from the generated executable. If not set, it will
	// analise the "go" executable for Go stdlib functions, and for third-party libraries,
	// it will analyse an empty main file that forces the inclusion of the inspected library.
	Inspect string `json:"inspect"`

	// Branch will force downloading the branch name specified here, ignoring the
	// Versions field. This is useful for source repositories without release tags.
	Branch string `json:"branch"`

	// Packages overrides the packages that need to be downloaded for inspection. If empty, it will
	// download the root package (same as the library URL). Setting this value is useful for libraries that do
	// not have any root package and the download would fail (e.g. google.golang.org/genproto)
	Packages []string `json:"packages"`

	// Versions constraint. E.g. ">= 1.12" will only download versions
	// larger or equal to 1.12
	Versions string `json:"versions"`

	// Fields key: qualified name of the struct.
	// Examples: net/http.Request, google.golang.org/grpc/internal/transport.Stream
	// Value: list of case-sensitive name of the fields whose offsets we want to retrieve
	Fields map[string][]string
}

type Struct

type Struct map[string]Field

Struct key: field name

type Track

type Track struct {
	// Data key: struct name, which includes the library name in external libraries
	Data map[string]Struct `json:"data"`
}

func Open

func Open(file string) (*Track, error)

func Read

func Read(in io.Reader) (*Track, error)

func (*Track) Find

func (to *Track) Find(structName, fieldName, libVersion string) (uint64, bool)

Find the offset of a field struct name, for a given lib version

type VersionInfo

type VersionInfo struct {
	Oldest string `json:"oldest"`
	Newest string `json:"newest"`
}

type Versioned

type Versioned struct {
	Offset uint64 `json:"offset"`
	Since  string `json:"since"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL