mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-24 06:10:09 +08:00
Support IPv6, close #334
This commit is contained in:
parent
1c57e122e0
commit
503592de11
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user