gotd: add time synchronization

This commit is contained in:
Tulir Asokan
2026-02-26 18:24:48 +02:00
parent 93fe3cb0ea
commit 6af986ded5
15 changed files with 110 additions and 48 deletions
-1
View File
@@ -206,7 +206,6 @@ func NewClient(appID int, appHash string, opt Options) *Client {
RetryInterval: opt.RetryInterval,
MaxRetries: opt.MaxRetries,
CompressThreshold: opt.CompressThreshold,
MessageID: opt.MessageID,
ExchangeTimeout: opt.ExchangeTimeout,
DialTimeout: opt.DialTimeout,
Clock: opt.Clock,
+1 -7
View File
@@ -12,8 +12,6 @@ import (
"go.mau.fi/mautrix-telegram/pkg/gotd/clock"
"go.mau.fi/mautrix-telegram/pkg/gotd/crypto"
"go.mau.fi/mautrix-telegram/pkg/gotd/exchange"
"go.mau.fi/mautrix-telegram/pkg/gotd/mtproto"
"go.mau.fi/mautrix-telegram/pkg/gotd/proto"
"go.mau.fi/mautrix-telegram/pkg/gotd/telegram/dcs"
"go.mau.fi/mautrix-telegram/pkg/gotd/tg"
)
@@ -99,8 +97,7 @@ type Options struct {
// Will be sent with session creation request.
Device DeviceConfig
MessageID mtproto.MessageIDSource
Clock clock.Clock
Clock clock.Clock
PingInterval time.Duration
PingTimeout time.Duration
@@ -153,9 +150,6 @@ func (opt *Options) setDefaults() {
if opt.MigrationTimeout == 0 {
opt.MigrationTimeout = time.Second * 15
}
if opt.MessageID == nil {
opt.MessageID = proto.NewMessageIDGen(opt.Clock.Now)
}
if opt.UpdateHandler == nil {
// No updates handler passed, so no sense to subscribe for updates.
// User should explicitly ignore updates using custom UpdateHandler.