hostparse

package
v0.0.0-...-4282750 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalPass

func EvalPass(pass string) (passEncodedAlgo, evaluated string)

func IsDirectServer

func IsDirectServer(server string) bool

IsDirectServer tells that the server is a direct server address like user:pass@host:port.

func ParseProps

func ParseProps(fields []string) map[string][]string

func Split2BySeps

func Split2BySeps(s string, seps ...string) (s1, s2, sep string)

func SplitHostPort

func SplitHostPort(addr string) (string, string)

func SubstituteProps

func SubstituteProps(s string, props map[string][]string) string

Types

type Host

type Host struct {
	ID       string
	Addr     string
	Port     string
	User     string
	Password string // empty when using public key
	Props    map[string][]string

	Raw string // register the raw template line like `user:pass@host:port`
}

Host represents the structure of remote host information for ssh.

func Parse

func Parse(tmpl string) []Host

Parse parses the host tmpl configuration.

func ParseHostFile

func ParseHostFile(hostsFile string) []Host

func (Host) Expands

func (c Host) Expands(passEncodedAlgo bool) []Host

type ServerConfig

type ServerConfig struct {
	Props map[string][]string
	User  string
	Pass  string
	Addr  string
	Port  string
}

func ParseDirectServer

func ParseDirectServer(server string) (ServerConfig, bool)

ParseDirectServer parses a direct server address.

func (*ServerConfig) GetProp

func (c *ServerConfig) GetProp(k string) string

Jump to

Keyboard shortcuts

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