docs: 调整 README.md 结构,提升用户友好度

This commit is contained in:
M
2026-04-14 13:52:20 +08:00
parent 9e7b72a98f
commit 22edefcfd2
+27 -26
View File
@@ -56,6 +56,33 @@ async def main():
asyncio.run(main())
```
### 高可用工具
```python
from xmtdx import ping_all, KNOWN_HOSTS
# 并发测速,返回按延迟排序的 [(host, seconds), ...]
results = ping_all(KNOWN_HOSTS, timeout=5.0)
for host, ms in results:
print(f"{host} {ms*1000:.0f} ms")
# 自动选最优服务器
with TdxClient.from_best_host(ping_timeout=5.0) as c:
...
# asyncio 版本同样支持
client = AsyncTdxClient.from_best_host(ping_timeout=5.0)
```
内置服务器列表(`KNOWN_HOSTS`):
```
180.153.18.170 180.153.18.171 180.153.18.172
115.238.56.198 115.238.90.165 218.75.126.9
47.107.75.159 59.175.238.38
```
## API
### TdxClient
@@ -86,32 +113,6 @@ MIN_1 MIN_3 MIN_5 MIN_15 MIN_30 MIN_60
DAY WEEK MONTH SEASON YEAR YEAR_ALT
```
### 高可用工具
```python
from xmtdx import ping_all, KNOWN_HOSTS
# 并发测速,返回按延迟排序的 [(host, seconds), ...]
results = ping_all(KNOWN_HOSTS, timeout=5.0)
for host, ms in results:
print(f"{host} {ms*1000:.0f} ms")
# 自动选最优服务器
with TdxClient.from_best_host(ping_timeout=5.0) as c:
...
# asyncio 版本同样支持
client = AsyncTdxClient.from_best_host(ping_timeout=5.0)
```
内置服务器列表(`KNOWN_HOSTS`):
```
180.153.18.170 180.153.18.171 180.153.18.172
115.238.56.198 115.238.90.165 218.75.126.9
47.107.75.159 59.175.238.38
```
## 数据模型
所有 dataclass 字段均有类型注解。每条记录附带 `_raw: bytes`(原始协议字节)。