network

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: BSD-2-Clause Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDownloadTimeout = errors.New("hit download timeout")
	ErrRetriesLimit    = errors.New("hit retries limit")
	ErrBadHTTPStatus   = errors.New("bad HTTP status")
	ErrEmptyBody       = errors.New("HTTP response body is empty")
)
View Source
var (
	ErrFailedForAllInterfaces = errors.New("IP configuration failed for all interfaces")
	ErrFoundNoInterfaces      = errors.New("found no interfaces")
)

Errors which may be raised and wrapped in this package.

Functions

func ConfigureBondInterface

func ConfigureBondInterface(cfg *host.Config) (*netlink.Bond, error)

func SetBonded

func SetBonded(bond *netlink.Bond, toBondNames []*host.NetworkInterface) error

func SetDNSServer

func SetDNSServer(addresses []*net.IP) error

SetDNSServer writes adresses to /etc/resolv.conf file.

func SetupBondInterface

func SetupBondInterface(ifaceName string, mode netlink.BondMode) (*netlink.Bond, error)

func SetupNetworkInterface

func SetupNetworkInterface(ctx context.Context, cfg *host.Config) error

Types

type HTTPClient added in v0.1.0

type HTTPClient struct {
	HTTPClient http.Client
	Retries    int
	RetryWait  int // TODO: Change type to time.Duration
}

func NewHTTPClient added in v0.1.0

func NewHTTPClient(httpsRoots []*x509.Certificate, insecure bool) HTTPClient

func (*HTTPClient) Download added in v0.1.0

func (h *HTTPClient) Download(ctx context.Context, url *url.URL) ([]byte, error)

Wrapper for downloadObject to deal with retries.

Jump to

Keyboard shortcuts

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