Fix: fuck udp

This commit is contained in:
2025-10-16 08:09:19 +08:00
committed by ytshih
parent 0dea850cfa
commit 8fb294cd5d
7 changed files with 61 additions and 64 deletions

View File

@@ -97,7 +97,7 @@ func (m *LobbyModel) serverSendReply(response bool) tea.Cmd {
}
local := fmt.Sprintf("%s:%d",
m.listener.Addr().(*net.TCPAddr).IP.String(),
viper.GetString("host"),
m.listener.Addr().(*net.TCPAddr).Port)
m.err = utils.SendPayload(local, m.remote,
types.JoinResponse{Endpoint: local})
@@ -116,12 +116,7 @@ type clientScanMsg time.Time
func (m *LobbyModel) clientScan() tea.Cmd {
return tea.Tick(REFRESH_TIME, func(t time.Time) tea.Msg {
m.endpoints = []string{}
for _, endpoint := range viper.GetStringSlice("udp-endpoints") {
if err := utils.Ping(endpoint); err == nil {
m.endpoints = append(m.endpoints, endpoint)
}
}
m.endpoints, m.err = utils.Ping(viper.GetStringSlice("udp-endpoints"))
return clientScanMsg(t)
})
}