This commit is contained in:
2025-06-07 09:36:56 +02:00
parent ebdf1336a1
commit f1d156ea84
4 changed files with 18 additions and 9 deletions

View File

@ -40,6 +40,7 @@ func NewTCPClient(TCPServer *TCPServer, Countries Countries) *TCPClient {
Address: Cfg.Cluster.Server,
Port: Cfg.Cluster.Port,
Login: Cfg.Cluster.Login,
Password: Cfg.Cluster.Password,
MsgChan: TCPServer.MsgChan,
CmdChan: TCPServer.CmdChan,
SpotChanToFlex: make(chan TelnetSpot, 100),
@ -149,13 +150,14 @@ func (c *TCPClient) ReadLine() {
if strings.Contains(message, Cfg.Cluster.LoginPrompt) {
Log.Debug("Found login prompt...sending callsign")
c.Write([]byte(c.Login + "\r\n"))
c.SetFilters()
if Cfg.Cluster.Command != "" {
c.WriteString(Cfg.Cluster.Command + "\n\r")
}
c.LoggedIn = true
// c.SetFilters()
// if Cfg.Cluster.Command != "" {
// c.WriteString(Cfg.Cluster.Command + "\n\r")
// }
Log.Infof("Connected to cluster %s", Cfg.Cluster.Server)
Log.Info("Start receiving spots")
c.LoggedIn = true
continue
}
}
@ -164,6 +166,11 @@ func (c *TCPClient) ReadLine() {
message, _ = strings.CutSuffix(message, "\n")
message, _ = strings.CutSuffix(message, "\r")
if strings.Contains(message, "password") {
Log.Debug("Found password prompt...sending password")
c.Write([]byte(c.Password + "\r\n"))
}
if err != nil {
Log.Errorf("Error reading message: %s", err)
c.Conn.Close()