mirror of
https://github.com/containers/podman.git
synced 2025-10-15 10:16:28 +08:00
Update module github.com/kevinburke/ssh_config to v1.4.0
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
1
vendor/github.com/kevinburke/ssh_config/.gitattributes
generated
vendored
1
vendor/github.com/kevinburke/ssh_config/.gitattributes
generated
vendored
@ -1 +0,0 @@
|
||||
testdata/dos-lines eol=crlf
|
1
vendor/github.com/kevinburke/ssh_config/AUTHORS.txt
generated
vendored
1
vendor/github.com/kevinburke/ssh_config/AUTHORS.txt
generated
vendored
@ -5,5 +5,6 @@ Kevin Burke <kevin@burke.dev>
|
||||
Mark Nevill <nev@improbable.io>
|
||||
Scott Lessans <slessans@gmail.com>
|
||||
Sergey Lukjanov <me@slukjanov.name>
|
||||
Simon Josefsson <simon@josefsson.org>
|
||||
Wayne Ashley Berry <wayneashleyberry@gmail.com>
|
||||
santosh653 <70637961+santosh653@users.noreply.github.com>
|
||||
|
13
vendor/github.com/kevinburke/ssh_config/CHANGELOG.md
generated
vendored
13
vendor/github.com/kevinburke/ssh_config/CHANGELOG.md
generated
vendored
@ -1,5 +1,18 @@
|
||||
# Changes
|
||||
|
||||
## Version 1.4 (released August 2025)
|
||||
|
||||
- Remove .gitattributes file (which was used to test different line endings, and
|
||||
caused issues in some build environments).
|
||||
|
||||
## Version 1.3 (released February 2025)
|
||||
|
||||
- Add go.mod file (although this project has no dependencies).
|
||||
|
||||
- Various updates to CI and build environment
|
||||
|
||||
- config: add UserSettings.ConfigFinder
|
||||
|
||||
## Version 1.2
|
||||
|
||||
Previously, if a Host declaration or a value had trailing whitespace, that
|
||||
|
12
vendor/github.com/kevinburke/ssh_config/Makefile
generated
vendored
12
vendor/github.com/kevinburke/ssh_config/Makefile
generated
vendored
@ -1,19 +1,15 @@
|
||||
BUMP_VERSION := $(GOPATH)/bin/bump_version
|
||||
STATICCHECK := $(GOPATH)/bin/staticcheck
|
||||
WRITE_MAILMAP := $(GOPATH)/bin/write_mailmap
|
||||
|
||||
$(STATICCHECK):
|
||||
go get honnef.co/go/tools/cmd/staticcheck
|
||||
|
||||
lint: $(STATICCHECK)
|
||||
lint:
|
||||
go vet ./...
|
||||
$(STATICCHECK)
|
||||
go run honnef.co/go/tools/cmd/staticcheck@latest ./...
|
||||
|
||||
test: lint
|
||||
test:
|
||||
@# the timeout helps guard against infinite recursion
|
||||
go test -timeout=250ms ./...
|
||||
|
||||
race-test: lint
|
||||
race-test:
|
||||
go test -timeout=500ms -race ./...
|
||||
|
||||
$(BUMP_VERSION):
|
||||
|
10
vendor/github.com/kevinburke/ssh_config/README.md
generated
vendored
10
vendor/github.com/kevinburke/ssh_config/README.md
generated
vendored
@ -82,11 +82,11 @@ file format.
|
||||
[blog]: https://kev.inburke.com/kevin/more-comment-preserving-configuration-parsers/
|
||||
[hostsfile]: https://github.com/kevinburke/hostsfile
|
||||
|
||||
## Donating
|
||||
## Sponsorships
|
||||
|
||||
I don't get paid to maintain this project. Donations free up time to make
|
||||
improvements to the library, and respond to bug reports. You can send donations
|
||||
via Paypal's "Send Money" feature to kev@inburke.com. Donations are not tax
|
||||
deductible in the USA.
|
||||
Thank you very much to Tailscale and Indeed for sponsoring development of this
|
||||
library. [Sponsors][sponsors] will get their names featured in the README.
|
||||
|
||||
You can also reach out about a consulting engagement: https://burke.services
|
||||
|
||||
[sponsors]: https://github.com/sponsors/kevinburke
|
||||
|
45
vendor/github.com/kevinburke/ssh_config/config.go
generated
vendored
45
vendor/github.com/kevinburke/ssh_config/config.go
generated
vendored
@ -8,7 +8,7 @@
|
||||
// the host name to match on ("example.com"), and the second argument is the key
|
||||
// you want to retrieve ("Port"). The keywords are case insensitive.
|
||||
//
|
||||
// port := ssh_config.Get("myhost", "Port")
|
||||
// port := ssh_config.Get("myhost", "Port")
|
||||
//
|
||||
// You can also manipulate an SSH config file and then print it or write it back
|
||||
// to disk.
|
||||
@ -43,7 +43,7 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
const version = "1.2"
|
||||
const version = "1.4.0"
|
||||
|
||||
var _ = version
|
||||
|
||||
@ -53,6 +53,8 @@ type configFinder func() string
|
||||
// files are parsed and cached the first time Get() or GetStrict() is called.
|
||||
type UserSettings struct {
|
||||
IgnoreErrors bool
|
||||
customConfig *Config
|
||||
customConfigFinder configFinder
|
||||
systemConfig *Config
|
||||
systemConfigFinder configFinder
|
||||
userConfig *Config
|
||||
@ -203,6 +205,13 @@ func (u *UserSettings) GetStrict(alias, key string) (string, error) {
|
||||
if u.onceErr != nil && u.IgnoreErrors == false {
|
||||
return "", u.onceErr
|
||||
}
|
||||
// TODO this is getting repetitive
|
||||
if u.customConfig != nil {
|
||||
val, err := findVal(u.customConfig, alias, key)
|
||||
if err != nil || val != "" {
|
||||
return val, err
|
||||
}
|
||||
}
|
||||
val, err := findVal(u.userConfig, alias, key)
|
||||
if err != nil || val != "" {
|
||||
return val, err
|
||||
@ -228,6 +237,12 @@ func (u *UserSettings) GetAllStrict(alias, key string) ([]string, error) {
|
||||
if u.onceErr != nil && u.IgnoreErrors == false {
|
||||
return nil, u.onceErr
|
||||
}
|
||||
if u.customConfig != nil {
|
||||
val, err := findAll(u.customConfig, alias, key)
|
||||
if err != nil || val != nil {
|
||||
return val, err
|
||||
}
|
||||
}
|
||||
val, err := findAll(u.userConfig, alias, key)
|
||||
if err != nil || val != nil {
|
||||
return val, err
|
||||
@ -243,16 +258,38 @@ func (u *UserSettings) GetAllStrict(alias, key string) ([]string, error) {
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
// ConfigFinder will invoke f to try to find a ssh config file in a custom
|
||||
// location on disk, instead of in /etc/ssh or $HOME/.ssh. f should return the
|
||||
// name of a file containing SSH configuration.
|
||||
//
|
||||
// ConfigFinder must be invoked before any calls to Get or GetStrict and panics
|
||||
// if f is nil. Most users should not need to use this function.
|
||||
func (u *UserSettings) ConfigFinder(f func() string) {
|
||||
if f == nil {
|
||||
panic("cannot call ConfigFinder with nil function")
|
||||
}
|
||||
u.customConfigFinder = f
|
||||
}
|
||||
|
||||
func (u *UserSettings) doLoadConfigs() {
|
||||
u.loadConfigs.Do(func() {
|
||||
// can't parse user file, that's ok.
|
||||
var filename string
|
||||
var err error
|
||||
if u.customConfigFinder != nil {
|
||||
filename = u.customConfigFinder()
|
||||
u.customConfig, err = parseFile(filename)
|
||||
// IsNotExist should be returned because a user specified this
|
||||
// function - not existing likely means they made an error
|
||||
if err != nil {
|
||||
u.onceErr = err
|
||||
}
|
||||
return
|
||||
}
|
||||
if u.userConfigFinder == nil {
|
||||
filename = userConfigFinder()
|
||||
} else {
|
||||
filename = u.userConfigFinder()
|
||||
}
|
||||
var err error
|
||||
u.userConfig, err = parseFile(filename)
|
||||
//lint:ignore S1002 I prefer it this way
|
||||
if err != nil && os.IsNotExist(err) == false {
|
||||
|
8
vendor/github.com/kevinburke/ssh_config/parser.go
generated
vendored
8
vendor/github.com/kevinburke/ssh_config/parser.go
generated
vendored
@ -21,9 +21,9 @@ type sshParser struct {
|
||||
type sshParserStateFn func() sshParserStateFn
|
||||
|
||||
// Formats and panics an error message based on a token
|
||||
func (p *sshParser) raiseErrorf(tok *token, msg string, args ...interface{}) {
|
||||
func (p *sshParser) raiseErrorf(tok *token, msg string) {
|
||||
// TODO this format is ugly
|
||||
panic(tok.Position.String() + ": " + fmt.Sprintf(msg, args...))
|
||||
panic(tok.Position.String() + ": " + msg)
|
||||
}
|
||||
|
||||
func (p *sshParser) raiseError(tok *token, err error) {
|
||||
@ -118,7 +118,7 @@ func (p *sshParser) parseKV() sshParserStateFn {
|
||||
}
|
||||
pat, err := NewPattern(strPatterns[i])
|
||||
if err != nil {
|
||||
p.raiseErrorf(val, "Invalid host pattern: %v", err)
|
||||
p.raiseErrorf(val, fmt.Sprintf("Invalid host pattern: %v", err))
|
||||
return nil
|
||||
}
|
||||
patterns = append(patterns, pat)
|
||||
@ -144,7 +144,7 @@ func (p *sshParser) parseKV() sshParserStateFn {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
p.raiseErrorf(val, "Error parsing Include directive: %v", err)
|
||||
p.raiseErrorf(val, fmt.Sprintf("Error parsing Include directive: %v", err))
|
||||
return nil
|
||||
}
|
||||
lastHost.Nodes = append(lastHost.Nodes, inc)
|
||||
|
Reference in New Issue
Block a user