Skip to content

Commit

Permalink
style: default values for connection
Browse files Browse the repository at this point in the history
  • Loading branch information
d-strobel committed Oct 16, 2023
1 parent 79dc780 commit c601be6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
12 changes: 0 additions & 12 deletions connection/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,11 @@ package connection
import (
"context"
"errors"
"time"

"github.com/masterzen/winrm"
"golang.org/x/crypto/ssh"
)

const (
// WinRM default values
defaultWinRMPort int = 5986
defaultWinRMUseTLS bool = false
defaultWinRMInsecure bool = true
defaultWinRMTimeout time.Duration = 0

// SSH default values
defaultSSHPort int = 22
)

type Connection struct {
WinRM *winrm.Client
SSH *ssh.Client
Expand Down
4 changes: 2 additions & 2 deletions connection/kerberos.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type KerberosConfig struct {

const (
// Default kerberos values
kerberosProtocolDefault = "http"
defaultKerberosProtocol = "http"
)

// winRMKerberosParams returns the neccessary parameters
Expand All @@ -22,7 +22,7 @@ func winRMKerberosParams(config *WinRMConfig) *winrm.Parameters {
params := winrm.DefaultParameters

// Set the protocol
kerberosProtocol := kerberosProtocolDefault
kerberosProtocol := defaultKerberosProtocol
if config.WinRMUseTLS {
kerberosProtocol = "https"
}
Expand Down
5 changes: 5 additions & 0 deletions connection/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ type SSHConfig struct {
SSHPassword string
}

const (
// SSH default values
defaultSSHPort int = 22
)

func newSSHClient(config *SSHConfig) (*ssh.Client, error) {

// Assert
Expand Down
8 changes: 8 additions & 0 deletions connection/winrm.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ type WinRMConfig struct {
WinRMKerberos *KerberosConfig
}

const (
// WinRM default values
defaultWinRMPort int = 5986
defaultWinRMUseTLS bool = false
defaultWinRMInsecure bool = true
defaultWinRMTimeout time.Duration = 0
)

func newWinRMClient(config *WinRMConfig) (*winrm.Client, error) {

// Assert
Expand Down

0 comments on commit c601be6

Please sign in to comment.