ssh

package
v0.0.0-...-fa857ea Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

based on https://github.com/havoc-io/ssh_config

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEntry

func AddEntry(name, iface string, port int) error

AddEntry adds an entry to the user's sshconfig

func Copy

func Copy(local io.Reader, remote io.WriteCloser)

func Exec

func Exec(ctx context.Context, iface string, remotePort int, tty bool, inR io.Reader, outW, errW io.Writer, command []string) error

Exec executes the command over SSH

func GenerateKeys

func GenerateKeys() error

GenerateKeys generates a SSH key pair on path

func GetPort

func GetPort(name string) (int, error)

GetPort returns the corresponding SSH port for the dev env

func GetPublicKey

func GetPublicKey() string

GetPublicKey returns the path to the public key

func KeyExists

func KeyExists() bool

KeyExists returns true if the okteto key pair exists

func RemoveEntry

func RemoveEntry(name string) error

RemoveEntry removes the entry to the user's sshconfig if found

Types

type Copier

type Copier struct {
	Local  io.Reader
	Remote io.WriteCloser
}

Copier copies from local to remote terminalhandles the lifecycle of all the forwards

func (*Copier) Copy

func (c *Copier) Copy()

type ForwardManager

type ForwardManager struct {
	// contains filtered or unexported fields
}

ForwardManager handles the lifecycle of all the forwards

func NewForwardManager

func NewForwardManager(ctx context.Context, sshAddr, localInterface, remoteInterface string, pf *k8sForward.PortForwardManager, namespace string) *ForwardManager

NewForwardManager returns a newly initialized instance of ForwardManager

func (*ForwardManager) Add

Add initializes a remote forward

func (*ForwardManager) AddReverse

func (fm *ForwardManager) AddReverse(f model.Reverse) error

AddReverse adds a reverse forward

func (*ForwardManager) Start

func (fm *ForwardManager) Start(devPod, namespace string) error

Start starts a port-forward to the remote port and then starts forwards and reverse forwards as goroutines

func (*ForwardManager) StartGlobalForwarding

func (fm *ForwardManager) StartGlobalForwarding() error

StartGlobalForwarding implements from the interface types.forwarder nolint:unparam

func (*ForwardManager) Stop

func (fm *ForwardManager) Stop()

Stop sends a stop signal to all the connections

func (*ForwardManager) TransformLabelsToServiceName

func (fm *ForwardManager) TransformLabelsToServiceName(f forwardModel.Forward) (forwardModel.Forward, error)

Jump to

Keyboard shortcuts

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