tweak interface
This commit is contained in:
23
config.go
23
config.go
@@ -10,31 +10,24 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func User(hostname string) string {
|
type UserSettings struct {
|
||||||
return ""
|
systemConfig *Config
|
||||||
|
userConfig *Config
|
||||||
|
username string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConfigFinder struct {
|
|
||||||
IgnoreSystemConfig bool
|
|
||||||
IgnoreUserConfig bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ConfigFinder) User(hostname string) string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
var DefaultFinder = &ConfigFinder{IgnoreSystemConfig: false, IgnoreUserConfig: false}
|
|
||||||
|
|
||||||
func parseFile(filename string) (*Config, error) {
|
func parseFile(filename string) (*Config, error) {
|
||||||
f, err := os.Open(filename)
|
f, err := os.Open(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
return LoadReader(f)
|
return Decode(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadReader(r io.Reader) (c *Config, err error) {
|
// Decode reads r into a Config, or returns an error if r could not be parsed as
|
||||||
|
// an SSH config file.
|
||||||
|
func Decode(r io.Reader) (c *Config, err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
if _, ok := r.(runtime.Error); ok {
|
if _, ok := r.(runtime.Error); ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user