fix(port): stop the mixed port climbing on every restart

The startup fallback persisted its replacement, so a port blocked once was never
asked for again. It now overrides the Runtime Config for the session only.

Most of those conflicts were not real: SO_REUSEADDR cannot reuse a TIME_WAIT
socket owned by another user, and a service-managed core runs as root while the
app does not. A refused bind is now confirmed by asking whether anything answers.

Also restores the borrowed port when saving proxy ports fails.
This commit is contained in:
wonfen
2026-08-17 23:30:21 +08:00
parent 906ec5e63a
commit 747a68ef2f
19 changed files with 304 additions and 120 deletions
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "Port settings saved",
"saveFailed": "Failed to save port settings",
"automaticFallback": "المنفذ {{oldPort}} مستخدم. تم تبديل منفذ الوكيل المختلط إلى {{newPort}} وحفظه.",
"automaticFallback": "المنفذ {{oldPort}} مستخدم، لذا تعمل هذه الجلسة على {{newPort}}. لم يتغيّر إعدادك وسيُعاد تجربة {{oldPort}} عند التشغيل التالي.",
"automaticFallbackFailed": "فشل التبديل التلقائي لمنفذ الوكيل المختلط: {{error}}",
"portTooLow": "يجب ألا يقل المنفذ عن 1000",
"portTooHigh": "يجب ألا يزيد المنفذ عن 65535"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "Port settings saved",
"saveFailed": "Failed to save port settings",
"automaticFallback": "Port {{oldPort}} ist belegt. Der gemischte Proxy-Port wurde auf {{newPort}} geändert und gespeichert.",
"automaticFallback": "Port {{oldPort}} ist belegt, daher läuft diese Sitzung auf {{newPort}}. Die Einstellung bleibt unverändert und {{oldPort}} wird beim nächsten Start erneut versucht.",
"automaticFallbackFailed": "Der automatische Wechsel des gemischten Proxy-Ports ist fehlgeschlagen: {{error}}",
"portTooLow": "Der Port muss mindestens 1000 sein",
"portTooHigh": "Der Port darf höchstens 65535 sein"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "Port settings saved",
"saveFailed": "Failed to save port settings",
"automaticFallback": "Port {{oldPort}} was in use. The mixed proxy port was switched to {{newPort}} and saved.",
"automaticFallback": "Port {{oldPort}} was in use, so this session runs on {{newPort}}. Your setting is unchanged and {{oldPort}} is retried on the next start.",
"automaticFallbackFailed": "Automatic mixed proxy port fallback failed: {{error}}",
"portTooLow": "The port must be 1000 or higher",
"portTooHigh": "The port must be 65535 or lower"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "Port settings saved",
"saveFailed": "Failed to save port settings",
"automaticFallback": "El puerto {{oldPort}} está en uso. El puerto proxy mixto se cambió a {{newPort}} y se guardó.",
"automaticFallback": "El puerto {{oldPort}} está en uso, por lo que esta sesión usa {{newPort}}. Tu configuración no ha cambiado y se volverá a intentar {{oldPort}} en el próximo inicio.",
"automaticFallbackFailed": "Error al cambiar automáticamente el puerto proxy mixto: {{error}}",
"portTooLow": "El puerto debe ser 1000 o superior",
"portTooHigh": "El puerto debe ser 65535 o inferior"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "Port settings saved",
"saveFailed": "Failed to save port settings",
"automaticFallback": "پورت {{oldPort}} در حال استفاده بود. پورت پراکسی ترکیبی به {{newPort}} تغییر کرد و ذخیره شد.",
"automaticFallback": "پورت {{oldPort}} در حال استفاده بود، بنابراین این اجرا از {{newPort}} استفاده می‌کند. تنظیم شما تغییر نکرده و در اجرای بعدی {{oldPort}} دوباره امتحان می‌شود.",
"automaticFallbackFailed": "تغییر خودکار پورت پراکسی ترکیبی ناموفق بود: {{error}}",
"portTooLow": "پورت باید ۱۰۰۰ یا بیشتر باشد",
"portTooHigh": "پورت باید ۶۵۵۳۵ یا کمتر باشد"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "Port settings saved",
"saveFailed": "Failed to save port settings",
"automaticFallback": "Port {{oldPort}} sedang digunakan. Port proxy campuran dialihkan ke {{newPort}} dan disimpan.",
"automaticFallback": "Port {{oldPort}} sedang digunakan, jadi sesi ini menggunakan {{newPort}}. Pengaturan Anda tidak berubah dan {{oldPort}} akan dicoba lagi saat mulai berikutnya.",
"automaticFallbackFailed": "Pengalihan otomatis port proxy campuran gagal: {{error}}",
"portTooLow": "Port harus 1000 atau lebih tinggi",
"portTooHigh": "Port harus 65535 atau lebih rendah"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "Port settings saved",
"saveFailed": "Failed to save port settings",
"automaticFallback": "ポート {{oldPort}} は使用中です。混合プロキシポートを {{newPort}} に切り替えて保存しました。",
"automaticFallback": "ポート {{oldPort}} が使用中のため、今回は {{newPort}} で動作します。設定は変更されておらず、次回起動時に {{oldPort}} を再試行します。",
"automaticFallbackFailed": "混合プロキシポートの自動切り替えに失敗しました: {{error}}",
"portTooLow": "ポート番号は 1000 以上である必要があります",
"portTooHigh": "ポート番号は 65535 以下である必要があります"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "포트 설정이 저장되었습니다",
"saveFailed": "포트 설정 저장에 실패했습니다",
"automaticFallback": "포트 {{oldPort}}이(가) 사용 중입니다. 혼합 프록시 포트를 {{newPort}}(으)로 전환하고 저장했습니다.",
"automaticFallback": "포트 {{oldPort}}이(가) 사용 중이어서 이번 실행은 {{newPort}}을(를) 사용합니다. 설정은 변경되지 않았으며 다음 시작 시 {{oldPort}}을(를) 다시 시도합니다.",
"automaticFallbackFailed": "혼합 프록시 포트 자동 전환에 실패했습니다: {{error}}",
"portTooLow": "포트는 1000 이상이어야 합니다",
"portTooHigh": "포트는 65535 이하여야 합니다"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Порт {{port}} уже используется",
"saved": "Настройки портов сохранены",
"saveFailed": "Не удалось сохранить настройки портов",
"automaticFallback": "Порт {{oldPort}} занят. Смешанный прокси-порт переключён на {{newPort}} и сохранён.",
"automaticFallback": "Порт {{oldPort}} занят, поэтому этот запуск использует {{newPort}}. Настройка не изменена, при следующем запуске {{oldPort}} будет опробован снова.",
"automaticFallbackFailed": "Не удалось автоматически переключить смешанный прокси-порт: {{error}}",
"portTooLow": "Порт должен быть не меньше 1000",
"portTooHigh": "Порт должен быть не больше 65535"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "Port settings saved",
"saveFailed": "Failed to save port settings",
"automaticFallback": "{{oldPort}} portu kullanımda. Karma proxy portu {{newPort}} olarak değiştirildi ve kaydedildi.",
"automaticFallback": "{{oldPort}} portu kullanımda olduğu için bu oturum {{newPort}} portunu kullanıyor. Ayarınız değişmedi ve sonraki başlatmada {{oldPort}} yeniden denenecek.",
"automaticFallbackFailed": "Karma proxy portu otomatik olarak değiştirilemedi: {{error}}",
"portTooLow": "Bağlantı noktası 1000 veya daha yüksek olmalıdır",
"portTooHigh": "Bağlantı noktası 65535 veya daha düşük olmalıdır"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "Port settings saved",
"saveFailed": "Failed to save port settings",
"automaticFallback": "Port {{oldPort}} was in use. The mixed proxy port was switched to {{newPort}} and saved.",
"automaticFallback": "Port {{oldPort}} was in use, so this session runs on {{newPort}}. Your setting is unchanged and {{oldPort}} is retried on the next start.",
"automaticFallbackFailed": "Automatic mixed proxy port fallback failed: {{error}}",
"portTooLow": "Порт 1000 дән ким булмаска тиеш",
"portTooHigh": "Порт 65535 тән артмаска тиеш"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "端口 {{port}} 已被占用",
"saved": "端口设置已保存",
"saveFailed": "端口设置保存失败",
"automaticFallback": "端口 {{oldPort}} 已被占用,混合代理端口已自动切换并保存为 {{newPort}}。",
"automaticFallback": "端口 {{oldPort}} 已被占用,本次运行改用 {{newPort}}。设置未更改,下次启动会重新尝试 {{oldPort}}。",
"automaticFallbackFailed": "混合代理端口自动切换失败:{{error}}",
"portTooLow": "端口号不能小于 1000",
"portTooHigh": "端口号不能大于 65535"
+1 -1
View File
@@ -292,7 +292,7 @@
"portInUse": "Port {{port}} is already in use",
"saved": "連結埠設定已儲存",
"saveFailed": "連結埠設定儲存失敗",
"automaticFallback": "連結埠 {{oldPort}} 已被佔用,混合代理連結埠已自動切換並儲存為 {{newPort}}。",
"automaticFallback": "連結埠 {{oldPort}} 已被佔用,本次執行改用 {{newPort}}。設定未變更,下次啟動會重新嘗試 {{oldPort}}。",
"automaticFallbackFailed": "混合代理連結埠自動切換失敗:{{error}}",
"portTooLow": "連結埠不能小於 1000",
"portTooHigh": "連結埠不能大於 65535"