WIP: replace the backend address related fields/API from udp config, move them to backend udp

This commit is contained in:
2025-05-13 17:03:26 +10:00
parent 72745cf268
commit b645f2b6bd
5 changed files with 43 additions and 45 deletions

View File

@@ -125,10 +125,9 @@ func sendUDP(ctx context.Context) {
if laddr, err = net.ResolveUDPAddr(UDP, ""); err != nil {
log.Fatal().Caller().Err(err).Str(SERVER, viper.GetString(SERVER)).Msg("udp resolve local/self address")
}
//TODO: log address to be bound by client
log.Info().Str(SERVER, viper.GetString(SERVER)).Msgf("bound address %v", laddr)
//TODO: use un-connected socket of UDP, replace all net.DialUDP() with net.ListenUDP()
// In Go, binding for UDP using ListenUDP. Confusing!!
// In Go, binding address and port for UDP use ListenUDP. Confusing!!
if conn, err = net.ListenUDP(UDP, laddr); err != nil {
log.Fatal().Caller().Err(err).Str(SERVER, viper.GetString(SERVER)).Msg("fail to bind local/self address")
}