mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-06 18:06:36 +08:00
feat: auto-fallback to default bind IP when invalid bind address detected
When a forward service is updated with a bind IP that doesn't exist on the host network interfaces, the system now automatically falls back to the default bind address (listening on all interfaces) instead of failing. - Added syncForwardServicesWithWarnings to collect fallback warnings - Implemented fallbackForwardPortToDefaultBind for graceful degradation - Added UpdateForwardPortBindIP repository method to persist fallback - Enhanced error detection for 'cannot assign requested address' errors - Frontend displays warning toasts when fallback occurs - Added comprehensive unit tests for new error detection functions
This commit is contained in:
@@ -1325,11 +1325,16 @@ func (h *Handler) forwardUpdate(w http.ResponseWriter, r *http.Request) {
|
||||
response.WriteJSON(w, response.Err(-2, err.Error()))
|
||||
return
|
||||
}
|
||||
if err := h.syncForwardServices(updatedForward, "UpdateService", true); err != nil {
|
||||
warnings, err := h.syncForwardServicesWithWarnings(updatedForward, "UpdateService", true)
|
||||
if err != nil {
|
||||
h.rollbackForwardMutation(forward, oldPorts)
|
||||
response.WriteJSON(w, response.ErrDefault(err.Error()))
|
||||
return
|
||||
}
|
||||
if len(warnings) > 0 {
|
||||
response.WriteJSON(w, response.OK(map[string]interface{}{"warnings": warnings}))
|
||||
return
|
||||
}
|
||||
response.WriteJSON(w, response.OKEmpty())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user