nfa

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: BSD-3-Clause-Clear Imports: 13 Imported by: 0

README

stellar

go-nfa

[In Progress] Go client for Noction Netflow Analyzer

Go Reference GitHub Tag

Testing Environment Variables

The following environment variables must be set (and valid) for tests to run.

Key Description
NFA_URL URL to NFA instance
NFA_USERNAME NFA Username
NFA_PASSWORD NFA Password

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCfgNoPassword = errors.New("username required")
View Source
var ErrCfgNoURL = errors.New("URL required")
View Source
var ErrCfgNoUsername = errors.New("username required")

Functions

func CreatePrefixRange

func CreatePrefixRange(prefix string) (string, error)

func NewPercentileQuery

func NewPercentileQuery(prefixes []string, exclusions []string, p uint8) (*flow.QueryParameters, error)

func ParseURL

func ParseURL(u string) (*url.URL, error)

ParseURL parses an NFA URL from a string to a *url.URL, sets the appropriate URI schema, and sets the correct path.

Types

type AuthResponse

type AuthResponse struct {
	Result struct {
		Code    string `json:"code"`
		Message string `json:"message,omitempty"`
	} `json:"result"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(options ...OptionSetter) (*Client, error)

func (*Client) PercentileQuery

func (client *Client) PercentileQuery(prefixes, exclude []string, percentile uint8) (*flow.ResPercentileQuery, error)

type OptionSetter

type OptionSetter func(*Options)

func Insecure

func Insecure() OptionSetter

Insecure disables SSL certificate validation when communicating with NFA.

func Password

func Password(p string) OptionSetter

Password sets the authentication password. This option is required.

func Precision added in v0.0.10

func Precision(p uint) OptionSetter

Decimals sets the precision to round percentile values. 100 = 2 decimal places.

func RetryCount added in v0.0.7

func RetryCount(c int) OptionSetter

RetryCount sets the number of times to retry requests.

func RetryTime added in v0.0.7

func RetryTime(d time.Duration) OptionSetter

RetryTime sets the amount of time to wait between retries.

func URL

func URL(u *url.URL) OptionSetter

URL sets the NFA base URL. This option is required. See ParseURL helper.

func Username

func Username(u string) OptionSetter

Username sets the authentication username. This option is required.

type Options

type Options struct {
	Insecure   bool
	URL        *url.URL
	Username   string
	Password   string
	RetryCount int
	RetryTime  time.Duration
	Precision  uint
}

func (*Options) Validate

func (opts *Options) Validate() error

type ProcessingResponse added in v0.0.4

type ProcessingResponse struct {
	Code        string `json:"code"`
	Description string `json:"description"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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