Support IPv6, close #334

This commit is contained in:
Him188 2020-05-24 13:10:31 +08:00
parent 1c57e122e0
commit 503592de11

View File

@ -136,12 +136,9 @@ internal class StatSvc {
strDevName = client.device.model.encodeToString(),
strDevType = client.device.model.encodeToString(),
strOSVer = client.device.version.release.encodeToString(),
uOldSSOIp = 0,
uNewSSOIp = MiraiPlatformUtils.localIpAddress().split(".")
.foldIndexed(0L) { index: Int, acc: Long, s: String ->
acc or ((s.toLong() shl (index * 16)))
},
uNewSSOIp = MiraiPlatformUtils.localIpAddress().runCatching { ipToLong() }
.getOrElse { "192.168.1.123".ipToLong() },
strVendorName = "MIUI",
strVendorOSName = "?ONEPLUS A5000_23_17",
// register 时还需要
@ -173,6 +170,12 @@ internal class StatSvc {
}
}
private fun String.ipToLong(): Long {
return split('.').foldIndexed(0L) { index: Int, acc: Long, s: String ->
acc or (((s.toLongOrNull() ?: 0) shl (index * 16)))
}
}
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): Response {
return Response
}