sshw

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: MIT Imports: 10 Imported by: 0

README

sshw

ssh client wrapper for automatic login.

usage

install

use go get

go get -u github.com/yinheli/sshw/cmd/sshw

or download binary from releases.

config

put config file in ~/.sshw.

config example:

- { name: dev server fully configured, user: appuser, host: 192.168.8.35, port: 22, password: 123456 }
- { name: dev server with key path, user: appuser, host: 192.168.8.35, port: 22, keypath: /root/.ssh/id_rsa }
- { name: dev server without port, user: appuser, host: 192.168.8.35 }
- { name: dev server without user, host: 192.168.8.35 }
- { name: dev server without password, host: 192.168.8.35 }
- { name: ⚡️ server with emoji name, host: 192.168.8.35 }

# server group 1
- name: server group 1
  children:
  - { name: server 1, user: root, host: 192.168.1.2 }
  - { name: server 2, user: root, host: 192.168.1.3 }
  - { name: server 3, user: root, host: 192.168.1.4 }

# server group 2
- name: server group 2
  children:
  - { name: server 1, user: root, host: 192.168.2.2 }
  - { name: server 2, user: root, host: 192.168.3.3 }
  - { name: server 3, user: root, host: 192.168.4.4 }

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig() error

func SetLogger

func SetLogger(logger Logger)

Types

type Client added in v1.0.3

type Client interface {
	Login()
}

func NewClient added in v1.0.3

func NewClient(node *Node) Client

type Logger

type Logger interface {
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
}

func GetLogger

func GetLogger() Logger

type Node

type Node struct {
	Name     string  `json:"name"`
	Host     string  `json:"host"`
	User     string  `json:"user"`
	Port     int     `json:"port"`
	KeyPath  string  `json:"keypath"`
	Password string  `json:"password"`
	Children []*Node `json:"children"`
}

func GetConfig

func GetConfig() []*Node

func (*Node) String

func (n *Node) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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