-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.go
62 lines (49 loc) · 1.12 KB
/
types.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// 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 Tristate int
const (
TristateMaybe Tristate = 0
TristateNo Tristate = -1
TristateYes Tristate = 1
)
type AuthTypes int
const (
AuthTypePassword AuthTypes = 1 << iota
AuthTypePrivateKeys
)
type OptionType int
const (
OptionTypeString = iota
OptionTypeBool
OptionTypeEnum
)
type OptionValue struct {
Value string
Title string
}
type Option struct {
Description string
Type OptionType
Values []OptionValue
}
type ClientDesc struct {
Title string
RequiresUser Tristate
SupportedAuthTypes AuthTypes
RequiresKnownHosts bool
SupportsEncryptionPassphrase bool
Options map[string]Option
}
type ClientType string
func (t ClientType) IsValid() bool {
if _, ok := getClientDesc(t); ok {
return true
}
return false
}
func (t ClientType) ClientDesc() ClientDesc {
desc, _ := getClientDesc(t)
return desc
}