net

package
v0.43.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 9 Imported by: 0

README

network

Network can apply changes to /etc/network/interfaces and /etc/frr/frr.conf.

It was intentionally created to provide a common means to:

  • apply validation
  • render interfaces/frr.conf files
  • reload required services to apply changes

Requirements

Network lib relies on ifupdown2 and systemd. It also is assumed frr is installed as systemd service.

Usage

Make use network lib:

package main

import "github.com/metal-stack/metal-networker/pkg/net"

func main() {
	// TODO
}

Documentation

Overview

Package net contains code to apply changes to network interfaces and FRR (Free Range Routing).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDBusReloader

func NewDBusReloader(service string) dbusReloader

NewDBusReloader is a reloader for systemd units with dbus.

Types

type Applier

type Applier interface {
	Apply(tpl template.Template, tmpFile, destFile string, reload bool) (bool, error)
	Render(writer io.Writer, tpl template.Template) error
	Reload() error
	Validate() error
	Compare(tmpFile, destFile string) bool
}

Applier is an interface to render changes and reload services to apply them.

func NewNetworkApplier

func NewNetworkApplier(data any, validator Validator, reloader Reloader) Applier

NewNetworkApplier creates a new NewNetworkApplier.

type Reloader

type Reloader interface {
	Reload() error
}

Reloader triggers the reload to carry out the changes of an applier.

type Validator

type Validator interface {
	Validate() error
}

Validator is an interface to apply common validation.

Jump to

Keyboard shortcuts

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