-
Notifications
You must be signed in to change notification settings - Fork 16
/
opts.go
39 lines (33 loc) · 1.01 KB
/
opts.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
package sysaccess
type sshMgrOpts struct {
customSSHDPort int
customSSHDCfgFile string
manageDropletKeys bool
}
// SSHManagerOpt allows creating the SSHManager instance with designated options
type SSHManagerOpt func(opt *sshMgrOpts)
// WithCustomSSHDPort indicates the SSHD is running on a custom port which is specified via command line argument
func WithCustomSSHDPort(port int) SSHManagerOpt {
return func(opt *sshMgrOpts) {
opt.customSSHDPort = port
}
}
// WithCustomSSHDCfg specifies the path the custom sshd_config file that the sshd instance uses
func WithCustomSSHDCfg(cfgFile string) SSHManagerOpt {
return func(opt *sshMgrOpts) {
opt.customSSHDCfgFile = cfgFile
}
}
// WithoutManagingDropletKeys tells the agent to not attempt to manage the ssh keys
func WithoutManagingDropletKeys() SSHManagerOpt {
return func(opt *sshMgrOpts) {
opt.manageDropletKeys = false
}
}
func defaultMgrOpts() *sshMgrOpts {
return &sshMgrOpts{
customSSHDPort: 0,
customSSHDCfgFile: "",
manageDropletKeys: true,
}
}