feat(loadtest): sync add real 500-session capacity harness
This commit is contained in:
parent
ac0566f779
commit
141f2f20c4
39 changed files with 4157 additions and 42 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package tdesktop
|
||||
|
||||
import (
|
||||
"net/netip"
|
||||
"time"
|
||||
|
||||
"github.com/iamxvbaba/td/tg"
|
||||
|
|
@ -13,18 +14,27 @@ import (
|
|||
// 字段值取 Telegram 常见默认;TDesktop 联调阶段按客户端实际需要微调
|
||||
// (记录于 docs/compatibility-matrix.md)。
|
||||
func BuildConfig(dc int, ip string, port int, now time.Time, publicBaseURL string) *tg.Config {
|
||||
// TELESRV_ADVERTISE_IP is validated during config loading. Parse again here
|
||||
// only to derive the wire ipv6 flag and to render IPv4-mapped addresses in
|
||||
// their canonical form. Keeping the advertised route in help.getConfig is a
|
||||
// protocol invariant: clients replace or persist this list for reconnects.
|
||||
addr, err := netip.ParseAddr(ip)
|
||||
if err == nil {
|
||||
addr = addr.Unmap()
|
||||
ip = addr.String()
|
||||
}
|
||||
meURLPrefix := links.NormalizeBaseURL(publicBaseURL) + "/"
|
||||
config := &tg.Config{
|
||||
Date: int(now.Unix()),
|
||||
Expires: int(now.Add(time.Hour).Unix()),
|
||||
TestMode: false,
|
||||
ThisDC: dc,
|
||||
// 不下发 DCOptions:客户端(TDesktop patch / drklo fork)已写死 static DC
|
||||
// 地址,空列表会让客户端保留它——drklo ConnectionsManager.cpp 的 processConfig
|
||||
// 在 dc_options 为空时整段跳过 replaceAddresses/saveConfig,既不覆盖也不持久化。
|
||||
// 服务端因此无需配置对外可达 IP,换网络/部署只改客户端写死地址即可。ip/port
|
||||
// 参数暂留,供未来需要显式 advertise 时改回。
|
||||
DCOptions: nil,
|
||||
DCOptions: []tg.DCOption{{
|
||||
Ipv6: addr.Is6(),
|
||||
ID: dc,
|
||||
IPAddress: ip,
|
||||
Port: port,
|
||||
}},
|
||||
ChatSizeMax: 200,
|
||||
MegagroupSizeMax: 200000,
|
||||
ForwardedCountMax: 100,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue