controlmaster

package module
v0.0.0-...-9d272e9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2019 License: MIT Imports: 7 Imported by: 0

README

controlmaster

GoDoc

An implementation of the OpenSSH ControlMaster protocol for Golang

NOTE: this relies on a fork of golang.org/x/crypto/ssh with support for custom transports (github.com/bored-engineer/ssh)

usage

package main

import (
	"log"

	"github.com/bored-engineer/controlmaster"
)

func main() {
	client, err := controlmaster.Dial("unix", "PATH_TO_CONTROLMASTER")
	if err != nil {
		log.Fatal(err)
	}
	session, err := client.NewSession()
	if err != nil {
		log.Fatal(err)
	}
	defer session.Close()
	out, err := session.CombinedOutput("id")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(string(out))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(network string, address string) (*ssh.Client, error)

Dial runs net.Dial then NewClient on the result

func DialTimeout

func DialTimeout(network string, address string, duration time.Duration) (*ssh.Client, error)

DialTimeout runs net.DialTimeout then NewClient on the result

func NewClient

func NewClient(conn net.Conn) (*ssh.Client, error)

NewClient creates a *ssh.Client given a net.Conn

Types

This section is empty.

Jump to

Keyboard shortcuts

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