networking

package
v0.0.0-...-a5f9fc7 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetworkAccess

type NetworkAccess interface {
	// AddHeaders adds all the custom and authentication headers to the request.
	AddHeaders(request *http.Request) error
	// GetRoundTripper returns the http.RoundTripper that is used by the http.Client.
	GetRoundTripper() http.RoundTripper
	// GetHttpClient returns the http client.
	GetHttpClient() *http.Client
	// GetUnauthorizedHttpClient returns an HTTP client that does not use authentication headers.
	GetUnauthorizedHttpClient() *http.Client
	// AddHeaderField adds a header field to the default header.
	AddHeaderField(key, value string)
	// AddRootCAs adds the root CAs from the given PEM file.
	AddRootCAs(pemFileLocation string) error
	// GetAuthenticator returns the authenticator.
	GetAuthenticator() auth.Authenticator

	SetLogger(logger *zerolog.Logger)
	SetConfiguration(configuration configuration.Configuration)
	GetLogger() *zerolog.Logger
	GetConfiguration() configuration.Configuration
}

NetworkAccess is the interface for network access. It provides methods to get an HTTP client with default behaviors that handle authentication headers for Vulnmap API calls.

func NewNetworkAccess

func NewNetworkAccess(config configuration.Configuration) NetworkAccess

NewNetworkAccess returns a networkImpl instance.

type UserAgentInfo

type UserAgentInfo struct {
	App                           string
	AppVersion                    string
	Integration                   string
	IntegrationVersion            string
	IntegrationEnvironment        string
	IntegrationEnvironmentVersion string
	OS                            string
	Arch                          string
}

func UserAgent

func UserAgent(opts ...UserAgentOptions) UserAgentInfo

func UserAgentFromConfig

func UserAgentFromConfig(config configuration.Configuration, app string, appVersion string) UserAgentInfo

func (UserAgentInfo) String

func (s UserAgentInfo) String() string

ToUserAgentHeader returns a string that can be used as a User-Agent header. The string is following this format: <app>/<appVer> (<os>;<arch>;<procName>) <integration>/<integrationVersion> (<integrationEnv>/<integrationEnvVersion>) Everything other than the app, app version and system information (os/arch/process name) is optional. The integration environment is only added if the integration is set.

type UserAgentOptions

type UserAgentOptions func(ua *UserAgentInfo)

func UaWithApplication

func UaWithApplication(app string, appVersion string) UserAgentOptions

func UaWithOS

func UaWithOS(osName string) UserAgentOptions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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