lib

package
v0.0.0-...-23e2746 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(strings []string, s string) bool

Contains returns true if s is in strings array

func Diffs

func Diffs(crt *NetConfig, prev *NetConfig) string

Diffs compute a report with the differences between two configurations

func Report

func Report(crt *NetConfig, prev *NetConfig) string

Report builds the summary for network configuration changes

func SendMailSSL

func SendMailSSL(cfg *MailConfig, subject string, body string) error

SendMailSSL sends a mail message using SMTP servers that require a SSL connection from the very beginning.

Types

type MailConfig

type MailConfig struct {
	From           string `json:"from"`
	To             string `json:"to"`
	ServerHost     string `json:"serverHost"`
	ServerPort     int    `json:"serverPort"`
	ServerUser     string `json:"serverUser"`
	ServerPassword string `json:"serverPassword"`
}

MailConfig represents SMTP server details

func LoadMailConfig

func LoadMailConfig(path string) (*MailConfig, error)

LoadMailConfig reads mail configuration from file

type NetConfig

type NetConfig struct {
	Hostname string   `json:"hostname"`
	IPs      []string `json:"ips"`
}

NetConfig holds the hostname and the list of IP addresses for the current host

func GetNetConfig

func GetNetConfig() (*NetConfig, error)

GetNetConfig reads current network settings

func LoadNetConfig

func LoadNetConfig(path string) (*NetConfig, error)

LoadNetConfig loads network settings from file

func (*NetConfig) IPCount

func (n *NetConfig) IPCount() int

IPCount returns the number of IPs in the configuration

func (*NetConfig) IsChanged

func (n *NetConfig) IsChanged(other *NetConfig) bool

IsChanged returns true if the two configurations differ

func (*NetConfig) Load

func (n *NetConfig) Load(path string) error

Load hostname and IP list from file

func (*NetConfig) Save

func (n *NetConfig) Save(path string) error

Save hostname and IP list to file

func (*NetConfig) String

func (n *NetConfig) String() string

String returns the string representation of the network configuration

Jump to

Keyboard shortcuts

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