network

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deploy

func Deploy(deploys []DeployConfig, isPrompt bool) error

Deploy deploys nodes to hosts as specified in `config`

func InitAuth

func InitAuth(deploys []DeployConfig) (map[string]HostAuth, error)

InitAuth creates a mapping of host names to SSH authentications Requires user input at terminal

func InitHost

func InitHost(user, ip string, auth ssh.AuthMethod) error

InitHost initializes a host environment to be able to run nodes.

func PromptAuth

func PromptAuth(ip *string) ssh.AuthMethod

PromptAuth returns an `ssh.AuthMethod` object for establishing an `SSHClient` Requires user input at terminal

func Remove

func Remove(deploys []DeployConfig, isPrompt bool) error

Remove removes nodes from hosts as specified in `config`

Types

type DeployConfig

type DeployConfig struct {
	User, IP string
	Nodes    []NodeConfig
}

DeployConfig is a deploy instruction for a particular host

func InitConfig

func InitConfig(cfgpath string) ([]DeployConfig, error)

InitConfig returns a network configuration from `cfgpath`

type HostAuth

type HostAuth struct {
	User, IP string
	Auth     ssh.AuthMethod
}

HostAuth represents a full set of host SSH credentials

type HostConfig

type HostConfig struct {
	User, IP string
}

HostConfig is a host configuration

type NodeConfig

type NodeConfig struct {
	Name  string
	Flags node.Flags
}

NodeConfig is a node configuration

type RawConfig

type RawConfig struct {
	Hosts []struct {
		Name, User, IP string
	}
	Nodes []struct {
		Class string
		Flags node.FlagsYAML
	}
	Deploys []struct {
		Host  string
		Nodes []struct {
			Name, Class string
			Flags       node.FlagsYAML
		}
	}
}

RawConfig is a raw network configuration

type SSHClient

type SSHClient struct {
	*ssh.Client
	// contains filtered or unexported fields
}

SSHClient implements an SSH client

func NewSSH

func NewSSH(user, ip string, auth ssh.AuthMethod) (*SSHClient, error)

NewSSH instantiates a new SSH client

func (*SSHClient) CopyFile

func (client *SSHClient) CopyFile(fp string, cfp string) error

CopyFile copies the contents of `fp` to `cfp` through client

func (*SSHClient) RemovePath

func (client *SSHClient) RemovePath(path string) error

RemovePath removes file or directory `path` through client

func (*SSHClient) Run

func (client *SSHClient) Run(cmds []string) error

Run runs a series of commands on remote host and waits for exit

Jump to

Keyboard shortcuts

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