Files
aaPanel/class/public/varint_encoder.py
Jack 1459724ba3 Update to 7.10.0
[+] Add Mail Server to the left menu.
[+] Add Mail Server - WebMail (requires Mail Server upgrade 5.1)
[+] Add WP Toolkit Plugin, Theme installation.
[+] Add Mail Server Login info.
[+] Add Mail Server WebMail One-click Login (requires Mail Server upgrade 5.2).
[+] Redesigned Security - Firewall.

[*] Optimized Mass Mail sending speed.
[*] Optimized the CPU usage problem of aaPanel startup service.

[-] Fix apache application, renew SSL issue.
[-] Fix Let's Encrypt account registeration failed.
[-] Fix openlitespeed using capital letters on domain name caused the website cannot be accessed issue.
[-] Fix problem of failure to reset root password in some versions of MariaDB.
[-] Fix an error in modifying Permission in some cases of MySQL.
[-] Fix the Website category display problem.
2024-08-09 09:57:59 +08:00

32 lines
509 B
Python

import struct
# varint编码 -> bytes
def _varint_encode(num):
res = b''
while num > 127:
res += struct.pack('B', 0x80 | (num & 0x7f))
num >>= 7
res += struct.pack('B', num)
return res
# varint解码 -> num, length
def _varint_decode(bs):
res = 0
n = 0
for shift in range(0, 64, 7):
if n > len(bs) - 1:
break
res |= (bs[n] & 0x7f) << shift
if (bs[n] & 0x80) == 0:
break
n += 1
return res, n + 1