pssh

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

README

pssh

Nokia 1830PSS cli ssh wrapper in Go!

Usage:

package main

import (
	"fmt"
	"log"

	"github.com/naseriax/pssh"
)

func main() {
	//Create the Node object.
	node := pssh.Nokia_1830PSS{
		Ip:       "192.168.10.35",
		UserName: "admin",
		Password: "admin",
	}

	//Connect to the Node cli interface.
	err := node.Connect()
	if err != nil {
		log.Fatalln(err)
	}
	defer node.Disconnect()

	//Run the cli commands.
	res, err := node.Run("show slot *")
	if err != nil {
		log.Fatalln(err)
	}

	//print the result.
	fmt.Println(res)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Nokia_1830PSS

type Nokia_1830PSS struct {
	Ip       string
	Name     string
	UserName string
	Password string
	Port     string
	SshOut   io.Reader
	SshIn    io.WriteCloser
	Timeout  int
	Client   *ssh.Client
	Session  *ssh.Session
}

func (*Nokia_1830PSS) Connect added in v1.0.3

func (s *Nokia_1830PSS) Connect() error

Connect connects to the specified server and opens a session (Filling the Client and Session fields in SshAgent struct).

func (*Nokia_1830PSS) Disconnect

func (s *Nokia_1830PSS) Disconnect()

Disconnect closes the ssh sessoin and connection.

func (*Nokia_1830PSS) Run

func (s *Nokia_1830PSS) Run(env, cmd string) (string, error)

Run executes the given cli command on the opened session.

Jump to

Keyboard shortcuts

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