sshclientconfig

package module
v0.0.0-...-71b0775 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

README

ssh_config to ssh.ClientConfig

This module holds a library to create an ssh.ClientConfig taking into consideration the user ssh config files, similarly to what standard BSD and open SSH client do.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Log allows customers to hook their own logging function into the library
	// to receive logs. By default, discarded.
	// Logs are only emitted for invisible events and handled errors.
	// Errors returned to the library user will not be logged and should be handled by the caller.
	Log = func(level int, format string, args ...interface{}) {}
)

Functions

func UserConfigPath

func UserConfigPath(subFolders ...string) string

UserConfigPath returns the folder holding the user SSH configuration files. Usually $HOME/.ssh

Types

type LogLevel

type LogLevel int

type Override

type Override func(*ssh.ClientConfig)

func WithUser

func WithUser(user string) Override

type Pattern

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

func NewPattern

func NewPattern(s string) (*Pattern, error)

func (*Pattern) Matches

func (p *Pattern) Matches(text string) bool

func (*Pattern) Not

func (p *Pattern) Not() bool

func (*Pattern) RawMatches

func (p *Pattern) RawMatches(text string) bool

type PatternList

type PatternList []*Pattern

func NewPatternList

func NewPatternList(s string) (PatternList, error)

func (PatternList) Match

func (pl PatternList) Match(text string) bool

type SSHClientConfig

type SSHClientConfig struct {
	// Configuration paths to lookup for configuration.
	LookupPaths []string
}

func NewSSHClientConfig

func NewSSHClientConfig(path string) *SSHClientConfig

For each parameter, the first obtained value will be used.

func (SSHClientConfig) DialAddr

func (c SSHClientConfig) DialAddr(addr string) string

func (SSHClientConfig) HostName

func (c SSHClientConfig) HostName(host string) string

func (SSHClientConfig) Port

func (c SSHClientConfig) Port(host, port string) string

func (SSHClientConfig) SSHClientConfig

func (c SSHClientConfig) SSHClientConfig(host string, overrides ...Override) (*ssh.ClientConfig, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳