update log

This commit is contained in:
2024-10-31 11:14:35 +07:00
parent 91fc5836eb
commit f571d8ea18
8 changed files with 40 additions and 45 deletions

View File

@ -98,16 +98,16 @@ func (fc *FlexClient) StartFlexClient() {
fc.Timeout = 600 * time.Second
Log.Infof("Trying to connect to flex radio at %s:%s", fc.Address, fc.Port)
Log.Debugf("Trying to connect to FlexRadio at %s:%s", fc.Address, fc.Port)
fc.Conn, err = net.DialTCP("tcp", nil, addr)
if err != nil {
Log.Errorf("Could not connect to flex radio on %s", Cfg.Flex.IP)
Log.Error("Retrying to connect to flex radio in 5 seconds")
Log.Errorf("Could not connect to FlexRadio on %s", Cfg.Flex.IP)
Log.Error("Retrying to connect to FlexRadio in 5 seconds")
time.Sleep(time.Second * 5)
fc.StartFlexClient()
}
Log.Infof("Connected to flex radio at %s:%s", fc.Address, fc.Port)
Log.Infof("Connected to FlexRadio at %s:%s", fc.Address, fc.Port)
fc.IsConnected = true
go func() {
@ -208,7 +208,7 @@ func (fc *FlexClient) SendSpottoFlex(spot TelnetSpot) {
srcFlexSpot, err := fc.Repo.FindDXSameBand(flexSpot)
if err != nil {
Log.Debugf("could not find the DX in the database: ", err)
Log.Debugf("Could not find the DX in the database: ", err)
}
var stringSpot string
@ -303,9 +303,9 @@ func DiscoverFlexRadio() (bool, *Discovery) {
if Cfg.Flex.Discover {
Log.Infoln("FlexRadio Discovery is turned on...searching for radio on the network")
pc, err := net.ListenPacket("udp4", ":4992")
pc, err := net.ListenPacket("udp", ":4992")
if err != nil {
Log.Errorln("Could not receive UDP packets to discover FlexRadio")
Log.Errorf("Could not receive UDP packets to discover FlexRadio: ", err)
}
buf := make([]byte, 1024)
@ -316,7 +316,7 @@ func DiscoverFlexRadio() (bool, *Discovery) {
Log.Errorln("Could not read data on UDP port 4992")
}
discoverRe := regexp.MustCompile(`discovery_protocol_version=.*\smodel=(.*)\sserial=(.*)\sversion=(.*)\snickname=(.*)\scallsign=.*\sip=(.*)\sport=.*\s+`)
discoverRe := regexp.MustCompile(`discovery_protocol_version=.*\smodel=(.*)\sserial=(.*)\sversion=(.*)\snickname=(.*)\scallsign=.*\sip=(.*)\sport=.*`)
match := discoverRe.FindStringSubmatch(string(buf[:n]))
if len(match) > 0 {