summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-10-10 19:42:48 +0300
committerPaul Buetow <paul@buetow.org>2021-10-11 11:52:30 +0300
commit71f89dc7ec7cf993d1eca98771212afe6310e9c8 (patch)
treeca2812fb142b2d98f8a8092992a33d575329997a /internal
parentf44792c9102488774c9993b080f35c65287a64b1 (diff)
refactor
Diffstat (limited to 'internal')
-rw-r--r--internal/clients/connectors/serverconnection.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/internal/clients/connectors/serverconnection.go b/internal/clients/connectors/serverconnection.go
index 2d7b45a..2737ede 100644
--- a/internal/clients/connectors/serverconnection.go
+++ b/internal/clients/connectors/serverconnection.go
@@ -37,6 +37,7 @@ func NewServerConnection(server string, userName string,
c := ServerConnection{
hostKeyCallback: hostKeyCallback,
server: server,
+ port: config.Common.SSHPort,
handler: handler,
commands: commands,
config: &ssh.ClientConfig{
@@ -47,25 +48,20 @@ func NewServerConnection(server string, userName string,
},
}
+ // TODO: After reconnecting the port is wrong! Due to string slicing?
c.initServerPort()
return &c
}
// Server returns the server hostname connected to.
-func (c *ServerConnection) Server() string {
- return c.server
-}
+func (c *ServerConnection) Server() string { return c.server }
// Handler returns the handler used for the connection.
-func (c *ServerConnection) Handler() handlers.Handler {
- return c.handler
-}
+func (c *ServerConnection) Handler() handlers.Handler { return c.handler }
// Attempt to parse the server port address from the provided server FQDN.
func (c *ServerConnection) initServerPort() {
- c.port = config.Common.SSHPort
parts := strings.Split(c.server, ":")
-
if len(parts) == 2 {
dlog.Client.Debug("Parsing port from hostname", parts)
port, err := strconv.Atoi(parts[1])