This commit is contained in:
2025-08-07 10:18:28 +02:00
parent 170b5c7912
commit d988e50f0d
7 changed files with 39 additions and 27 deletions

2
Makefile Normal file
View File

@@ -0,0 +1,2 @@
build:
go build .

View File

@@ -7,6 +7,7 @@ import (
"os"
"strings"
"sync"
"time"
log "github.com/sirupsen/logrus"
)
@@ -29,6 +30,7 @@ type TCPServer struct {
CmdChan chan string
Log *log.Logger
Config *Config
MessageSent int
}
func NewTCPServer(address string, port string) *TCPServer {
@@ -39,6 +41,7 @@ func NewTCPServer(address string, port string) *TCPServer {
MsgChan: make(chan string, 100),
CmdChan: make(chan string),
Mutex: new(sync.Mutex),
MessageSent: 0,
}
}
@@ -120,10 +123,17 @@ func (s *TCPServer) Write(message string) (n int, err error) {
func (s *TCPServer) broadcastMessage(message string) {
s.Mutex.Lock()
defer s.Mutex.Unlock()
if len(s.Clients) > 0 {
if s.MessageSent == 0 {
time.Sleep(3 * time.Second)
s.MessageSent += 1
}
for client := range s.Clients {
_, err := client.Write([]byte(message + "\r\n"))
s.MessageSent += 1
if err != nil {
fmt.Println("Error while sending message to clients:", client.RemoteAddr())
}
}
}
}

View File

@@ -26,8 +26,8 @@ cluster:
command: "SET/NOFILTER" #"SET/FILTER DOC/PASS EA,OH,G,F,DL,I,SV,9A,SK,S5,LX,OE,HA,CT"
login_prompt: "login:"
flex:
discovery: true # Radio must be on same LAN than the program
ip: 192.168.2.131 # if discovery is true no need to put an IP
discovery: false # Radio must be on same LAN than the program
ip: 82.67.157.19 # if discovery is true no need to put an IP
spot_life: 600 #seconds
telnetserver: # Log4OM must be connected to this server ie: localhost:7301 if on same machine as this program else ip:7301
host: 0.0.0.0

View File

@@ -20,7 +20,7 @@ func Gotify(spot FlexSpot) {
if Cfg.Gotify.Enable && !strings.Contains(ExceptionList, spot.DX) {
message := fmt.Sprintf("DX: %s\nFrom: %s\nFreq: %s\nMode: %s\nTime: %s\n", spot.DX, spot.SpotterCallsign, spot.FrequencyMhz, spot.Mode, spot.TimeStamp)
message := fmt.Sprintf("DX: %s\nFrom: %s\nFreq: %s\nMode: %s\nTime: %v\n", spot.DX, spot.SpotterCallsign, spot.FrequencyMhz, spot.Mode, spot.TimeStamp)
gotifyMsg := GotifyMessage{
Title: "",

BIN
images/FlexDXCluster.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

BIN
images/background.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

View File

@@ -42,7 +42,7 @@ func main() {
cfg := NewConfig(cfgPath)
log := NewLog()
log.Info("Running FlexDXCluster version 0.7")
log.Info("Running FlexDXCluster version 0.8")
log.Infof("Callsign: %s", cfg.General.Callsign)
DeleteDatabase("./flex.sqlite", log)