move gotd fork into repo. (#111)

- update to latest telegram layer
- remove some references to fields in tg.Entities that don't exist in
the schema
- originally added here:
https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e
  - referenced here
-
https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3
-
https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
This commit is contained in:
Adam Van Ymeren
2025-06-27 20:03:37 -07:00
committed by GitHub
parent 0952df0244
commit 7a04f298d2
19264 changed files with 1539697 additions and 84 deletions
+67
View File
@@ -0,0 +1,67 @@
//go:build go1.18
package exchange
import (
"context"
"testing"
"time"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
"go.mau.fi/mautrix-telegram/pkg/gotd/testutil"
"go.mau.fi/mautrix-telegram/pkg/gotd/transport"
)
func FuzzValid(f *testing.F) {
f.Add([]byte{1, 2, 3})
f.Fuzz(func(t *testing.T, data []byte) {
const dc = 2
reader := testutil.Rand(data)
privateKey := PrivateKey{
RSA: testutil.RSAPrivateKey(),
}
config := zap.NewProductionConfig()
config.OutputPaths = []string{"stdout"}
log, err := config.Build()
if err != nil {
t.Fatal(err)
}
i := transport.Intermediate
client, server := i.Pipe()
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
g, gctx := errgroup.WithContext(ctx)
g.Go(func() error {
_, err := NewExchanger(client, dc).
WithLogger(log.Named("client")).
WithRand(reader).
Client([]PublicKey{privateKey.Public()}).
Run(gctx)
if err != nil {
cancel()
}
return err
})
g.Go(func() error {
_, err := NewExchanger(server, dc).
WithLogger(log.Named("server")).
WithRand(reader).
Server(privateKey).
Run(gctx)
if err != nil {
cancel()
}
return err
})
if err := g.Wait(); err != nil {
t.Fatal(err)
}
})
}