update
This commit is contained in:
parent
28e606c414
commit
9e72764c2a
@ -3,5 +3,7 @@ gotify:
|
|||||||
token: ALaGS4MVMWTEMcP
|
token: ALaGS4MVMWTEMcP
|
||||||
|
|
||||||
cluster:
|
cluster:
|
||||||
host: arc.jg1vgx.net:7000
|
host: ve7cc.net:23
|
||||||
call: XV9Q
|
call: XV9Q
|
||||||
|
|
||||||
|
#arc.jg1vgx.net:7000
|
2
dx.txt
2
dx.txt
@ -1 +1 @@
|
|||||||
8P9CB ZC4GW TM5FI 3A/LB3LJ VP2V/W5GI VP9/AB2E 8Q7KR FT4GL 8Q7KB 5W1SA TF2MSN FW1JG CO8BLY PZ5RA OD5KU
|
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
|
128
main.go
128
main.go
@ -16,13 +16,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
telnetAddress = "dxc.nc7j.com:23" // Remplace par l'adresse et le port de ton serveur Telnet
|
|
||||||
gotifyURL = "https://gotify.rouggy.com/message" // Remplace par l'URL de ton serveur Gotify
|
|
||||||
gotifyToken = "ALaGS4MVMWTEMcP" // Remplace par le token de ton application Gotify
|
|
||||||
identificationMessage = "XV9Q" // Message d'identification à envoyer au serveur Telnet
|
|
||||||
)
|
|
||||||
|
|
||||||
var DX = readDXExpeFile("dx.txt")
|
var DX = readDXExpeFile("dx.txt")
|
||||||
|
|
||||||
type ClusterMessage struct {
|
type ClusterMessage struct {
|
||||||
@ -168,46 +161,17 @@ func main() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Connected to Telnet server")
|
log.Printf("Connected to %s server", cfg.Cluster.Host)
|
||||||
time.Sleep(3 * time.Second)
|
|
||||||
|
|
||||||
// Send identification message
|
|
||||||
_, err = conn.Write([]byte(identificationMessage + "\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.Println("Identification message sent")
|
|
||||||
|
|
||||||
time.Sleep(3 * 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")
|
|
||||||
|
|
||||||
time.Sleep(3 * time.Second)
|
|
||||||
|
|
||||||
_, err = conn.Write([]byte("SET/FILTER DOC/PASS 3W" + "\n"))
|
|
||||||
|
|
||||||
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")
|
|
||||||
|
|
||||||
// Create a buffered reader to read from the Telnet server
|
// Create a buffered reader to read from the Telnet server
|
||||||
reader := bufio.NewReader(conn)
|
reader := bufio.NewReader(conn)
|
||||||
|
|
||||||
|
ft8 := 0
|
||||||
|
filter := 0
|
||||||
|
skimmer := 0
|
||||||
|
ft4 := 0
|
||||||
|
login := false
|
||||||
|
|
||||||
// Loop to read from the Telnet server
|
// Loop to read from the Telnet server
|
||||||
for {
|
for {
|
||||||
message, err := reader.ReadString('\n')
|
message, err := reader.ReadString('\n')
|
||||||
@ -218,11 +182,85 @@ func main() {
|
|||||||
}
|
}
|
||||||
message = strings.TrimSpace(message)
|
message = strings.TrimSpace(message)
|
||||||
sMess := SanitizeClusterMessage(message)
|
sMess := SanitizeClusterMessage(message)
|
||||||
log.Printf("Received message: %s", message)
|
|
||||||
|
if sMess.DX != "" {
|
||||||
|
log.Printf("Sanitized message: Reporter: %s, DX: %s, Freq: %s, Report: %s, Time: %s", sMess.From, sMess.DX, sMess.Freq, sMess.Report, sMess.Time)
|
||||||
|
} else {
|
||||||
|
log.Printf("Received message: %s", message)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send identification message
|
||||||
|
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)
|
||||||
|
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++
|
||||||
|
}
|
||||||
|
|
||||||
if sMess.DX != "" && sMess.From == "XV9Q" && strings.Contains(DX, sMess.DX) {
|
if sMess.DX != "" && sMess.From == "XV9Q" && strings.Contains(DX, sMess.DX) {
|
||||||
sendToGotify("Spot", sMess, 5, *cfg)
|
sendToGotify("Spot", sMess, 5, *cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Disconnected from Telnet server, reconnecting...")
|
log.Println("Disconnected from Telnet server, reconnecting...")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user