-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.go
40 lines (32 loc) · 1.22 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
package dsl
type PasswordCallback func() (string, error)
func Password(password string) PasswordCallback {
return func() (string, error) { return password, nil }
}
type PrivateKeysCallback struct {
Keys func() ([]string, error)
Passphrase func(fingerprint string) (string, error)
}
func PrivateKey(key string, passphrase string) PrivateKeysCallback {
return PrivateKeysCallback{
Keys: func() ([]string, error) { return []string{key}, nil },
Passphrase: func(string) (string, error) { return passphrase, nil },
}
}
type EncryptionPassphraseCallback func() (string, error)
func EncryptionPassphrase(passphrase string) EncryptionPassphraseCallback {
return func() (string, error) { return passphrase, nil }
}
type Config struct {
Type ClientType
Host string
User string
AuthPassword PasswordCallback
AuthPrivateKeys PrivateKeysCallback
EncryptionPassphrase EncryptionPassphraseCallback
KnownHosts string
Options map[string]string
}