Minor fixes to strings and ui, crash fixed #63

This commit is contained in:
Arty Bishop committed 2022-05-18 19:00:48 +01:00
1 parent a2f37e6b9f
commit 278c06170b
16 files changed
+157 -177

No files matched your search

+2 -2
View File
@@ -13,9 +13,9 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0"
implementation "org.json:json:20211205"
implementation "org.json:json:20220320"
testImplementation "junit:junit:4.13.2"
testImplementation "org.mockito:mockito-core:4.3.1"
testImplementation "org.mockito:mockito-core:4.4.0"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"
}
@@ -67,7 +67,8 @@ fun String.isValidIPv4(): Boolean {
}
fun String.isValidPort(): Boolean {
return this.isNotEmpty() && this.toInt() in 1024..65535
val port = "([1-9]|[1-9]\\d{1,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])"
return this.matches(port.toRegex()) && this.toInt() in 1024..65535
}
fun ping(hostname: String, port: Int): Int {