client

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: GPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorEmptyAddress = errors.New("no endpoint address (host:port) provided") // ErrorEmptyAddress : Denotes that an empty config has been provided
)

Functions

This section is empty.

Types

type Client

type Client struct {
	*client.DefaultClient
}

Client provides a client that calls goProbe's API functions

func New

func New(addr string, opts ...client.Option) *Client

New creates a new client instance

func NewFromConfig

func NewFromConfig(cfg *Config) *Client

NewFromConfig creates the client based on cfg

func NewFromConfigFile

func NewFromConfigFile(path string) (*Client, error)

NewFromConfigFile creates the client based on configuration from a file

func NewFromReader

func NewFromReader(r io.Reader) (*Client, error)

NewFromReader creates the client based on configuration read from an io.Reader

func (*Client) GetInterfaceConfig

func (c *Client) GetInterfaceConfig(ctx context.Context, ifaces ...string) (ifaceConfigs config.Ifaces, err error)

GetInterfaceConfig returns goprobe's runtime configuration for the queried interfaces. If ifaces is empty or omitted, the runtime configuration for all interfaces is returned

func (*Client) GetInterfaceStatus

func (c *Client) GetInterfaceStatus(ctx context.Context, ifaces ...string) (statuses map[string]capturetypes.CaptureStats, lastWriteout time.Time, startedAt time.Time, err error)

GetInterfaceStatus returns the interface capture stats from the running goProbe instance

func (*Client) Query

func (c *Client) Query(ctx context.Context, args *query.Args) (*results.Result, error)

Query runs a query on the API endpoint

func (*Client) ReloadConfig

func (c *Client) ReloadConfig(ctx context.Context) (enabled, updated, disabled capturetypes.IfaceChanges, err error)

ReloadConfig reads / updates goprobe's runtime configuration with the one from disk

func (*Client) Run

func (c *Client) Run(ctx context.Context, args *query.Args) (*results.Result, error)

Run implements the query.Runner interface

func (*Client) UpdateInterfaceConfigs

func (c *Client) UpdateInterfaceConfigs(ctx context.Context, ifaceConfigs config.Ifaces) (enabled, updated, disabled capturetypes.IfaceChanges, err error)

UpdateInterfaceConfigs updates goprobe's runtime configuration for the provided interfaces

func (*Client) Validate

func (c *Client) Validate(ctx context.Context, args *query.Args) (*results.Result, error)

Query runs a query on the API endpoint

type Config

type Config struct {
	Scheme string `json:"scheme" yaml:"scheme"`
	Addr   string `json:"addr" yaml:"addr"`
	Key    string `json:"key,omitempty" yaml:"key,omitempty"`

	RequestTimeout time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`

	Log bool `json:"log" yaml:"log"`
}

Config specifies the configurable parts of the client

func (*Config) Validate

func (cfg *Config) Validate() error

Validate validates the configuration

Jump to

Keyboard shortcuts

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