diff --git a/PushDXCluster.exe b/PushDXCluster.exe index 1d25289..acd9b25 100644 Binary files a/PushDXCluster.exe and b/PushDXCluster.exe differ diff --git a/database.gp b/database.gp new file mode 100644 index 0000000..c9ecbf5 --- /dev/null +++ b/database.gp @@ -0,0 +1,2 @@ +package main + diff --git a/dx.txt b/dx.txt index dc0f7d8..ad20a6d 100644 --- a/dx.txt +++ b/dx.txt @@ -1 +1 @@ -8P9CB ZC4GW TM5FI VP2V/W5GI VP9/AB2E 8Q7KR 8Q7KB TF2MSN FW1JG CO8BLY OD5KU 5U5K S21ZI K8K 8Q7EC OX3LX FP/KV1J TO7PX S79/HA8PX JW/WE9G ZC4MK K8R 7E4K E51KEE E51CZZ DT0IP YN2RP VK2/W7BRS K8K \ No newline at end of file +8P9CB ZC4GW TM5FI VP2V/W5GI VP9/AB2E 8Q7KR 8Q7KB TF2MSN FW1JG CO8BLY OD5KU 5U5K S21ZI K8K 8Q7EC OX3LX FP/KV1J TO7PX S79/HA8PX JW/WE9G ZC4MK K8R 7E4K E51KEE E51CZZ DT0IP YN2RP VK2/W7BRS K8K 3W9A S21AF \ No newline at end of file diff --git a/main.go b/main.go index 931fb50..97ad30a 100644 --- a/main.go +++ b/main.go @@ -138,6 +138,27 @@ func SanitizeClusterMessage(message string) ClusterMessage { return mes } +func sendTelnetMessage(conn net.Conn, message string) { + if message != "XV9Q-1" { + time.Sleep(2 * time.Second) + } + _, err := conn.Write([]byte(message + "\n")) + if err != nil { + conn.Close() + time.Sleep(5 * time.Second) // Wait before retrying + } +} + +func sendFilters(conn net.Conn) { + go sendTelnetMessage(conn, "set/ft8") + time.Sleep(1 * time.Second) + go sendTelnetMessage(conn, "SET/FILTER DOC/PASS 3W") + time.Sleep(1 * time.Second) + go sendTelnetMessage(conn, "set/skimmer") + time.Sleep(1 * time.Second) + go sendTelnetMessage(conn, "set/ft4") +} + func main() { // Generate our config based on the config supplied @@ -151,6 +172,9 @@ func main() { log.Fatal(err) } + login := false + filters_sent := false + fmt.Println("PushDXCluster v0.1") for { // Connect to the Telnet server @@ -166,12 +190,6 @@ func main() { // Create a buffered reader to read from the Telnet server reader := bufio.NewReader(conn) - ft8 := 0 - filter := 0 - skimmer := 0 - ft4 := 0 - login := false - // Loop to read from the Telnet server for { message, err := reader.ReadString('\n') @@ -180,6 +198,8 @@ func main() { conn.Close() break } + + // Trim and Sanitize spots messages message = strings.TrimSpace(message) sMess := SanitizeClusterMessage(message) @@ -189,75 +209,19 @@ func main() { log.Printf("Received message: %s", message) } - // Send identification message + // Send Call to ID to the Server if message != "" && strings.Contains("Please enter your call:", message) { - _, err = conn.Write([]byte(cfg.Cluster.Call + "\n")) - if err != nil { - log.Printf("Failed to send identification message: %v", err) - conn.Close() - time.Sleep(5 * time.Second) // Wait before retrying - continue - } - log.Printf("Identification %s message sent", cfg.Cluster.Call) + go sendTelnetMessage(conn, "XV9Q-1") login = true } - if ft8 == 0 && login { - time.Sleep(2 * time.Second) - _, err = conn.Write([]byte("set/ft8" + "\n")) - - if err != nil { - log.Printf("Failed to send FT8 message: %v", err) - conn.Close() - time.Sleep(5 * time.Second) // Wait before retrying - continue - } - log.Println("Set FT8 message sent") - ft8++ - } - - if filter == 0 && login && message != "" && strings.Contains("FT8 spots enabled", message) { - _, err = conn.Write([]byte("SET/FILTER DOC/PASS 3W" + "\n")) - //SET/FILTER DXBM/OFF - //SET/FILTER DOC/PASS 3W - if err != nil { - log.Printf("Failed to send Filter message: %v", err) - conn.Close() - time.Sleep(5 * time.Second) // Wait before retrying - continue - } - log.Println("Set filter Vietnam message sent") - filter++ - } - - if skimmer == 0 && login && message != "" && strings.Contains("FT8 spots enabled", message) { - time.Sleep(1 * time.Second) - _, err = conn.Write([]byte("set/skimmer" + "\n")) - - if err != nil { - log.Printf("Failed to send skimmer message: %v", err) - conn.Close() - time.Sleep(5 * time.Second) // Wait before retrying - continue - } - log.Println("Set CW skimmer message sent") - skimmer++ - } - - if ft4 == 0 && login && message != "" && strings.Contains("Skimmer spots enabled", message) { - time.Sleep(3 * time.Second) - _, err = conn.Write([]byte("set/skimmer" + "\n")) - - if err != nil { - log.Printf("Failed to send FT4 message: %v", err) - conn.Close() - time.Sleep(5 * time.Second) // Wait before retrying - continue - } - log.Println("Set FT4 message sent") - ft4++ + // Set the FT8, CW, FT4 and only spots from Vietnam filters only once + if login && !filters_sent { + go sendFilters(conn) + filters_sent = true } + // If calls is in the DX List then send a Gotify notification if sMess.DX != "" && sMess.From == "XV9Q" && strings.Contains(DX, sMess.DX) { sendToGotify("Spot", sMess, 5, *cfg) } diff --git a/rsrc_windows_386.syso b/rsrc_windows_386.syso new file mode 100644 index 0000000..602a277 Binary files /dev/null and b/rsrc_windows_386.syso differ diff --git a/rsrc_windows_amd64.syso b/rsrc_windows_amd64.syso new file mode 100644 index 0000000..cf6ff7f Binary files /dev/null and b/rsrc_windows_amd64.syso differ