mirror of
https://github.com/openlibrecommunity/olcng.git
synced 2026-07-03 14:05:17 +02:00
Fix and improve port hopping interval handling
https://github.com/2dust/v2rayNG/issues/5171
This commit is contained in:
@@ -168,7 +168,7 @@ inline fun <reified T : Serializable> Intent.serializable(key: String): T? = whe
|
||||
*
|
||||
* @return True if the CharSequence is not null and not empty, false otherwise.
|
||||
*/
|
||||
fun CharSequence?.isNotNullEmpty(): Boolean = this != null && this.isNotEmpty()
|
||||
fun CharSequence?.isNotNullEmpty(): Boolean = !this.isNullOrBlank()
|
||||
|
||||
fun String.concatUrl(vararg paths: String): String {
|
||||
val builder = StringBuilder(this.trimEnd('/'))
|
||||
|
||||
@@ -1227,7 +1227,11 @@ object V2rayConfigManager {
|
||||
if (profileItem.portHopping.isNotNullEmpty()) {
|
||||
hysteriaSetting.udphop = StreamSettingsBean.HysteriaSettingsBean.HysteriaUdpHopBean(
|
||||
port = profileItem.portHopping,
|
||||
interval = profileItem.portHoppingInterval?.ifEmpty { "30" }.orEmpty().toInt()
|
||||
interval = profileItem.portHoppingInterval
|
||||
?.trim()
|
||||
?.toIntOrNull()
|
||||
?.takeIf { it >= 5 }
|
||||
?: 30
|
||||
)
|
||||
}
|
||||
streamSettings.hysteriaSettings = hysteriaSetting
|
||||
|
||||
Reference in New Issue
Block a user